Sha256: f839d81024f28f82f45ca1293d4fc9c68c504fd1c14284438fc4d78524e1ad23

Contents?: true

Size: 851 Bytes

Versions: 4

Compression:

Stored size: 851 Bytes

Contents

module NotificationsHelper
  def decode_notification notification_text, activity
    return if activity.nil?
    notification_text = notification_text.gsub(/\%\{sender\}/, link_to(activity.sender.name, activity.sender.subject))
    notification_text = notification_text.gsub(/\%\{sender.name\}/,activity.sender.name)

    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

4 entries across 4 versions & 1 rubygems

Version Path
social_stream-base-0.6.3 app/helpers/notifications_helper.rb
social_stream-base-0.6.2 app/helpers/notifications_helper.rb
social_stream-base-0.6.1 app/helpers/notifications_helper.rb
social_stream-base-0.6.0 app/helpers/notifications_helper.rb