diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-12-12 13:50:28 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-12-12 14:42:11 +0100 |
commit | 529dcc3f23d5e0ba57e1c4771955e94c1e06ec24 (patch) | |
tree | 326825adffddbd0c002fbda2bc72d07ad4e38361 /apps/comments | |
parent | 3c704d49bfed136f97f81be0a359af4352d49fc7 (diff) | |
download | nextcloud-server-529dcc3f23d5e0ba57e1c4771955e94c1e06ec24.tar.gz nextcloud-server-529dcc3f23d5e0ba57e1c4771955e94c1e06ec24.zip |
chore(comments): Drop dead code from comments app
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/comments')
-rw-r--r-- | apps/comments/.bowerrc | 3 | ||||
-rw-r--r-- | apps/comments/.l10nignore | 3 | ||||
-rw-r--r-- | apps/comments/lib/Listener/LoadAdditionalScripts.php | 4 | ||||
-rw-r--r-- | apps/comments/lib/Listener/LoadSidebarScripts.php | 5 | ||||
-rw-r--r-- | apps/comments/src/activitytabviewplugin.js | 73 | ||||
-rw-r--r-- | apps/comments/src/app.js | 32 | ||||
-rw-r--r-- | apps/comments/src/comments.js | 28 | ||||
-rw-r--r-- | apps/comments/src/templates.js | 17 | ||||
-rw-r--r-- | apps/comments/src/templates/filesplugin.handlebars | 3 | ||||
-rw-r--r-- | apps/comments/src/utils/numberUtil.js | 30 |
10 files changed, 2 insertions, 196 deletions
diff --git a/apps/comments/.bowerrc b/apps/comments/.bowerrc deleted file mode 100644 index faee1372545..00000000000 --- a/apps/comments/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "js/vendor" -}
\ No newline at end of file diff --git a/apps/comments/.l10nignore b/apps/comments/.l10nignore deleted file mode 100644 index 54f2ea9009a..00000000000 --- a/apps/comments/.l10nignore +++ /dev/null @@ -1,3 +0,0 @@ -# compiled vue templates -src/templates.js -js/ diff --git a/apps/comments/lib/Listener/LoadAdditionalScripts.php b/apps/comments/lib/Listener/LoadAdditionalScripts.php index e82f18cfbe4..e37b28cfae5 100644 --- a/apps/comments/lib/Listener/LoadAdditionalScripts.php +++ b/apps/comments/lib/Listener/LoadAdditionalScripts.php @@ -39,9 +39,7 @@ class LoadAdditionalScripts implements IEventListener { return; } - // TODO: make sure to only include the sidebar script when - // we properly split it between files list and sidebar - Util::addScript(Application::APP_ID, 'comments'); + // Adding init script for file list inline actions Util::addInitScript(Application::APP_ID, 'init'); } } diff --git a/apps/comments/lib/Listener/LoadSidebarScripts.php b/apps/comments/lib/Listener/LoadSidebarScripts.php index 39c81c03ad1..db1f2dc86f7 100644 --- a/apps/comments/lib/Listener/LoadSidebarScripts.php +++ b/apps/comments/lib/Listener/LoadSidebarScripts.php @@ -51,10 +51,7 @@ class LoadSidebarScripts implements IEventListener { $this->commentsManager->load(); $this->initialState->provideInitialState('activityEnabled', $this->appManager->isEnabledForUser('activity')); - - // TODO: make sure to only include the sidebar script when - // we properly split it between files list and sidebar - Util::addScript(Application::APP_ID, 'comments'); + // Add comments sidebar tab script Util::addScript(Application::APP_ID, 'comments-tab', 'files'); } } diff --git a/apps/comments/src/activitytabviewplugin.js b/apps/comments/src/activitytabviewplugin.js deleted file mode 100644 index 6b6e7ccda90..00000000000 --- a/apps/comments/src/activitytabviewplugin.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2016 - * - * @author Joas Schilling <coding@schilljs.com> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -/** @typedef {import('jquery')} jQuery */ - -(function() { - OCA.Comments.ActivityTabViewPlugin = { - - /** - * Prepare activity for display - * - * @param {OCA.Activity.ActivityModel} model for this activity - * @param {jQuery} $el jQuery handle for this activity - * @param {string} view The view that displays this activity - */ - prepareModelForDisplay(model, $el, view) { - if (model.get('app') !== 'comments' || model.get('type') !== 'comments') { - return - } - - if (view === 'ActivityTabView') { - $el.addClass('comment') - if (model.get('message') && this._isLong(model.get('message'))) { - $el.addClass('collapsed') - const $overlay = $('<div>').addClass('message-overlay') - $el.find('.activitymessage').after($overlay) - $el.on('click', this._onClickCollapsedComment) - } - } - }, - - /* - * Copy of CommentsTabView._onClickComment() - */ - _onClickCollapsedComment(ev) { - let $row = $(ev.target) - if (!$row.is('.comment')) { - $row = $row.closest('.comment') - } - $row.removeClass('collapsed') - }, - - /* - * Copy of CommentsTabView._isLong() - */ - _isLong(message) { - return message.length > 250 || (message.match(/\n/g) || []).length > 1 - }, - } - -})() - -OC.Plugins.register('OCA.Activity.RenderingPlugins', OCA.Comments.ActivityTabViewPlugin) diff --git a/apps/comments/src/app.js b/apps/comments/src/app.js deleted file mode 100644 index 7b5229cbd44..00000000000 --- a/apps/comments/src/app.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2016 Vincent Petry <pvince81@owncloud.com> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Vincent Petry <vincent@nextcloud.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -(function() { - if (!OCA.Comments) { - /** - * @namespace - */ - OCA.Comments = {} - } - -})() diff --git a/apps/comments/src/comments.js b/apps/comments/src/comments.js deleted file mode 100644 index ed9db7d4725..00000000000 --- a/apps/comments/src/comments.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -import './app.js' -import './templates.js' -import './activitytabviewplugin.js' - -window.OCA.Comments = OCA.Comments diff --git a/apps/comments/src/templates.js b/apps/comments/src/templates.js deleted file mode 100644 index 6064854f084..00000000000 --- a/apps/comments/src/templates.js +++ /dev/null @@ -1,17 +0,0 @@ -(function() { - var template = Handlebars.template, templates = OCA.Comments.Templates = OCA.Comments.Templates || {}; -templates['filesplugin'] = template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) { - var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) { - if (Object.prototype.hasOwnProperty.call(parent, propertyName)) { - return parent[propertyName]; - } - return undefined - }; - - return "<a class=\"action action-comment permanent\" title=\"" - + alias4(((helper = (helper = lookupProperty(helpers,"countMessage") || (depth0 != null ? lookupProperty(depth0,"countMessage") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"countMessage","hash":{},"data":data,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":66}}}) : helper))) - + "\" href=\"#\">\n <img class=\"svg\" src=\"" - + alias4(((helper = (helper = lookupProperty(helpers,"iconUrl") || (depth0 != null ? lookupProperty(depth0,"iconUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"iconUrl","hash":{},"data":data,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":34}}}) : helper))) - + "\"/>\n</a>\n"; -},"useData":true}); -})();
\ No newline at end of file diff --git a/apps/comments/src/templates/filesplugin.handlebars b/apps/comments/src/templates/filesplugin.handlebars deleted file mode 100644 index 8f3699380be..00000000000 --- a/apps/comments/src/templates/filesplugin.handlebars +++ /dev/null @@ -1,3 +0,0 @@ -<a class="action action-comment permanent" title="{{countMessage}}" href="#"> - <img class="svg" src="{{iconUrl}}"/> -</a> diff --git a/apps/comments/src/utils/numberUtil.js b/apps/comments/src/utils/numberUtil.js deleted file mode 100644 index cbbd6964019..00000000000 --- a/apps/comments/src/utils/numberUtil.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @copyright Copyright (c) 2020 John Molakvoæ <skjnldsv@protonmail.com> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -const isNumber = function(num) { - if (!num) { - return false - } - return Number(num).toString() === num.toString() -} - -export { isNumber } |