From 37dfb1b4b5a6baca8db2fe101b9cd7047acda290 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 15 Jun 2015 14:18:03 +1000 Subject: [PATCH] FEATURE: support for custom notification types used by solved plugin --- .../discourse/components/notification-item.js.es6 | 10 +++++++++- app/models/notification.rb | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/components/notification-item.js.es6 b/app/assets/javascripts/discourse/components/notification-item.js.es6 index 0b4e3695e5..a13cd0d5d6 100644 --- a/app/assets/javascripts/discourse/components/notification-item.js.es6 +++ b/app/assets/javascripts/discourse/components/notification-item.js.es6 @@ -5,7 +5,15 @@ export default Ember.Component.extend({ classNameBindings: ['notification.read', 'notification.is_warning'], scope: function() { - return "notifications." + this.site.get("notificationLookup")[this.get("notification.notification_type")]; + var notificationType = this.get("notification.notification_type"); + var lookup = this.site.get("notificationLookup"); + var name = lookup[notificationType]; + + if (name === "custom") { + return this.get("notification.data.message"); + } else { + return "notifications." + name; + } }.property("notification.notification_type"), url: function() { diff --git a/app/models/notification.rb b/app/models/notification.rb index 3c0565907f..884ddaff82 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -31,7 +31,7 @@ class Notification < ActiveRecord::Base @types ||= Enum.new( :mentioned, :replied, :quoted, :edited, :liked, :private_message, :invited_to_private_message, :invitee_accepted, :posted, :moved_post, - :linked, :granted_badge, :invited_to_topic + :linked, :granted_badge, :invited_to_topic, :custom ) end