diff --git a/assets/javascripts/discourse/initializers/assign-sidebar.js b/assets/javascripts/discourse/initializers/assign-sidebar.js deleted file mode 100644 index 49543a3..0000000 --- a/assets/javascripts/discourse/initializers/assign-sidebar.js +++ /dev/null @@ -1,41 +0,0 @@ -import { withPluginApi } from "discourse/lib/plugin-api"; -import I18n from "I18n"; - -export default { - name: "assign-sidebar", - - initialize(container) { - withPluginApi("1.2.0", (api) => { - const currentUser = container.lookup("current-user:main"); - - if ( - currentUser?.experimental_sidebar_enabled && - currentUser?.can_assign - ) { - api.addTopicsSectionLink((baseSectionLink) => { - return class AssignedSectionLink extends baseSectionLink { - get name() { - return "assigned"; - } - - get route() { - return "userActivity.assigned"; - } - - get model() { - return this.currentUser; - } - - get title() { - return I18n.t("sidebar.assigned_link_title"); - } - - get text() { - return I18n.t("sidebar.assigned_link_text"); - } - }; - }); - } - }); - }, -}; diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index c4372c4..e3cdd88 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -135,6 +135,3 @@ en: assigned: "%{username} assigned you" titles: assigned: "Assigned" - sidebar: - assigned_link_title: "Topics assigned to you" - assigned_link_text: "Assigned" diff --git a/test/javascripts/acceptance/assign-sidebar-test.js b/test/javascripts/acceptance/assign-sidebar-test.js deleted file mode 100644 index 38fa9c8..0000000 --- a/test/javascripts/acceptance/assign-sidebar-test.js +++ /dev/null @@ -1,60 +0,0 @@ -import I18n from "I18n"; -import { click, currentURL, visit } from "@ember/test-helpers"; -import { test } from "qunit"; -import { - acceptance, - exists, - query, -} from "discourse/tests/helpers/qunit-helpers"; -import AssignedTopics from "../fixtures/assigned-topics-fixtures"; -import { cloneJSON } from "discourse-common/lib/object"; - -acceptance( - "Discourse Assign | Sidebar when user cannot assign", - function (needs) { - needs.user({ experimental_sidebar_enabled: true, can_assign: false }); - - test("assign sidebar link is hidden", async function (assert) { - await visit("/"); - - assert.ok( - !exists(".sidebar-section-link-assigned"), - "it does not display the assign link in sidebar" - ); - }); - } -); - -acceptance("Discourse Assign | Sidebar when user can assign", function (needs) { - needs.user({ experimental_sidebar_enabled: true, can_assign: true }); - - needs.pretender((server, helper) => { - const messagesPath = "/topics/messages-assigned/eviltrout.json"; - const assigns = AssignedTopics[messagesPath]; - server.get(messagesPath, () => helper.response(cloneJSON(assigns))); - }); - - test("clicking on assign link", async function (assert) { - await visit("/"); - - assert.strictEqual( - query(".sidebar-section-link-assigned").textContent.trim(), - I18n.t("sidebar.assigned_link_text"), - "displays the right text for the link" - ); - - assert.strictEqual( - query(".sidebar-section-link-assigned").title, - I18n.t("sidebar.assigned_link_title"), - "displays the right title for the link" - ); - - await click(".sidebar-section-link-assigned"); - - assert.strictEqual( - currentURL(), - "/u/eviltrout/activity/assigned", - "it navigates to the right page" - ); - }); -});