From 3c5648c87f62ef8ea8299ed78bdcbe222e414e3e Mon Sep 17 00:00:00 2001
From: Denis Bykhov <bykhov.denis@gmail.com>
Date: Wed, 7 Jun 2023 14:57:43 +0600
Subject: [PATCH] UBER-401 (#3381)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
---
 models/contact/src/index.ts                               | 1 +
 models/tags/src/index.ts                                  | 1 +
 models/view/src/index.ts                                  | 4 +++-
 packages/text-editor/lang/ru.json                         | 2 +-
 plugins/gmail-resources/src/components/Main.svelte        | 6 +++---
 plugins/gmail-resources/src/components/NewMessage.svelte  | 2 +-
 plugins/gmail-resources/src/components/NewMessages.svelte | 2 +-
 plugins/telegram-resources/src/components/Chat.svelte     | 4 ++--
 plugins/view-assets/lang/en.json                          | 1 +
 plugins/view-assets/lang/ru.json                          | 3 ++-
 plugins/view-resources/src/plugin.ts                      | 1 +
 11 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts
index 1e7b85be34..b9ffc0852a 100644
--- a/models/contact/src/index.ts
+++ b/models/contact/src/index.ts
@@ -801,6 +801,7 @@ export function createModel (builder: Builder): void {
     core.space.Model,
     {
       label: view.string.FilterIsEither,
+      selectedLabel: view.string.FilterIsEitherPlural,
       result: contact.function.FilterChannelInResult
     },
     contact.filter.FilterChannelIn
diff --git a/models/tags/src/index.ts b/models/tags/src/index.ts
index cca9e321f2..67765b95b7 100644
--- a/models/tags/src/index.ts
+++ b/models/tags/src/index.ts
@@ -130,6 +130,7 @@ export function createModel (builder: Builder): void {
     core.space.Model,
     {
       label: view.string.FilterIsEither,
+      selectedLabel: view.string.FilterIsEitherPlural,
       result: tags.function.FilterTagsInResult
     },
     tags.filter.FilterTagsIn
diff --git a/models/view/src/index.ts b/models/view/src/index.ts
index a6145d0b73..63953d33bc 100644
--- a/models/view/src/index.ts
+++ b/models/view/src/index.ts
@@ -795,6 +795,7 @@ export function createModel (builder: Builder): void {
     core.space.Model,
     {
       label: view.string.FilterIsEither,
+      selectedLabel: view.string.FilterIsEitherPlural,
       result: view.function.FilterValueInResult
     },
     view.filter.FilterValueIn
@@ -815,6 +816,7 @@ export function createModel (builder: Builder): void {
     core.space.Model,
     {
       label: view.string.FilterIsEither,
+      selectedLabel: view.string.FilterIsEitherPlural,
       result: view.function.FilterObjectInResult
     },
     view.filter.FilterObjectIn
@@ -942,7 +944,7 @@ export function createModel (builder: Builder): void {
     core.space.Model,
     {
       label: view.string.ExactDate,
-      selectedLabel: view.string.FilterIsEither,
+      selectedLabel: view.string.FilterIsEitherPlural,
       result: view.function.FilterDateCustom
     },
     view.filter.FilterDateCustom
diff --git a/packages/text-editor/lang/ru.json b/packages/text-editor/lang/ru.json
index 416cf30d99..f236d0f94d 100644
--- a/packages/text-editor/lang/ru.json
+++ b/packages/text-editor/lang/ru.json
@@ -38,7 +38,7 @@
     "Table": "Таблица",
     "InsertTable": "Добавить таблицу",
     "TableOptions": "Настроить таблицу",
-    "Width": "Щирина",
+    "Width": "Ширина",
     "Height": "Высота",
     "Unset": "Убрать"
   }
diff --git a/plugins/gmail-resources/src/components/Main.svelte b/plugins/gmail-resources/src/components/Main.svelte
index f45e0b9099..76f9ff181c 100644
--- a/plugins/gmail-resources/src/components/Main.svelte
+++ b/plugins/gmail-resources/src/components/Main.svelte
@@ -58,6 +58,9 @@
     },
     (res) => {
       channel = res[0]
+      if (channel !== undefined) {
+        notificationClient.forceRead(channel._id, channel._class)
+      }
     }
   )
 
@@ -77,9 +80,6 @@
 
   async function selectHandler (e: CustomEvent): Promise<void> {
     currentMessage = e.detail
-    if (channel !== undefined) {
-      await notificationClient.read(channel._id)
-    }
   }
 
   const settingsQuery = createQuery()
diff --git a/plugins/gmail-resources/src/components/NewMessage.svelte b/plugins/gmail-resources/src/components/NewMessage.svelte
index a1d045a138..ddf7929f28 100644
--- a/plugins/gmail-resources/src/components/NewMessage.svelte
+++ b/plugins/gmail-resources/src/components/NewMessage.svelte
@@ -73,7 +73,7 @@
       },
       objectId
     )
-    await notificationClient.read(channel._id)
+    await notificationClient.forceRead(channel._id, channel._class)
     objectId = generateId()
     dispatch('close')
   }
