This reverts commit 959525b079
.
Product design to drop from Sidebar
This commit is contained in:
parent
0adea550c0
commit
148b4b0089
|
@ -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");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -135,6 +135,3 @@ en:
|
||||||
assigned: "%{username} assigned you"
|
assigned: "%{username} assigned you"
|
||||||
titles:
|
titles:
|
||||||
assigned: "Assigned"
|
assigned: "Assigned"
|
||||||
sidebar:
|
|
||||||
assigned_link_title: "Topics assigned to you"
|
|
||||||
assigned_link_text: "Assigned"
|
|
||||||
|
|
|
@ -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"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue