diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/stream_entries_helper.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index 529ba98da..d6a14352f 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -4,7 +4,7 @@ module StreamEntriesHelper end def avatar_for_status_url(status) - status.reblog? ? status.reblog.account.avatar.url(:small) : status.account.avatar.url(:small) + status.reblog? ? status.reblog.account.avatar.url(:medium) : status.account.avatar.url(:medium) end def entry_classes(status, is_predecessor, is_successor, include_threads) @@ -24,12 +24,17 @@ module StreamEntriesHelper mention_hash = {} status.mentions.each { |m| mention_hash[m.acct] = m } - status.text.gsub(Account::MENTION_RE) do |m| - full_match = Account::MENTION_RE.match(m) - acct = full_match[1] - account = mention_hash[acct] - - "#{m.split('@').first}<a href=\"#{account.url}\" class=\"mention\">@<span>#{acct}</span></a>" + auto_link(CGI.escapeHTML(status.text), link: :urls, html: { target: '_blank', rel: 'nofollow' }).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? && (status.reblog? ? status.reblog : status).reblogs.where(account: current_user.account).count == 1 ? 'reblogged' : '' + end + + def favourited_by_me_class(status) + user_signed_in? && (status.reblog? ? status.reblog : status).favourites.where(account: current_user.account).count == 1 ? 'favourited' : '' + end end |