Pull invitee accepted notification behaviour into its own class

This commit is contained in:
Daniel Waterworth 2019-06-07 09:53:04 +01:00 committed by Robin Ward
parent 7c52ba1431
commit a3254b8446
2 changed files with 13 additions and 5 deletions

View File

@ -31,7 +31,6 @@ export const DefaultNotificationItem =
url() {
const attrs = this.attrs;
const data = attrs.data;
const notificationTypes = this.site.notification_types;
const badgeId = data.badge_id;
if (badgeId) {
@ -55,10 +54,6 @@ export const DefaultNotificationItem =
return postUrl(attrs.slug, topicId, attrs.post_number);
}
if (attrs.notification_type === notificationTypes.invitee_accepted) {
return userPath(data.display_username);
}
if (data.group_id) {
return userPath(data.username + "/messages/group/" + data.group_name);
}

View File

@ -0,0 +1,13 @@
import { createWidgetFrom } from "discourse/widgets/widget";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { postUrl } from "discourse/lib/utilities";
import { userPath } from "discourse/lib/url";
createWidgetFrom(DefaultNotificationItem, "invitee-accepted-notification-item", {
url() {
const attrs = this.attrs;
const data = attrs.data;
return userPath(data.display_username);
},
});