Adding GNU Public license, adding home timeline, reblog/favourite counters
This commit is contained in:
parent
831a187d74
commit
3824c58853
20 changed files with 429 additions and 37 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue