From 0892f0c8510c3aeab565710a7d8bcfdd45a5e53a Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 6 Jun 2025 11:26:02 +0200 Subject: [PATCH 1/3] feat: add 'Read all messages' action to Sudo menu in debug menu --- electron/js/menu.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/electron/js/menu.js b/electron/js/menu.js index 55c6c15708..b1578571a0 100644 --- a/electron/js/menu.js +++ b/electron/js/menu.js @@ -367,6 +367,8 @@ class MenuManager { { label: 'Reset onboarding', click: () => Util.send(this.win, 'commandGlobal', 'resetOnboarding') }, + { label: 'Read all messages', click: () => Util.send(this.win, 'commandGlobal', 'readAllMessages') }, + Separator, { label: 'Relaunch', click: () => Api.exit(this.win, true) }, From 9ac972c10a869590ab9dbfbce1e82df8c9c72ad9 Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 6 Jun 2025 11:27:30 +0200 Subject: [PATCH 2/3] JS-7194: fix --- src/json/text.json | 2 +- src/scss/menu/dataview/create/bookmark.scss | 4 ++-- src/ts/component/util/label.tsx | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/json/text.json b/src/json/text.json index dc6ca63346..08b32219b7 100644 --- a/src/json/text.json +++ b/src/json/text.json @@ -1843,7 +1843,7 @@ "toastChatAttachmentsLimitReached": "You can upload only %s %s at a time", "toastWidget": "Widget %s has been added", - "toastJoinSpace": "You have joined the %s", + "toastJoinSpace": "You have joined %s", "textColor-grey": "Grey", "textColor-yellow": "Yellow", diff --git a/src/scss/menu/dataview/create/bookmark.scss b/src/scss/menu/dataview/create/bookmark.scss index 557a90a419..b2b1cef9d7 100644 --- a/src/scss/menu/dataview/create/bookmark.scss +++ b/src/scss/menu/dataview/create/bookmark.scss @@ -16,8 +16,8 @@ .buttons { flex-shrink: 0; color: var(--color-control-active); font-weight: 500; user-select: none; display: flex; gap: 0px 16px; height: 100%; } .buttons { .button { - display: inline-block; vertical-align: top; transition: $transitionAllCommon; color: var(--color-control-active); - background: none; border: 0px; padding: 0px; height: 100%; line-height: 44px; + display: inline-block; vertical-align: top; transition: $transitionAllCommon; background: none; border: 0px; padding: 0px; height: 100%; + line-height: 44px; } .button.hide { display: none; } .button:hover { color: var(--color-text-primary); } diff --git a/src/ts/component/util/label.tsx b/src/ts/component/util/label.tsx index cdfd87e929..7103b7d36c 100644 --- a/src/ts/component/util/label.tsx +++ b/src/ts/component/util/label.tsx @@ -27,6 +27,12 @@ const Label: FC = ({ }) => { const nodeRef = useRef(null); const cn = [ 'label' ]; + const dataProps = { ...dataset }; + + if (className.match(/animation/)) { + dataProps['animation-type'] = I.AnimType.Text; + dataProps.content = text; + }; if (className) { cn.push(className); @@ -51,7 +57,7 @@ const Label: FC = ({ onMouseDown={onMouseDown} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} - {...U.Common.dataProps({ ...dataset, content: text, 'animation-type': I.AnimType.Text })} + {...U.Common.dataProps(dataProps)} /> ); From f6ad0d984c0eeccf524ec199c7d1ede33203fa8f Mon Sep 17 00:00:00 2001 From: Andrew Simachev Date: Fri, 6 Jun 2025 11:31:19 +0200 Subject: [PATCH 3/3] code review --- electron/js/menu.js | 1 - src/ts/lib/api/command.ts | 7 ++++++- src/ts/lib/keyboard.ts | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/electron/js/menu.js b/electron/js/menu.js index b1578571a0..1e70d37e3d 100644 --- a/electron/js/menu.js +++ b/electron/js/menu.js @@ -366,7 +366,6 @@ class MenuManager { Separator, { label: 'Reset onboarding', click: () => Util.send(this.win, 'commandGlobal', 'resetOnboarding') }, - { label: 'Read all messages', click: () => Util.send(this.win, 'commandGlobal', 'readAllMessages') }, Separator, diff --git a/src/ts/lib/api/command.ts b/src/ts/lib/api/command.ts index 66dea2e656..fe22b64c1a 100644 --- a/src/ts/lib/api/command.ts +++ b/src/ts/lib/api/command.ts @@ -2314,7 +2314,6 @@ export const ChatDeleteMessage = (objectId: string, messageId: string, callBack? request.setMessageid(messageId); dispatcher.request(ChatDeleteMessage.name, request, callBack); - }; export const ChatGetMessages = (objectId: string, beforeOrderId: string, afterOrderId: string, limit: number, includeBoundary: boolean, callBack?: (message: any) => void) => { @@ -2350,6 +2349,12 @@ export const ChatUnreadMessages = (objectId: string, afterOrderId: string, callB dispatcher.request(ChatUnreadMessages.name, request, callBack); }; +export const ChatReadAll = (callBack?: (message: any) => void) => { + const request = new Rpc.Chat.ReadAll.Request(); + + dispatcher.request(ChatReadAll.name, request, callBack); +}; + export const ChatSubscribeLastMessages = (objectId: string, limit: number, subId: string, callBack?: (message: any) => void) => { const request = new Rpc.Chat.SubscribeLastMessages.Request(); diff --git a/src/ts/lib/keyboard.ts b/src/ts/lib/keyboard.ts index 87fdda9369..a0a9289b1a 100644 --- a/src/ts/lib/keyboard.ts +++ b/src/ts/lib/keyboard.ts @@ -559,7 +559,6 @@ class Keyboard { const logPath = electron.logPath(); const tmpPath = electron.tmpPath(); const route = analytics.route.menuSystem; - const isMainChat = this.isMainChat(); const canUndo = !this.isFocused && this.isMainEditor(); switch (cmd) { @@ -814,6 +813,11 @@ class Keyboard { break; }; + case 'readAllMessages': { + C.ChatReadAll(); + break; + }; + }; };