From 7159ce1b3c3247a27915ffdc220c24188b1c447b Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Fri, 21 Jul 2023 19:58:29 +0500 Subject: [PATCH 1/2] UBER-609: fix no presenter for gmail messages. Fix inbox notification/view for telegram and gmail messages Signed-off-by: Vyacheslav Tumanov --- models/gmail/src/index.ts | 22 ++++++++++++++++++ models/gmail/src/plugin.ts | 1 + models/telegram/src/index.ts | 18 +++++++++++++++ models/telegram/src/plugin.ts | 4 +++- .../src/components/ChannelPanel.svelte | 5 +++- plugins/gmail-assets/lang/en.json | 1 + plugins/gmail-assets/lang/ru.json | 1 + .../src/components/MessagePresenter.svelte | 23 +++++++++++++++++++ plugins/gmail-resources/src/index.ts | 4 +++- plugins/gmail-resources/src/plugin.ts | 3 ++- plugins/gmail/src/index.ts | 3 ++- plugins/telegram-assets/lang/en.json | 1 + plugins/telegram-assets/lang/ru.json | 1 + 13 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 plugins/gmail-resources/src/components/MessagePresenter.svelte diff --git a/models/gmail/src/index.ts b/models/gmail/src/index.ts index 0321c5046a..002d4ac3fc 100644 --- a/models/gmail/src/index.ts +++ b/models/gmail/src/index.ts @@ -242,7 +242,29 @@ export function createModel (builder: Builder): void { gmail.ids.EmailNotification ) + builder.createDoc( + activity.class.TxViewlet, + core.space.Model, + { + objectClass: gmail.class.Message, + icon: contact.icon.Email, + txClass: core.class.TxCreateDoc, + match: { + 'attributes.incoming': true + }, + label: gmail.string.NewIncomingMessage, + display: 'inline', + editable: false, + hideOnRemove: true + }, + gmail.ids.NewMessageNotification + ) + builder.mixin(gmail.class.Message, core.class.Class, core.mixin.FullTextSearchContext, { parentPropagate: false }) + + builder.mixin(gmail.class.Message, core.class.Class, view.mixin.ObjectPresenter, { + presenter: gmail.component.MessagePresenter + }) } diff --git a/models/gmail/src/plugin.ts b/models/gmail/src/plugin.ts index 411b7fd19d..2082b7a370 100644 --- a/models/gmail/src/plugin.ts +++ b/models/gmail/src/plugin.ts @@ -44,6 +44,7 @@ export default mergeIds(gmailId, gmail, { }, ids: { TxSharedCreate: '' as Ref, + NewMessageNotification: '' as Ref, EmailNotificationGroup: '' as Ref }, activity: { diff --git a/models/telegram/src/index.ts b/models/telegram/src/index.ts index b2771c89e0..7b03059fb2 100644 --- a/models/telegram/src/index.ts +++ b/models/telegram/src/index.ts @@ -204,6 +204,24 @@ export function createModel (builder: Builder): void { telegram.ids.NewMessageNotification ) + builder.createDoc( + activity.class.TxViewlet, + core.space.Model, + { + objectClass: telegram.class.Message, + icon: contact.icon.Telegram, + txClass: core.class.TxCreateDoc, + match: { + 'attributes.incoming': true + }, + label: telegram.string.NewIncomingMessage, + display: 'inline', + editable: false, + hideOnRemove: true + }, + telegram.ids.NewMessageNotificationViewlet + ) + builder.mixin(telegram.class.Message, core.class.Class, core.mixin.FullTextSearchContext, { parentPropagate: false }) diff --git a/models/telegram/src/plugin.ts b/models/telegram/src/plugin.ts index cba20d01fa..02bdc1c135 100644 --- a/models/telegram/src/plugin.ts +++ b/models/telegram/src/plugin.ts @@ -35,11 +35,13 @@ export default mergeIds(telegramId, telegram, { Status: '' as IntlString, ConfigLabel: '' as IntlString, ConfigDescription: '' as IntlString, - NewMessage: '' as IntlString + NewMessage: '' as IntlString, + NewIncomingMessage: '' as IntlString }, ids: { TxMessage: '' as Ref, TxSharedCreate: '' as Ref, + NewMessageNotificationViewlet: '' as Ref, NotificationGroup: '' as Ref }, function: { diff --git a/plugins/contact-resources/src/components/ChannelPanel.svelte b/plugins/contact-resources/src/components/ChannelPanel.svelte index b523ddbbb4..aeb8c8a8e6 100644 --- a/plugins/contact-resources/src/components/ChannelPanel.svelte +++ b/plugins/contact-resources/src/components/ChannelPanel.svelte @@ -43,6 +43,9 @@ {#await getPresenter(channel) then presenter} {#if presenter} - + {/if} {/await} diff --git a/plugins/gmail-assets/lang/en.json b/plugins/gmail-assets/lang/en.json index f06feff8df..d00cc4b517 100644 --- a/plugins/gmail-assets/lang/en.json +++ b/plugins/gmail-assets/lang/en.json @@ -34,6 +34,7 @@ "Shared": "Shared", "AvailableTo": "Available to", "HaveWrittenEmail": "have written an email", + "NewIncomingMessage": "Sent you a new email", "ConfigLabel": "Email", "ConfigDescription": "Extension for Gmail email integration" } diff --git a/plugins/gmail-assets/lang/ru.json b/plugins/gmail-assets/lang/ru.json index dad35785ce..efcad84de1 100644 --- a/plugins/gmail-assets/lang/ru.json +++ b/plugins/gmail-assets/lang/ru.json @@ -34,6 +34,7 @@ "Shared": "Публичный", "AvailableTo": "Доступен для", "HaveWrittenEmail": "написал(а) сообщение", + "NewIncomingMessage": "Прислал вам новое сообщение", "ConfigLabel": "Электронная почта", "ConfigDescription": "Расширение по работе с Gmail электронной почтой" } diff --git a/plugins/gmail-resources/src/components/MessagePresenter.svelte b/plugins/gmail-resources/src/components/MessagePresenter.svelte new file mode 100644 index 0000000000..a2e78808a1 --- /dev/null +++ b/plugins/gmail-resources/src/components/MessagePresenter.svelte @@ -0,0 +1,23 @@ + + + +
+ {value.content} +
diff --git a/plugins/gmail-resources/src/index.ts b/plugins/gmail-resources/src/index.ts index 6b7595177b..6d663cede5 100644 --- a/plugins/gmail-resources/src/index.ts +++ b/plugins/gmail-resources/src/index.ts @@ -21,6 +21,7 @@ import TxSharedCreate from './components/activity/TxSharedCreate.svelte' import TxWriteMessage from './components/activity/TxWriteMessage.svelte' import Configure from './components/Configure.svelte' import Connect from './components/Connect.svelte' +import MessagePresenter from './components/MessagePresenter.svelte' import IconGmail from './components/icons/GmailColor.svelte' import Main from './components/Main.svelte' import NewMessages from './components/NewMessages.svelte' @@ -33,7 +34,8 @@ export default async (): Promise => ({ Connect, IconGmail, NewMessages, - Configure + Configure, + MessagePresenter }, activity: { TxSharedCreate, diff --git a/plugins/gmail-resources/src/plugin.ts b/plugins/gmail-resources/src/plugin.ts index 50d7c8a09a..62e21b5774 100644 --- a/plugins/gmail-resources/src/plugin.ts +++ b/plugins/gmail-resources/src/plugin.ts @@ -43,6 +43,7 @@ export default mergeIds(gmailId, gmail, { Shared: '' as IntlString, AvailableTo: '' as IntlString, Email: '' as IntlString, - HaveWrittenEmail: '' as IntlString + HaveWrittenEmail: '' as IntlString, + NewIncomingMessage: '' as IntlString } }) diff --git a/plugins/gmail/src/index.ts b/plugins/gmail/src/index.ts index be5ed0e46c..53c127d0a3 100644 --- a/plugins/gmail/src/index.ts +++ b/plugins/gmail/src/index.ts @@ -85,7 +85,8 @@ export default plugin(gmailId, { Connect: '' as AnyComponent, IconGmail: '' as AnyComponent, NewMessages: '' as AnyComponent, - Configure: '' as AnyComponent + Configure: '' as AnyComponent, + MessagePresenter: '' as AnyComponent }, integrationType: { Gmail: '' as Ref diff --git a/plugins/telegram-assets/lang/en.json b/plugins/telegram-assets/lang/en.json index d1d275a0c2..c295ff870a 100644 --- a/plugins/telegram-assets/lang/en.json +++ b/plugins/telegram-assets/lang/en.json @@ -20,6 +20,7 @@ "Incoming": "Incoming", "Messages": "Messages", "NewMessage": "New message", + "NewIncomingMessage": "Sent you a new message", "Telegram": "Telegram", "TelegramIntegrationDesc": "Use telegram integration", "Status": "Status", diff --git a/plugins/telegram-assets/lang/ru.json b/plugins/telegram-assets/lang/ru.json index 7cdddb70a7..b64ea3ec8a 100644 --- a/plugins/telegram-assets/lang/ru.json +++ b/plugins/telegram-assets/lang/ru.json @@ -20,6 +20,7 @@ "Incoming": "Входящее", "Messages": "Сообщения", "NewMessage": "Новое сообщение", + "NewIncomingMessage": "Прислал новое сообщение", "Telegram": "Telegram", "TelegramIntegrationDesc": "Подключить Telegram", "Status": "Статус", From 77b8030de1fc1c15f260a332044249c28debccc9 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Fri, 21 Jul 2023 21:20:45 +0500 Subject: [PATCH 2/2] UBER-609: remove MessagePresenter Signed-off-by: Vyacheslav Tumanov --- models/gmail/src/index.ts | 4 ---- .../src/components/MessagePresenter.svelte | 23 ------------------- plugins/gmail-resources/src/index.ts | 4 +--- plugins/gmail/src/index.ts | 3 +-- 4 files changed, 2 insertions(+), 32 deletions(-) delete mode 100644 plugins/gmail-resources/src/components/MessagePresenter.svelte diff --git a/models/gmail/src/index.ts b/models/gmail/src/index.ts index 002d4ac3fc..8057d9168c 100644 --- a/models/gmail/src/index.ts +++ b/models/gmail/src/index.ts @@ -263,8 +263,4 @@ export function createModel (builder: Builder): void { builder.mixin(gmail.class.Message, core.class.Class, core.mixin.FullTextSearchContext, { parentPropagate: false }) - - builder.mixin(gmail.class.Message, core.class.Class, view.mixin.ObjectPresenter, { - presenter: gmail.component.MessagePresenter - }) } diff --git a/plugins/gmail-resources/src/components/MessagePresenter.svelte b/plugins/gmail-resources/src/components/MessagePresenter.svelte deleted file mode 100644 index a2e78808a1..0000000000 --- a/plugins/gmail-resources/src/components/MessagePresenter.svelte +++ /dev/null @@ -1,23 +0,0 @@ - - - -
- {value.content} -
diff --git a/plugins/gmail-resources/src/index.ts b/plugins/gmail-resources/src/index.ts index 6d663cede5..6b7595177b 100644 --- a/plugins/gmail-resources/src/index.ts +++ b/plugins/gmail-resources/src/index.ts @@ -21,7 +21,6 @@ import TxSharedCreate from './components/activity/TxSharedCreate.svelte' import TxWriteMessage from './components/activity/TxWriteMessage.svelte' import Configure from './components/Configure.svelte' import Connect from './components/Connect.svelte' -import MessagePresenter from './components/MessagePresenter.svelte' import IconGmail from './components/icons/GmailColor.svelte' import Main from './components/Main.svelte' import NewMessages from './components/NewMessages.svelte' @@ -34,8 +33,7 @@ export default async (): Promise => ({ Connect, IconGmail, NewMessages, - Configure, - MessagePresenter + Configure }, activity: { TxSharedCreate, diff --git a/plugins/gmail/src/index.ts b/plugins/gmail/src/index.ts index 53c127d0a3..be5ed0e46c 100644 --- a/plugins/gmail/src/index.ts +++ b/plugins/gmail/src/index.ts @@ -85,8 +85,7 @@ export default plugin(gmailId, { Connect: '' as AnyComponent, IconGmail: '' as AnyComponent, NewMessages: '' as AnyComponent, - Configure: '' as AnyComponent, - MessagePresenter: '' as AnyComponent + Configure: '' as AnyComponent }, integrationType: { Gmail: '' as Ref