mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 08:34:13 -05:00
Add option for multiple local-only emojis through the DEFAULT_LOCAL_ONLY_EMOJI and ALTERNATIVE_LOCAL_ONLY_EMOJI env vars
This commit is contained in:
parent
c18884de32
commit
28663c07f7
@ -301,3 +301,10 @@ MAX_POLL_OPTION_CHARS=100
|
||||
# -----------------------
|
||||
IP_RETENTION_PERIOD=31556952
|
||||
SESSION_RETENTION_PERIOD=31556952
|
||||
|
||||
# Local-only Emoji
|
||||
# **Always add old local-only emojis to the ALTERNATIVE_LOCAL_ONLY_EMOJI**,
|
||||
# otherwise old local-only messages will become public
|
||||
# ALTERNATIVE_LOCAL_ONLY_EMOJI is a comma-separated list of alternate emoji to use for local-only messages.
|
||||
# DEFAULT_LOCAL_ONLY_EMOJI=
|
||||
# ALTERNATIVE_LOCAL_ONLY_EMOJI=
|
||||
|
@ -431,11 +431,15 @@ class Status < ApplicationRecord
|
||||
|
||||
def marked_local_only?
|
||||
# match both with and without U+FE0F (the emoji variation selector)
|
||||
/#{local_only_emoji}\ufe0f?\z/.match?(content)
|
||||
/(#{all_local_only_emojis.join('|')})\ufe0f?\z/.match?(content)
|
||||
end
|
||||
|
||||
def local_only_emoji
|
||||
'👁'
|
||||
ENV.get('DEFAULT_LOCAL_ONLY_EMOJI', '👁')
|
||||
end
|
||||
|
||||
def all_local_only_emojis
|
||||
ENV.get('ALTERNATIVE_LOCAL_ONLY_EMOJI', '').split(',').push(local_only_emoji)
|
||||
end
|
||||
|
||||
def status_stat
|
||||
|
Loading…
Reference in New Issue
Block a user