From 123a343d116d3e83cbd04460cc7bd0b6f3d208c4 Mon Sep 17 00:00:00 2001 From: David Underwood Date: Sun, 1 Apr 2018 17:55:42 -0400 Subject: [WIP] Enable custom emoji on account pages and in the sidebar (#6124) Federate custom emojis with accounts --- app/models/account.rb | 4 ++++ app/models/remote_profile.rb | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'app/models') 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 -- cgit