Refactored generation of unique tags, URIs and object URLs into own classes,
as well as formatting of content
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
.account-grid-card__header
|
||||
.avatar= image_tag account.avatar.url(:medium)
|
||||
.name
|
||||
= link_to url_for_target(account) do
|
||||
= link_to TagManager.instance.url_for(account) do
|
||||
%span.display_name= display_name(account)
|
||||
%span.username= "@#{account.acct}"
|
||||
%p.note= truncate(strip_tags(account.note), length: 150)
|
||||
|
@ -10,7 +10,7 @@ Nokogiri::XML::Builder.new do |xml|
|
||||
include_author xml, @account
|
||||
end
|
||||
|
||||
link_alternate xml, url_for_target(@account)
|
||||
link_alternate xml, TagManager.instance.url_for(@account)
|
||||
link_self xml, account_url(@account, format: 'atom')
|
||||
link_hub xml, Rails.configuration.x.hub_url
|
||||
link_salmon xml, api_salmon_url(@account.id)
|
||||
|
@ -2,7 +2,7 @@ object @account
|
||||
|
||||
attributes :id, :username, :acct, :display_name, :note
|
||||
|
||||
node(:url) { |account| url_for_target(account) }
|
||||
node(:url) { |account| TagManager.instance.url_for(account) }
|
||||
node(:avatar) { |account| full_asset_url(account.avatar.url(:large, false)) }
|
||||
node(:followers_count) { |account| account.followers.count }
|
||||
node(:following_count) { |account| account.following.count }
|
||||
|
@ -1,9 +1,9 @@
|
||||
object @status
|
||||
attributes :id, :created_at, :in_reply_to_id
|
||||
|
||||
node(:uri) { |status| uri_for_target(status) }
|
||||
node(:content) { |status| content_for_status(status) }
|
||||
node(:url) { |status| url_for_target(status) }
|
||||
node(:uri) { |status| TagManager.instance.uri_for(status) }
|
||||
node(:content) { |status| Formatter.instance.format(status) }
|
||||
node(:url) { |status| TagManager.instance.url_for(status) }
|
||||
node(:reblogs_count) { |status| status.reblogs_count }
|
||||
node(:favourites_count) { |status| status.favourites_count }
|
||||
node(:favourited) { |status| current_account.favourited?(status) }
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
<%= @account.acct %> is now following you!
|
||||
|
||||
<%= url_for_target(@account) %>
|
||||
<%= TagManager.instance.url_for(@account) %>
|
||||
|
@ -4,4 +4,4 @@ You were mentioned by <%= @status.account.acct %> in:
|
||||
|
||||
<%= strip_tags(@status.content) %>
|
||||
|
||||
<%= url_for_target(@status) %>
|
||||
<%= TagManager.instance.url_for(@status) %>
|
||||
|
@ -2,4 +2,4 @@
|
||||
.content
|
||||
%strong= link_to follow.account.acct, account_path(follow.account)
|
||||
is now following
|
||||
%strong= link_to follow.target_account.acct, url_for_target(follow.target_account)
|
||||
%strong= link_to follow.target_account.acct, TagManager.instance.url_for(follow.target_account)
|
||||
|
@ -12,7 +12,7 @@
|
||||
.pre-header
|
||||
%i.fa.fa-retweet
|
||||
Shared by
|
||||
= link_to display_name(status.account), url_for_target(status.account), class: 'name'
|
||||
= link_to display_name(status.account), TagManager.instance.url_for(status.account), class: 'name'
|
||||
|
||||
.entry__container
|
||||
.avatar
|
||||
@ -21,10 +21,10 @@
|
||||
.entry__container__container
|
||||
.header
|
||||
.header__left
|
||||
= link_to url_for_target(proper_status(status).account), class: 'name' do
|
||||
= link_to TagManager.instance.url_for(proper_status(status).account), class: 'name' do
|
||||
%strong= display_name(proper_status(status).account)
|
||||
= "@#{proper_status(status).account.acct}"
|
||||
= link_to url_for_target(proper_status(status)), class: 'time' do
|
||||
= link_to TagManager.instance.url_for(proper_status(status)), class: 'time' do
|
||||
%span{ title: proper_status(status).created_at }
|
||||
= relative_time(proper_status(status).created_at)
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
%i.fa.fa-star
|
||||
%span.counter-number= proper_status(status).favourites_count
|
||||
|
||||
.content= content_for_status(proper_status(status))
|
||||
.content= Formatter.instance.format(proper_status(status))
|
||||
|
||||
%ul.media-attachments
|
||||
- status.media_attachments.each do |media|
|
||||
|
@ -1,8 +1,8 @@
|
||||
Nokogiri::XML::Builder.new do |xml|
|
||||
xml.XRD(xmlns: 'http://docs.oasis-open.org/ns/xri/xrd-1.0') do
|
||||
xml.Subject @canonical_account_uri
|
||||
xml.Alias url_for_target(@account)
|
||||
xml.Link(rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: url_for_target(@account))
|
||||
xml.Alias TagManager.instance.url_for(@account)
|
||||
xml.Link(rel: 'http://webfinger.net/rel/profile-page', type: 'text/html', href: TagManager.instance.url_for(@account))
|
||||
xml.Link(rel: 'http://schemas.google.com/g/2010#updates-from', type: 'application/atom+xml', href: account_url(@account, format: 'atom'))
|
||||
xml.Link(rel: 'salmon', href: api_salmon_url(@account.id))
|
||||
xml.Link(rel: 'magic-public-key', href: @magic_key)
|
||||
|
Reference in New Issue
Block a user