diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-21 12:15:37 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-21 15:20:17 +0200 |
commit | 216804f83d5af391a8a4cc56de89280e3fcdd3bf (patch) | |
tree | 909109808f002c3ce269d0a598efa0f830633711 /apps/comments | |
parent | a5a8655bebb8652206ea5aa886699f706739e1fe (diff) | |
download | nextcloud-server-216804f83d5af391a8a4cc56de89280e3fcdd3bf.tar.gz nextcloud-server-216804f83d5af391a8a4cc56de89280e3fcdd3bf.zip |
fix(files): title and inline actions
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/comments')
-rw-r--r-- | apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts | 6 | ||||
-rw-r--r-- | apps/comments/src/actions/inlineUnreadCommentsAction.ts | 14 |
2 files changed, 12 insertions, 8 deletions
diff --git a/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts b/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts index 9ce192bb477..aabbf42fadb 100644 --- a/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts +++ b/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts @@ -44,7 +44,8 @@ describe('Inline unread comments action display name tests', () => { expect(action).toBeInstanceOf(FileAction) expect(action.id).toBe('comments-unread') - expect(action.displayName([file], view)).toBe('1 new comment') + expect(action.displayName([file], view)).toBe('') + expect(action.title!([file], view)).toBe('1 new comment') expect(action.iconSvgInline([], view)).toBe('<svg>SvgMock</svg>') expect(action.enabled!([file], view)).toBe(true) expect(action.inline!(file, view)).toBe(true) @@ -64,7 +65,8 @@ describe('Inline unread comments action display name tests', () => { }, }) - expect(action.displayName([file], view)).toBe('2 new comments') + expect(action.displayName([file], view)).toBe('') + expect(action.title!([file], view)).toBe('2 new comments') }) }) diff --git a/apps/comments/src/actions/inlineUnreadCommentsAction.ts b/apps/comments/src/actions/inlineUnreadCommentsAction.ts index e29e7d50b28..b537923b30e 100644 --- a/apps/comments/src/actions/inlineUnreadCommentsAction.ts +++ b/apps/comments/src/actions/inlineUnreadCommentsAction.ts @@ -19,15 +19,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -import { FileAction, Node, registerFileAction } from '@nextcloud/files' +import { FileAction, Node } from '@nextcloud/files' import { translate as t, translatePlural as n } from '@nextcloud/l10n' -import commentProcessingSvg from '@mdi/svg/svg/comment-processing.svg?raw' +import CommentProcessingSvg from '@mdi/svg/svg/comment-processing.svg?raw' + import logger from '../logger' export const action = new FileAction({ id: 'comments-unread', - displayName(nodes: Node[]) { + title(nodes: Node[]) { const unread = nodes[0].attributes['comments-unread'] as number if (unread >= 0) { return n('comments', '1 new comment', '{unread} new comments', unread, { unread }) @@ -35,7 +36,10 @@ export const action = new FileAction({ return t('comments', 'Comment') }, - iconSvgInline: () => commentProcessingSvg, + // Empty string when rendered inline + displayName: () => '', + + iconSvgInline: () => CommentProcessingSvg, enabled(nodes: Node[]) { const unread = nodes[0].attributes['comments-unread'] as number|undefined @@ -57,5 +61,3 @@ export const action = new FileAction({ order: -140, }) - -registerFileAction(action) |