about summary refs log tree commit diff
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-09 20:04:34 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-09 20:04:34 +0200
commit3cc47beb6e1f646baca64fdf56168e2f2e2bc726 (patch)
tree295d9442bec8fa7434b6a2c37a6cb835a3725dfd /app/helpers/application_helper.rb
parent735b4cc62e3fb9ef7a10b657c8e437ac0cb3d1fe (diff)
Refactored generation of unique tags, URIs and object URLs into own classes,
as well as formatting of content
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb50
1 files changed, 0 insertions, 50 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e43875544..5ed8499aa 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,54 +1,4 @@
 module ApplicationHelper
-  def unique_tag(date, id, type)
-    "tag:#{Rails.configuration.x.local_domain},#{date.strftime('%Y-%m-%d')}:objectId=#{id}:objectType=#{type}"
-  end
-
-  def unique_tag_to_local_id(tag, expected_type)
-    matches = Regexp.new("objectId=([\\d]+):objectType=#{expected_type}").match(tag)
-    return matches[1] unless matches.nil?
-  end
-
-  def local_id?(id)
-    id.start_with?("tag:#{Rails.configuration.x.local_domain}")
-  end
-
-  def content_for_status(actual_status)
-    if actual_status.local?
-      linkify(actual_status)
-    else
-      sanitize(actual_status.content, tags: %w(a br p), attributes: %w(href rel))
-    end
-  end
-
-  def account_from_mentions(search_string, mentions)
-    mentions.each { |x| return x.account if x.account.acct.eql?(search_string) }
-    nil
-
-    # If that was unsuccessful, try fetching user from db separately
-    # But this shouldn't ever happen if the mentions were created correctly!
-    # username, domain = search_string.split('@')
-
-    # if domain == Rails.configuration.x.local_domain
-    #   account = Account.find_local(username)
-    # else
-    #   account = Account.find_remote(username, domain)
-    # end
-
-    # account
-  end
-
-  def linkify(status)
-    auto_link(HTMLEntities.new.encode(status.text), link: :urls, html: { rel: 'nofollow noopener' }).gsub(Account::MENTION_RE) do |m|
-      account = account_from_mentions(Account::MENTION_RE.match(m)[1], status.mentions)
-
-      unless account.nil?
-        "#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>"
-      else
-        m
-      end
-    end.html_safe
-  end
-
   def active_nav_class(path)
     current_page?(path) ? 'active' : ''
   end