id.start_with?("tag:#{Rails.configuration.x.local_domain}")
end
+ def linkify(status)
+ mention_hash = {}
+ status.mentions.each { |m| mention_hash[m.acct] = m }
+ coder = HTMLEntities.new
+
+ auto_link(coder.encode(status.text), link: :urls, html: { rel: 'nofollow noopener' }).gsub(Account::MENTION_RE) do |m|
+ account = mention_hash[Account::MENTION_RE.match(m)[1]]
+ return "#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>"
+ end.html_safe
+ end
+
def active_nav_class(path)
current_page?(path) ? 'active' : ''
end
xml.logo url
end
+ def conditionally_formatted(activity)
+ if activity.is_a?(Status)
+ if activity.reblog? && activity.reblog.local?
+ linkify(activity.reblog)
+ elsif activity.local?
+ linkify(activity)
+ else
+ activity.content
+ end
+ elsif activity.nil?
+ ''
+ else
+ activity.content
+ end
+ end
+
def include_author(xml, account)
object_type xml, :person
uri xml, url_for_target(account)
published_at xml, stream_entry.created_at
updated_at xml, stream_entry.updated_at
title xml, stream_entry.title
- content xml, stream_entry.content
+ content xml, conditionally_formatted(stream_entry.activity)
verb xml, stream_entry.verb
link_self xml, account_stream_entry_url(stream_entry.account, stream_entry, format: 'atom')
object_type xml, stream_entry.object_type
# Statuses have content
if [:note, :comment].include? stream_entry.target.object_type
- content xml, stream_entry.target.content
+ content xml, conditionally_formatted(stream_entry.target)
end
end
end
date < 5.days.ago ? date.strftime("%d.%m.%Y") : "#{time_ago_in_words(date)} ago"
end
- def linkify(status)
- mention_hash = {}
- status.mentions.each { |m| mention_hash[m.acct] = m }
- coder = HTMLEntities.new
-
- auto_link(coder.encode(status.text), link: :urls, html: { rel: 'nofollow noopener' }).gsub(Account::MENTION_RE) do |m|
- account = mention_hash[Account::MENTION_RE.match(m)[1]]
- "#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>"
- end.html_safe
- end
-
def reblogged_by_me_class(status)
user_signed_in? && current_user.account.reblogged?(status) ? 'reblogged' : ''
end