Export DefaultNotificationItem

Export DefaultNotificationItem

diff --git a/app/assets/javascripts/discourse/widgets/default-notification-item.js.es6 b/app/assets/javascripts/discourse/widgets/default-notification-item.js.es6
index 40a4c3a..78c964b 100644
--- a/app/assets/javascripts/discourse/widgets/default-notification-item.js.es6
+++ b/app/assets/javascripts/discourse/widgets/default-notification-item.js.es6
@@ -13,203 +13,204 @@ import { setTransientHeader } from "discourse/lib/ajax";
 import { userPath } from "discourse/lib/url";
 import { iconNode } from "discourse-common/lib/icon-library";
 
-createWidget("default-notification-item", {
-  tagName: "li",
+export const DefaultNotificationItem =
+  createWidget("default-notification-item", {
+    tagName: "li",
+
+    buildClasses(attrs) {
+      const classNames = [];
+      if (attrs.get("read")) {
+        classNames.push("read");
+      }
+      if (attrs.is_warning) {
+        classNames.push("is-warning");
+      }
+      return classNames;
+    },
 
-  buildClasses(attrs) {
-    const classNames = [];
-    if (attrs.get("read")) {
-      classNames.push("read");
-    }
-    if (attrs.is_warning) {
-      classNames.push("is-warning");
-    }
-    return classNames;
-  },
+    url() {
+      const attrs = this.attrs;
+      const data = attrs.data;
+      const notificationTypes = this.site.notification_types;
 
-  url() {
-    const attrs = this.attrs;
-    const data = attrs.data;
-    const notificationTypes = this.site.notification_types;
+      const badgeId = data.badge_id;
+      if (badgeId) {
+        let badgeSlug = data.badge_slug;
 
-    const badgeId = data.badge_id;
-    if (badgeId) {
-      let badgeSlug = data.badge_slug;
+        if (!badgeSlug) {
+          const badgeName = data.badge_name;
+          badgeSlug = badgeName.replace(/[^A-Za-z0-9_]+/g, "-").toLowerCase();
+        }
 
-      if (!badgeSlug) {
-        const badgeName = data.badge_name;
-        badgeSlug = badgeName.replace(/[^A-Za-z0-9_]+/g, "-").toLowerCase();
+        let username = data.username;
+        username = username ? "?username=" + username.toLowerCase() : "";
+        return Discourse.getURL(
+          "/badges/" + badgeId + "/" + badgeSlug + username
+        );
       }
 
-      let username = data.username;
-      username = username ? "?username=" + username.toLowerCase() : "";
-      return Discourse.getURL(
-        "/badges/" + badgeId + "/" + badgeSlug + username
-      );
-    }
-
-    const topicId = attrs.topic_id;
-
-    if (topicId) {
-      return postUrl(attrs.slug, topicId, attrs.post_number);
-    }
-
-    if (attrs.notification_type === notificationTypes.invitee_accepted) {
-      return userPath(data.display_username);
-    }
+      const topicId = attrs.topic_id;
 
-    if (attrs.notification_type === notificationTypes.liked_consolidated) {
-      return userPath(
-        `${this.attrs.username ||
-          this.currentUser
-            .username}/notifications/likes-received?acting_username=${
-          data.display_username
-        }`
-      );
-    }
+      if (topicId) {
+        return postUrl(attrs.slug, topicId, attrs.post_number);
+      }
 
-    if (data.group_id) {
-      return userPath(data.username + "/messages/group/" + data.group_name);
-    }
-  },
+      if (attrs.notification_type === notificationTypes.invitee_accepted) {
+        return userPath(data.display_username);
+      }
 
-  description() {
-    const data = this.attrs.data;
-    const badgeName = data.badge_name;
-    if (badgeName) {
-      return escapeExpression(badgeName);
-    }
+      if (attrs.notification_type === notificationTypes.liked_consolidated) {
+        return userPath(
+          `${this.attrs.username ||
+            this.currentUser
+              .username}/notifications/likes-received?acting_username=${
+            data.display_username
+          }`
+        );
+      }
 
-    if (this.attrs.fancy_title) {
-      if (this.attrs.topic_id) {
-        return `<span data-topic-id="${this.attrs.topic_id}">${
-          this.attrs.fancy_title
-        }</span>`;
+      if (data.group_id) {
+        return userPath(data.username + "/messages/group/" + data.group_name);
       }
-      return this.attrs.fancy_title;
-    }
+    },
 
-    let title;
+    description() {
+      const data = this.attrs.data;
+      const badgeName = data.badge_name;
+      if (badgeName) {
+        return escapeExpression(badgeName);
+      }
 
-    if (
-      this.attrs.notification_type ===
-      this.site.notification_types.liked_consolidated
-    ) {
-      title = I18n.t("notifications.liked_consolidated_description", {
-        count: parseInt(data.count)
-      });
-    } else {
-      title = data.topic_title;
-    }
+      if (this.attrs.fancy_title) {
+        if (this.attrs.topic_id) {
+          return `<span data-topic-id="${this.attrs.topic_id}">${
+            this.attrs.fancy_title
+          }</span>`;
+        }
+        return this.attrs.fancy_title;
+      }
 
-    return Ember.isEmpty(title) ? "" : escapeExpression(title);
-  },
+      let title;
 
-  text(notificationType, notificationName) {
-    const { attrs } = this;
-    const data = attrs.data;
-    const scope =
-      notificationName === "custom" ? data.message : `notifications.${notificationName}`;
+      if (
+        this.attrs.notification_type ===
+        this.site.notification_types.liked_consolidated
+      ) {
+        title = I18n.t("notifications.liked_consolidated_description", {
+          count: parseInt(data.count)
+        });
+      } else {
+        title = data.topic_title;
+      }
 
-    const notificationTypes = this.site.notification_types;
+      return Ember.isEmpty(title) ? "" : escapeExpression(title);
+    },
 
-    if (notificationType === notificationTypes.group_message_summary) {
-      const count = data.inbox_count;
-      const group_name = data.group_name;
-      return I18n.t(scope, { count, group_name });
-    }
+    text(notificationType, notificationName) {
+      const { attrs } = this;
+      const data = attrs.data;
+      const scope =
+        notificationName === "custom" ? data.message : `notifications.${notificationName}`;
 
-    const username = formatUsername(data.display_username);
-    const description = this.description();
+      const notificationTypes = this.site.notification_types;
 
-    if (notificationType === notificationTypes.liked && data.count > 1) {
-      const count = data.count - 2;
-      const username2 = formatUsername(data.username2);
+      if (notificationType === notificationTypes.group_message_summary) {
+        const count = data.inbox_count;
+        const group_name = data.group_name;
+        return I18n.t(scope, { count, group_name });
+      }
 
-      if (count === 0) {
-        return I18n.t("notifications.liked_2", {
-          description,
-          username,
-          username2
-        });
-      } else {
-        return I18n.t("notifications.liked_many", {
-          description,
-          username,
-          username2,
-          count
-        });
+      const username = formatUsername(data.display_username);
+      const description = this.description();
+
+      if (notificationType === notificationTypes.liked && data.count > 1) {
+        const count = data.count - 2;
+        const username2 = formatUsername(data.username2);
+
+        if (count === 0) {
+          return I18n.t("notifications.liked_2", {
+            description,
+            username,
+            username2
+          });
+        } else {
+          return I18n.t("notifications.liked_many", {
+            description,
+            username,
+            username2,
+            count
+          });
+        }
       }
-    }
 
-    return I18n.t(scope, { description, username });
-  },
+      return I18n.t(scope, { description, username });
+    },
 
-  html(attrs) {
-    const notificationType = attrs.notification_type;
-    const lookup = this.site.get("notificationLookup");
-    const notificationName = lookup[notificationType];

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

GitHub sha: bd062fcb