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
35 lines
635 B
Ruby
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
|