DEV: Drop deprecated review queue code (#43)

DEV: Drop deprecated review queue code (#43)

diff --git a/assets/javascripts/admin/models/akismet-queue.js.es6 b/assets/javascripts/admin/models/akismet-queue.js.es6
deleted file mode 100644
index 24fe67c..0000000
--- a/assets/javascripts/admin/models/akismet-queue.js.es6
+++ /dev/null
@@ -1,47 +0,0 @@
-import { ajax } from "discourse/lib/ajax";
-
-export default {
-  confirmSpam(post) {
-    return ajax("/admin/plugins/akismet/confirm_spam", {
-      type: "POST",
-      data: {
-        post_id: post.get("id")
-      }
-    });
-  },
-
-  allow(post) {
-    return ajax("/admin/plugins/akismet/allow", {
-      type: "POST",
-      data: {
-        post_id: post.get("id")
-      }
-    });
-  },
-
-  dismiss(post) {
-    return ajax("/admin/plugins/akismet/dismiss", {
-      type: "POST",
-      data: {
-        post_id: post.get("id")
-      }
-    });
-  },
-
-  deleteUser(post) {
-    return ajax("/admin/plugins/akismet/delete_user", {
-      type: "DELETE",
-      data: {
-        user_id: post.get("user_id"),
-        post_id: post.get("id")
-      }
-    });
-  },
-
-  findAll() {
-    return ajax("/admin/plugins/akismet/index.json").then(result => {
-      result.posts = result.posts.map(p => Discourse.Post.create(p));
-      return result;
-    });
-  }
-};
diff --git a/assets/javascripts/discourse/akismet-route-map.js.es6 b/assets/javascripts/discourse/akismet-route-map.js.es6
deleted file mode 100644
index 2175150..0000000
--- a/assets/javascripts/discourse/akismet-route-map.js.es6
+++ /dev/null
@@ -1,7 +0,0 @@
-export default {
-  resource: "admin.adminPlugins",
-  path: "/plugins",
-  map() {
-    this.route("akismet");
-  }
-};
diff --git a/assets/javascripts/discourse/controllers/admin-plugins-akismet.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-akismet.js.es6
deleted file mode 100644
index b4f9ba2..0000000
--- a/assets/javascripts/discourse/controllers/admin-plugins-akismet.js.es6
+++ /dev/null
@@ -1,88 +0,0 @@
-import AkismetQueue from "discourse/plugins/discourse-akismet/admin/models/akismet-queue";
-
-function genericError() {
-  bootbox.alert(I18n.t("generic_error"));
-}
-
-export default Ember.Controller.extend({
-  sortedPosts: Ember.computed.sort("model", "postSorting"),
-  postSorting: ["id:asc"],
-  enabled: false,
-  performingAction: false,
-
-  actions: {
-    refresh() {
-      this.set("performingAction", true);
-      AkismetQueue.findAll()
-        .then(result => {
-          this.set("stats", result.stats);
-          this.set("model", result.posts);
-        })
-        .catch(genericError)
-        .finally(() => {
-          this.set("performingAction", false);
-        });
-    },
-
-    confirmSpamPost(post) {
-      this.set("performingAction", true);
-      AkismetQueue.confirmSpam(post)
-        .then(() => {
-          this.get("model").removeObject(post);
-          this.incrementProperty("stats.confirmed_spam");
-          this.decrementProperty("stats.needs_review");
-        })
-        .catch(genericError)
-        .finally(() => {
-          this.set("performingAction", false);
-        });
-    },
-
-    allowPost(post) {
-      this.set("performingAction", true);
-      AkismetQueue.allow(post)
-        .then(() => {
-          this.incrementProperty("stats.confirmed_ham");
-          this.decrementProperty("stats.needs_review");
-          this.get("model").removeObject(post);
-        })
-        .catch(genericError)
-        .finally(() => {
-          this.set("performingAction", false);
-        });
-    },
-
-    deleteUser(post) {
-      bootbox.confirm(
-        I18n.t("akismet.delete_prompt", { username: post.get("username") }),
-        result => {
-          if (result === true) {
-            this.set("performingAction", true);
-            AkismetQueue.deleteUser(post)
-              .then(() => {
-                this.get("model").removeObject(post);
-                this.incrementProperty("stats.confirmed_spam");
-                this.decrementProperty("stats.needs_review");
-              })
-              .catch(genericError)
-              .finally(() => {
-                this.set("performingAction", false);
-              });
-          }
-        }
-      );
-    },
-
-    dismiss(post) {
-      this.set("performingAction", true);
-      AkismetQueue.dismiss(post)
-        .then(() => {
-          this.get("model").removeObject(post);
-        })
-        .catch(genericError)
-        .finally(() => {
-          this.set("performingAction", false);
-        });
-    }
-  }
-});
diff --git a/assets/javascripts/discourse/initializers/add-akismet-count.js.es6 b/assets/javascripts/discourse/initializers/add-akismet-count.js.es6
deleted file mode 100644
index 23b7226..0000000
--- a/assets/javascripts/discourse/initializers/add-akismet-count.js.es6
+++ /dev/null
@@ -1,40 +0,0 @@
-import { withPluginApi } from "discourse/lib/plugin-api";
-
-function attachAkismetReviewCount(api) {
-  api.addFlagProperty("currentUser.akismet_review_count");
-  api.decorateWidget("hamburger-menu:admin-links", dec => {
-    return dec.attach("link", {
-      route: "adminPlugins.akismet",
-      label: "akismet.title",
-      badgeCount: "akismet_review_count",
-      badgeClass: "flagged-posts"
-    });
-  });
-}
-
-function subscribeToReviewCount(messageBus, user) {
-  messageBus.subscribe("/akismet_counts", function(result) {
-    if (result) {
-      user.set("akismet_review_count", result.akismet_review_count || 0);
-    }
-  });
-}
-
-export default {
-  name: "add-akismet-count",
-  before: "register-discourse-location",
-  after: "inject-objects",
-
-  initialize(container) {
-    const site = container.lookup("site:main");
-    if (!site.get("reviewable_api_enabled")) {
-      const user = container.lookup("current-user:main");
-      if (user && user.get("staff")) {
-        withPluginApi("0.4", attachAkismetReviewCount);
-
-        const messageBus = container.lookup("message-bus:main");
-        subscribeToReviewCount(messageBus, user);
-      }
-    }
-  }
-};
diff --git a/assets/javascripts/discourse/routes/admin-plugins-akismet.js.es6 b/assets/javascripts/discourse/routes/admin-plugins-akismet.js.es6
deleted file mode 100644
index ca6aac9..0000000
--- a/assets/javascripts/discourse/routes/admin-plugins-akismet.js.es6
+++ /dev/null
@@ -1,23 +0,0 @@
-import AkismetQueue from "discourse/plugins/discourse-akismet/admin/models/akismet-queue";
-
-export default Discourse.Route.extend({
-  _enabled: false,
-  _stats: null,
-
-  model() {
-    var self = this;
-    return AkismetQueue.findAll().then(function(result) {
-      self._enabled = result.enabled;
-      self._stats = result.stats;
-      return result.posts;
-    });
-  },
-
-  setupController(controller, model) {
-    controller.setProperties({
-      model: model,
-      enabled: this._enabled,
-      stats: this._stats
-    });
-  }
-});
diff --git a/assets/javascripts/discourse/templates/admin/plugins-akismet.hbs b/assets/javascripts/discourse/templates/admin/plugins-akismet.hbs
deleted file mode 100644
index 24dc4e0..0000000
--- a/assets/javascripts/discourse/templates/admin/plugins-akismet.hbs
+++ /dev/null
@@ -1,82 +0,0 @@
-{{#if enabled}}
-  {{#if stats}}
-    <table class='tbl spam-stats'>
-      <tr>
-        <th>{{i18n "akismet.stats.scanned"}}</th>
-        <th>{{i18n "akismet.stats.needs_review"}}</th>
-        <th>{{i18n "akismet.stats.confirmed_spam"}}</th>
-        <th>{{i18n "akismet.stats.confirmed_ham"}}</th>
-      </tr>
-      <tr>
-        <td>{{stats.scanned}}</td>
-        <td>{{stats.needs_review}}</td>
-        <td>{{stats.confirmed_spam}}</td>
-        <td>{{stats.confirmed_ham}}</td>
-      </tr>
-    </table>
-  {{/if}}
-
-  {{#if currentUser.admin}}
-    {{d-button label="admin.plugins.change_settings" icon="cog" class='settings-button' action=(route-action "showSettings")}}
-  {{/if}}
-
-  {{d-button action=(action "refresh") icon="refresh" class="btn-primary" label="akismet.refresh" disabled=performingAction}}
-
-  {{#if model.length}}

[... diff too long, it was truncated ...]

GitHub sha: 427335cc

1 Like