about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorDavid Underwood <davefp@gmail.com>2018-04-01 17:55:42 -0400
committerEugen Rochko <eugen@zeonfederated.com>2018-04-01 23:55:42 +0200
commit123a343d116d3e83cbd04460cc7bd0b6f3d208c4 (patch)
tree7d834be5438d835fe90744e0ba011f585cf252b1 /app/models
parentf464f98fd3b8ef33b3afa5acf09e829c046134de (diff)
[WIP] Enable custom emoji on account pages and in the sidebar (#6124)
Federate custom emojis with accounts
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb4
-rw-r--r--app/models/remote_profile.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 25e7d7436..a34b6a2d3 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -350,6 +350,10 @@ class Account < ApplicationRecord
     end
   end
 
+  def emojis
+    CustomEmoji.from_text(note, domain)
+  end
+
   before_create :generate_keys
   before_validation :normalize_domain
   before_validation :prepare_contents, if: :local?
diff --git a/app/models/remote_profile.rb b/app/models/remote_profile.rb
index 613911c57..742d2b56f 100644
--- a/app/models/remote_profile.rb
+++ b/app/models/remote_profile.rb
@@ -41,6 +41,10 @@ class RemoteProfile
     @header ||= link_href_from_xml(author, 'header')
   end
 
+  def emojis
+    @emojis ||= author.xpath('./xmlns:link[@rel="emoji"]', xmlns: OStatus::TagManager::XMLNS)
+  end
+
   def locked?
     scope == 'private'
   end