DEV: Remove no longer needed widgets
This commit is contained in:
parent
12003bfd2a
commit
e714f60559
|
|
@ -1,15 +0,0 @@
|
||||||
import { iconNode } from "discourse-common/lib/icon-library";
|
|
||||||
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
|
|
||||||
import { createWidgetFrom } from "discourse/widgets/widget";
|
|
||||||
|
|
||||||
createWidgetFrom(DefaultNotificationItem, "assigned-notification-item", {
|
|
||||||
icon(notificationName, data) {
|
|
||||||
if (data.message === "discourse_assign.assign_group_notification") {
|
|
||||||
return iconNode(
|
|
||||||
`notification.discourse_assign.assign_group_notification`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return iconNode(`notification.${notificationName}`);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
import RawHtml from "discourse/widgets/raw-html";
|
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
|
||||||
import {
|
|
||||||
createWidget,
|
|
||||||
createWidgetFrom,
|
|
||||||
queryRegistry,
|
|
||||||
} from "discourse/widgets/widget";
|
|
||||||
import getURL from "discourse-common/lib/get-url";
|
|
||||||
import { postUrl } from "discourse/lib/utilities";
|
|
||||||
import { h } from "virtual-dom";
|
|
||||||
import I18n from "I18n";
|
|
||||||
import { htmlSafe } from "@ember/template";
|
|
||||||
|
|
||||||
const ICON = "user-plus";
|
|
||||||
const GROUP_ICON = "group-plus";
|
|
||||||
|
|
||||||
createWidget("no-quick-access-assignments", {
|
|
||||||
html() {
|
|
||||||
return h("div.empty-state", [
|
|
||||||
h("span.empty-state-title", I18n.t("user.no_assignments_title")),
|
|
||||||
h(
|
|
||||||
"div.empty-state-body",
|
|
||||||
new RawHtml({
|
|
||||||
html:
|
|
||||||
"<p>" +
|
|
||||||
htmlSafe(
|
|
||||||
I18n.t("user.no_assignments_body", {
|
|
||||||
preferencesUrl: getURL("/my/preferences/notifications"),
|
|
||||||
icon: iconHTML(ICON),
|
|
||||||
})
|
|
||||||
) +
|
|
||||||
"</p>",
|
|
||||||
})
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const QuickAccessPanel = queryRegistry("quick-access-panel");
|
|
||||||
|
|
||||||
if (QuickAccessPanel) {
|
|
||||||
createWidgetFrom(QuickAccessPanel, "quick-access-assignments", {
|
|
||||||
buildKey: () => "quick-access-assignments",
|
|
||||||
emptyStateWidget: "no-quick-access-assignments",
|
|
||||||
|
|
||||||
showAllHref() {
|
|
||||||
return `${this.attrs.path}/activity/assigned`;
|
|
||||||
},
|
|
||||||
|
|
||||||
findNewItems() {
|
|
||||||
return this.store
|
|
||||||
.findFiltered("topicList", {
|
|
||||||
filter: `topics/messages-assigned/${this.currentUser.username_lower}`,
|
|
||||||
params: {
|
|
||||||
exclude_category_ids: [-1],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(({ topic_list }) => {
|
|
||||||
return topic_list.topics;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
itemHtml(assignedTopic) {
|
|
||||||
return this.attach("quick-access-item", {
|
|
||||||
icon: assignedTopic.assigned_to_group ? GROUP_ICON : ICON,
|
|
||||||
href: postUrl(
|
|
||||||
assignedTopic.slug,
|
|
||||||
assignedTopic.id,
|
|
||||||
assignedTopic.last_read_post_number + 1
|
|
||||||
),
|
|
||||||
escapedContent: assignedTopic.fancy_title,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue