diff options
author | ThibG <thib@sitedethib.com> | 2019-03-20 17:29:12 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-20 17:29:12 +0100 |
commit | 80f0910e2141b24082b9143266a9a6cf1ef6a516 (patch) | |
tree | af7a96def3f54cdb4b8fcb11adc1ecb36166c529 /app/models | |
parent | 66d945209278c9344d503fe4e7a58d5c6f040e50 (diff) |
Add support for custom emojis in poll options (#10322)
* Backend changes for custom emoji support in poll options * Serialize poll emojis in REST API * Render custom emojis in poll options * Render custom emoji in poll options on public pages
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/poll.rb | 4 | ||||
-rw-r--r-- | app/models/status.rb | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/models/poll.rb b/app/models/poll.rb index 6df230337..8f72c7b11 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -60,6 +60,10 @@ class Poll < ApplicationRecord !local? end + def emojis + @emojis ||= CustomEmoji.from_text(options.join(' '), account.domain) + end + class Option < ActiveModelSerializers::Model attributes :id, :title, :votes_count, :poll diff --git a/app/models/status.rb b/app/models/status.rb index b9479c76b..d3fb83cca 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -213,7 +213,11 @@ class Status < ApplicationRecord end def emojis - @emojis ||= CustomEmoji.from_text([spoiler_text, text].join(' '), account.domain) + return @emojis if defined?(@emojis) + fields = [spoiler_text, text] + fields += owned_poll.options unless owned_poll.nil? + @emojis = CustomEmoji.from_text(fields.join(' '), account.domain) + @emojis end def mark_for_mass_destruction! |