{"version":3,"file":"comments-init.mjs","sources":["../apps/comments/src/actions/inlineUnreadCommentsAction.ts","../apps/comments/src/init.ts"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { FileAction, Node } from '@nextcloud/files'\nimport { translate as t, translatePlural as n } from '@nextcloud/l10n'\nimport CommentProcessingSvg from '@mdi/svg/svg/comment-processing.svg?raw'\n\nimport logger from '../logger'\n\nexport const action = new FileAction({\n\tid: 'comments-unread',\n\n\ttitle(nodes: Node[]) {\n\t\tconst unread = nodes[0].attributes['comments-unread'] as number\n\t\tif (unread >= 0) {\n\t\t\treturn n('comments', '1 new comment', '{unread} new comments', unread, { unread })\n\t\t}\n\t\treturn t('comments', 'Comment')\n\t},\n\n\t// Empty string when rendered inline\n\tdisplayName: () => '',\n\n\ticonSvgInline: () => CommentProcessingSvg,\n\n\tenabled(nodes: Node[]) {\n\t\tconst unread = nodes[0].attributes['comments-unread'] as number|undefined\n\t\treturn typeof unread === 'number' && unread > 0\n\t},\n\n\tasync exec(node: Node) {\n\t\ttry {\n\t\t\twindow.OCA.Files.Sidebar.setActiveTab('comments')\n\t\t\tawait window.OCA.Files.Sidebar.open(node.path)\n\t\t\treturn null\n\t\t} catch (error) {\n\t\t\tlogger.error('Error while opening sidebar', { error })\n\t\t\treturn false\n\t\t}\n\t},\n\n\tinline: () => true,\n\n\torder: -140,\n})\n","/**\n * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nimport { registerFileAction } from '@nextcloud/files'\nimport { action } from './actions/inlineUnreadCommentsAction'\n\nregisterFileAction(action)\n"],"names":["action","FileAction","nodes","unread","n","t","CommentProcessingSvg","node","error","logger","registerFileAction"],"mappings":";uVAUa,MAAAA,EAAS,IAAIC,EAAW,CACpC,GAAI,kBAEJ,MAAMC,EAAe,CACpB,MAAMC,EAASD,EAAM,CAAC,EAAE,WAAW,iBAAiB,EACpD,OAAIC,GAAU,EACNC,EAAE,WAAY,gBAAiB,wBAAyBD,EAAQ,CAAE,OAAAA,EAAQ,EAE3EE,EAAE,WAAY,SAAS,CAC/B,EAGA,YAAa,IAAM,GAEnB,cAAe,IAAMC,EAErB,QAAQJ,EAAe,CACtB,MAAMC,EAASD,EAAM,CAAC,EAAE,WAAW,iBAAiB,EAC7C,OAAA,OAAOC,GAAW,UAAYA,EAAS,CAC/C,EAEA,MAAM,KAAKI,EAAY,CAClB,GAAA,CACH,OAAA,OAAO,IAAI,MAAM,QAAQ,aAAa,UAAU,EAChD,MAAM,OAAO,IAAI,MAAM,QAAQ,KAAKA,EAAK,IAAI,EACtC,WACCC,EAAO,CACf,OAAAC,EAAO,MAAM,8BAA+B,CAAE,MAAAD,CAAO,CAAA,EAC9C,EACR,CACD,EAEA,OAAQ,IAAM,GAEd,MAAO,IACR,CAAC,ECtCDE,EAAmBV,CAAM"}