Skip DOM updates when the article is not present
authorAlexander Ebert <ebert@woltlab.com>
Thu, 19 Nov 2020 15:56:12 +0000 (16:56 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 19 Nov 2020 15:56:12 +0000 (16:56 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Article/InlineEditor.js

index 0c2a10d855ac8cc7ea29dcbd5d4aa59c387cb7e7..dcbfd07372fb73817b2b7c8558b7021f687ecb41 100644 (file)
@@ -254,6 +254,10 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Language', 'U
                 */
                _triggerDelete: function(articleId) {
                        var article = _articles.get(articleId);
+                       if (!article) {
+                               // The affected article might be hidden by the filter settings.
+                               return;
+                       }
                        
                        if (article.isArticleEdit) {
                                window.location = this._options.redirectUrl;
@@ -275,6 +279,10 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Language', 'U
                 */
                _triggerPublish: function(articleId) {
                        var article = _articles.get(articleId);
+                       if (!article) {
+                               // The affected article might be hidden by the filter settings.
+                               return;
+                       }
                        
                        if (article.isArticleEdit) {
                                // unsupported
@@ -291,6 +299,10 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Language', 'U
                 */
                _triggerRestore: function(articleId) {
                        var article = _articles.get(articleId);
+                       if (!article) {
+                               // The affected article might be hidden by the filter settings.
+                               return;
+                       }
                        
                        elHide(article.buttons.delete);
                        elHide(article.buttons.restore);
@@ -311,6 +323,10 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Language', 'U
                 */
                _triggerTrash: function(articleId) {
                        var article = _articles.get(articleId);
+                       if (!article) {
+                               // The affected article might be hidden by the filter settings.
+                               return;
+                       }
                        
                        elShow(article.buttons.delete);
                        elShow(article.buttons.restore);
@@ -336,6 +352,10 @@ define(['Ajax', 'Core', 'Dictionary', 'Dom/Util', 'EventHandler', 'Language', 'U
                 */
                _triggerUnpublish: function(articleId) {
                        var article = _articles.get(articleId);
+                       if (!article) {
+                               // The affected article might be hidden by the filter settings.
+                               return;
+                       }
                        
                        if (article.isArticleEdit) {
                                // unsupported