1 line
6.2 KiB
Plaintext
1 line
6.2 KiB
Plaintext
{"version":3,"file":"tasks-talk.mjs","sources":["../src/helpers/selector.js","../src/talk.js"],"sourcesContent":["/**\n * Nextcloud - Tasks\n *\n * @copyright Copyright (c) 2021 Jakob Röhrl <jakob.roehrl@web.de>\n *\n * @author Julius Härtl <jus@bitgrid.net>\n *\n * @author Jakob Röhrl <jakob.roehrl@web.de>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport store from '../store/store.js'\n\nimport { createApp } from 'vue'\n\nconst buildSelector = (selector, propsData = {}) => {\n\treturn new Promise((resolve, reject) => {\n\t\tconst container = document.createElement('div')\n\t\tdocument.getElementById('body-user').append(container)\n\t\tconst dialog = createApp(selector, {\n\t\t\t...propsData,\n\t\t\tonClose() {\n\t\t\t\tdialog.$el.remove()\n\t\t\t\treject(new Error('Selection canceled'))\n\t\t\t},\n\t\t})\n\t\t\t.use(store)\n\t\t\t.mount(container)\n\t})\n}\n\nexport {\n\tbuildSelector,\n}\n","/**\n * Nextcloud - Tasks\n *\n * @author Julius Härtl\n *\n * @copyright 2021 Julius Härtl <jus@bitgrid.net>\n *\n * @author Jakob Röhrl\n *\n * @copyright 2021 Jakob Röhrl <jakob.roehrl@web.de>\n *\n * @author Raimund Schlüßler\n *\n * @copyright 2021 Raimund Schlüßler <raimund.schluessler@mailbox.org>\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE\n * License as published by the Free Software Foundation; either\n * version 3 of the License, or any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU AFFERO GENERAL PUBLIC LICENSE for more details.\n *\n * You should have received a copy of the GNU Affero General Public\n * License along with this library. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\nimport TaskCreateDialog from './components/TaskCreateDialog.vue'\nimport { buildSelector } from './helpers/selector.js'\n\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\n\nwindow.addEventListener('DOMContentLoaded', () => {\n\tif (!window.OCA?.Talk?.registerMessageAction) {\n\t\treturn\n\t}\n\n\twindow.OCA.Talk.registerMessageAction({\n\t\tlabel: t('tasks', 'Create a task'),\n\t\ticon: 'icon-tasks',\n\t\tasync callback({ message: { message, messageParameters, actorDisplayName }, metadata: { name: conversationName, token: conversationToken } }) {\n\t\t\tconst parsedMessage = message.replace(/{[a-z0-9-_]+}/gi, function(parameter) {\n\t\t\t\tconst parameterName = parameter.substr(1, parameter.length - 2)\n\n\t\t\t\tif (messageParameters[parameterName]) {\n\t\t\t\t\tif (messageParameters[parameterName].type === 'file' && messageParameters[parameterName].path) {\n\t\t\t\t\t\treturn messageParameters[parameterName].path\n\t\t\t\t\t}\n\t\t\t\t\tif (messageParameters[parameterName].type === 'user' || messageParameters[parameterName].type === 'call') {\n\t\t\t\t\t\treturn '@' + messageParameters[parameterName].name\n\t\t\t\t\t}\n\t\t\t\t\tif (messageParameters[parameterName].name) {\n\t\t\t\t\t\treturn messageParameters[parameterName].name\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Do not replace so insert with curly braces again\n\t\t\t\treturn parameter\n\t\t\t})\n\n\t\t\tconst shortenedMessageCandidate = parsedMessage.replace(/^(.{255}[^\\s]*).*/, '$1')\n\t\t\tconst shortenedMessage = shortenedMessageCandidate === '' ? parsedMessage.substr(0, 255) : shortenedMessageCandidate\n\t\t\ttry {\n\t\t\t\tawait buildSelector(TaskCreateDialog, {\n\t\t\t\t\tsummary: shortenedMessage,\n\t\t\t\t\tdescription: parsedMessage + '\\n\\n' + '['\n\t\t\t\t\t\t+ t('tasks', 'Message from {author} in {conversationName}', { author: actorDisplayName, conversationName })\n\t\t\t\t\t\t+ '](' + generateUrl('/call/' + conversationToken) + ')',\n\t\t\t\t})\n\t\t\t} catch (e) {\n\t\t\t\tconsole.debug('Task creation dialog was canceled')\n\t\t\t}\n\t\t},\n\t})\n})\n"],"names":["buildSelector","selector","propsData","resolve","reject","container","dialog","createApp","store","t","message","messageParameters","actorDisplayName","conversationName","conversationToken","parsedMessage","parameter","parameterName","shortenedMessageCandidate","shortenedMessage","TaskCreateDialog","generateUrl"],"mappings":"8HA6BA,MAAMA,EAAgB,CAACC,EAAUC,EAAY,KACrC,IAAI,QAAQ,CAACC,EAASC,IAAW,CACvC,MAAMC,EAAY,SAAS,cAAc,KAAK,EAC9C,SAAS,eAAe,WAAW,EAAE,OAAOA,CAAS,EACrD,MAAMC,EAASC,EAAUN,EAAU,CAClC,GAAGC,EACH,SAAU,CACTI,EAAO,IAAI,OAAM,EACjBF,EAAO,IAAI,MAAM,oBAAoB,CAAC,CACvC,CACH,CAAG,EACC,IAAII,CAAK,EACT,MAAMH,CAAS,CAClB,CAAC,ECNF,OAAO,iBAAiB,mBAAoB,IAAM,CAC5C,OAAO,KAAK,MAAM,uBAIvB,OAAO,IAAI,KAAK,sBAAsB,CACrC,MAAOI,EAAE,QAAS,eAAe,EACjC,KAAM,aACN,MAAM,SAAS,CAAE,QAAS,CAAE,QAAAC,EAAS,kBAAAC,EAAmB,iBAAAC,CAAgB,EAAI,SAAU,CAAE,KAAMC,EAAkB,MAAOC,CAAiB,CAAE,EAAI,CAC7I,MAAMC,EAAgBL,EAAQ,QAAQ,kBAAmB,SAASM,EAAW,CAC5E,MAAMC,EAAgBD,EAAU,OAAO,EAAGA,EAAU,OAAS,CAAC,EAE9D,GAAIL,EAA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