From d8f2e73ea25febb6c6a58f1d779e5666829af255 Mon Sep 17 00:00:00 2001 From: Steven Fuchs Date: Mon, 23 Jan 2012 12:05:43 -0500 Subject: [PATCH] refer to model for target value, not set attributes. --- app/models/notification.rb | 4 ++++ app/views/notifications/index.html.haml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/notification.rb b/app/models/notification.rb index e474556ed..d01313b8d 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -45,6 +45,10 @@ class Notification < ActiveRecord::Base raise NotImplementedError.new('Subclass this.') end + def effective_target + self.popup_translation_key == "notifications.mentioned" ? self.target.post : self.target + end + private def self.concatenate_or_create(recipient, target, actor, notification_type) return nil if suppress_notification?(recipient, target) diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index a4b4f3a26..b95b386a8 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -18,9 +18,9 @@ .span-8.notifications_for_day - notes.each do |note| .stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : 'read'}"} - - if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note[:target]) + - if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note.effective_target) .right - = aspect_membership_dropdown(contact, note[:target], 'left') + = aspect_membership_dropdown(contact, note.effective_target, 'left') %span.from = notification_message_for(note)