diff --git a/plugins/gmail-resources/src/components/NewMessages.svelte b/plugins/gmail-resources/src/components/NewMessages.svelte
index f1f2c78731..7fe3175def 100644
--- a/plugins/gmail-resources/src/components/NewMessages.svelte
+++ b/plugins/gmail-resources/src/components/NewMessages.svelte
@@ -92,7 +92,7 @@
           .map((m) => m.trim())
           .filter((m) => m.length)
       })
-      await notificationClient.read(channel._id)
+      await notificationClient.forceRead(channel._id, channel._class)
       for (const attachment of attachments) {
         await client.addCollection(
           attachmentP.class.Attachment,
diff --git a/plugins/telegram-resources/src/components/Chat.svelte b/plugins/telegram-resources/src/components/Chat.svelte
index d6d9650e69..c03155471e 100644
--- a/plugins/telegram-resources/src/components/Chat.svelte
+++ b/plugins/telegram-resources/src/components/Chat.svelte
@@ -110,7 +110,7 @@
       (res) => {
         messages = res.reverse()
         if (channel !== undefined) {
-          notificationClient.read(channel._id)
+          notificationClient.forceRead(channel._id, channel._class)
         }
       },
       {
@@ -171,7 +171,7 @@
       }
     )
     if (channel !== undefined) {
-      await notificationClient.read(channel._id)
+      await notificationClient.forceRead(channel._id, channel._class)
     }
     clear()
   }
diff --git a/plugins/view-assets/lang/en.json b/plugins/view-assets/lang/en.json
index 8d8aec5899..d93a60d3ab 100644
--- a/plugins/view-assets/lang/en.json
+++ b/plugins/view-assets/lang/en.json
@@ -49,6 +49,7 @@
     "ClearFilters": "Clear filters",
     "FilterIsNot": "is not",
     "FilterIsEither": "is",
+    "FilterIsEitherPlural": "is",
     "FilterStatesCount": "{value, plural, =1 {1 state} other {# states}}",
     "FilterUpdated": "Filter was updated",
     "FilterRemoved": "{count, plural, =1 {# non-existing value was} other {# non-existing values were}} removed from the filter",
diff --git a/plugins/view-assets/lang/ru.json b/plugins/view-assets/lang/ru.json
index da58b822ca..e6fb68d71a 100644
--- a/plugins/view-assets/lang/ru.json
+++ b/plugins/view-assets/lang/ru.json
@@ -45,7 +45,8 @@
     "Filter": "Фильтр",
     "ClearFilters": "Очистить",
     "FilterIsNot": "не равен",
-    "FilterIsEither": "{value, plural, =1 {равен} other {один из}}",
+    "FilterIsEither": "равен",
+    "FilterIsEitherPlural": "{value, plural, =1 {равен} other {один из}}",
     "FilterStatesCount": "{value, plural, =1 {1 состоянию} other {# состояний}}",
     "FilterUpdated": "Фильтр был обновлен",
     "FilterRemoved": "Несуществующие значения были удалены из фильтра: {count}",
diff --git a/plugins/view-resources/src/plugin.ts b/plugins/view-resources/src/plugin.ts
index 4a3a9d8185..55c4edb881 100644
--- a/plugins/view-resources/src/plugin.ts
+++ b/plugins/view-resources/src/plugin.ts
@@ -52,6 +52,7 @@ export default mergeIds(viewId, view, {
     ClearFilters: '' as IntlString,
     FilterIsNot: '' as IntlString,
     FilterIsEither: '' as IntlString,
+    FilterIsEitherPlural: '' as IntlString,
     FilterArrayAll: '' as IntlString,
     FilterArrayAny: '' as IntlString,
     FilterStatesCount: '' as IntlString,