diaspora/lib/publisher.rb
Florian Staudacher 4ee5d5f19c replace mentions of out-of-aspect people in limited posts with just a
markdown link to their profile (fixes #2516)

add failing spec for #4160 / #2516

extend the spec a bit more

refactor mention handling in a status message

add method for filtering mentions by aspects

wire mention filtering into the status message model, adapt a few tests to
work properly

cosmetic changes

shorten helper methods

add changelog entry
2013-06-09 19:16:40 +02:00

35 lines
635 B
Ruby

class Publisher
attr_accessor :user, :open, :prefill, :public, :explain
def initialize(user, opts={})
self.user = user
self.open = opts[:open]
self.prefill = opts[:prefill]
self.public = opts[:public]
self.explain = opts[:explain]
end
def text
formatted_message
end
def open?
self.open
end
def public?
self.public
end
def explain?
self.explain
end
private
def formatted_message
if self.prefill.present?
sm = StatusMessage.new(:text => self.prefill)
Diaspora::Mentionable.format(sm.raw_message, sm.mentioned_people, plain_text: true)
end
end
end