Sha256: a19ee64588696195e9829e22e18be133f96f50da4a53c09c7f8d952a1346ad0e

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

module NotificationsHelper
  def decode_notification notification_text, activity
    if activity.tie.present?
      notification_text = notification_text.gsub(/\%\{sender\}/,link_to(activity.tie.sender.name,activity.tie.sender.subject))
      notification_text = notification_text.gsub(/\%\{sender.name\}/,activity.tie.sender.name)
    elsif activity._tie.present?
      notification_text = notification_text.gsub(/\%\{sender\}/,link_to(activity._tie.sender.name,activity._tie.sender.subject))
      notification_text = notification_text.gsub(/\%\{sender.name\}/,activity._tie.sender.name)
    end

      if activity.direct_object.present?
        object = activity.direct_object
        object = object.subject if object.is_a? Actor
        notification_text=notification_text.gsub(/\%\{object\}/,link_to(object.class.to_s.downcase,object))
        notification_text=notification_text.gsub(/\%\{object.name\}/,object.class.to_s.downcase)
      else
        notification_text=notification_text.gsub(/\%\{object\}/,"nilclass")
        notification_text=notification_text.gsub(/\%\{object.name\}/,"nilclass")
      end

    notification_text
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
social_stream-base-0.5.2 app/helpers/notifications_helper.rb
social_stream-base-0.5.1 app/helpers/notifications_helper.rb
social_stream-base-0.5.0 app/helpers/notifications_helper.rb
social_stream-0.4.6 app/helpers/notifications_helper.rb
social_stream-0.4.5 app/helpers/notifications_helper.rb