From 9b58cb7b424a7f1c50f1376c6d04f445f1c191c3 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 20 Feb 2020 17:43:33 -0600 Subject: [PATCH] mode menu: remove approve option. Remove the approve option from the post mode menu. Mass approving posts is rarely needed. The javascript was also buggy (it didn't update the data attributes correctly when undeleting a post). The replacement for this feature is to use a tagscript with the status:active tag. --- .../src/javascripts/post_mode_menu.js | 2 -- app/javascript/src/javascripts/posts.js.erb | 17 ----------------- app/javascript/src/styles/base/040_colors.css | 2 -- .../src/styles/specific/post_mode_menu.scss | 4 ---- 4 files changed, 25 deletions(-) diff --git a/app/javascript/src/javascripts/post_mode_menu.js b/app/javascript/src/javascripts/post_mode_menu.js index ae8812d5c..83e0ff6f8 100644 --- a/app/javascript/src/javascripts/post_mode_menu.js +++ b/app/javascript/src/javascripts/post_mode_menu.js @@ -164,8 +164,6 @@ PostModeMenu.click = function(e) { Post.tag(post_id, "downvote:me"); } else if (s === 'vote-up') { Post.tag(post_id, "upvote:me"); - } else if (s === 'approve') { - Post.approve(post_id); } else if (s === "tag-script") { var current_script_id = localStorage.getItem("current_tag_script_id"); var tag_script = localStorage.getItem("tag-script-" + current_script_id); diff --git a/app/javascript/src/javascripts/posts.js.erb b/app/javascript/src/javascripts/posts.js.erb index ff1aa48e0..d07f5e4dc 100644 --- a/app/javascript/src/javascripts/posts.js.erb +++ b/app/javascript/src/javascripts/posts.js.erb @@ -521,23 +521,6 @@ Post.update = function(post_id, params) { }); } -Post.approve = function(post_id) { - $.post( - "/post_approvals.json", - {"post_id": post_id} - ).fail(function(data) { - var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join("; "); - Utility.error("Error: " + message); - }).done(function(data) { - var $post = $("#post_" + post_id); - if ($post.length) { - $post.data("flags", $post.data("flags").replace(/pending/, "")); - $post.removeClass("post-status-pending"); - Utility.notice("Approved post #" + post_id); - } - }); -} - Post.initialize_saved_searches = function() { $("#save-search-dialog").dialog({ width: 700, diff --git a/app/javascript/src/styles/base/040_colors.css b/app/javascript/src/styles/base/040_colors.css index e1728dac7..fd7c08a96 100644 --- a/app/javascript/src/styles/base/040_colors.css +++ b/app/javascript/src/styles/base/040_colors.css @@ -136,7 +136,6 @@ --post-mode-menu-remove-fav-background: #FFA; --post-mode-menu-vote-up-background: #AFA; --post-mode-menu-vote-down-background: #FAA; - --post-mode-menu-approve-background: #48C; --post-mode-menu-translation-background: #5CD; --tag-count-color: var(--muted-text-color); @@ -379,7 +378,6 @@ body[data-current-user-theme="dark"] { --post-mode-menu-remove-fav-background: var(--yellow-0); --post-mode-menu-vote-up-background: var(--red-0); --post-mode-menu-vote-down-background: var(--red-0); - --post-mode-menu-approve-background: var(--aqua-0); --post-mode-menu-translation-background: var(--blue-0); --post-notice-border: 1px solid var(--grey-3); diff --git a/app/javascript/src/styles/specific/post_mode_menu.scss b/app/javascript/src/styles/specific/post_mode_menu.scss index d3b37ca7a..4b63d2a53 100644 --- a/app/javascript/src/styles/specific/post_mode_menu.scss +++ b/app/javascript/src/styles/specific/post_mode_menu.scss @@ -22,10 +22,6 @@ body.mode-vote-down { background-color: var(--post-mode-menu-vote-down-background); } -body.mode-approve { - background-color: var(--post-mode-menu-approve-background); -} - body.mode-translation { background-color: var(--post-mode-menu-translation-background); }