mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-20 01:23:50 -05:00
[WIP] remote-only emojis
This commit is contained in:
parent
5aebdc9bcb
commit
ed9bbd1fc3
@ -53,6 +53,7 @@ class CustomEmoji < ApplicationRecord
|
||||
scope :local, -> { where(domain: nil) }
|
||||
scope :remote, -> { where.not(domain: nil) }
|
||||
scope :enabled, -> { where(disabled: false) }
|
||||
scope :remote_only, -> { where.not(domain: nil).where(category_id: nil) }
|
||||
scope :alphabetic, -> { order(domain: :asc, shortcode: :asc) }
|
||||
scope :by_domain_and_subdomains, ->(domain) { where(domain: domain).or(where(arel_table[:domain].matches("%.#{domain}"))) }
|
||||
scope :listed, -> { local.enabled.where(visible_in_picker: true) }
|
||||
|
@ -4,6 +4,7 @@ class CustomEmojiFilter
|
||||
KEYS = %i(
|
||||
local
|
||||
remote
|
||||
remote_only
|
||||
by_domain
|
||||
shortcode
|
||||
).freeze
|
||||
@ -21,6 +22,8 @@ class CustomEmojiFilter
|
||||
next if key.to_s == 'page'
|
||||
|
||||
scope.merge!(scope_for(key, value)) if value.present?
|
||||
|
||||
scope = CustomEmoji.remote_only if key.to_s == 'remote_only'
|
||||
end
|
||||
|
||||
scope
|
||||
@ -34,6 +37,8 @@ class CustomEmojiFilter
|
||||
CustomEmoji.local.left_joins(:category).reorder(CustomEmojiCategory.arel_table[:name].asc.nulls_first).order(shortcode: :asc)
|
||||
when 'remote'
|
||||
CustomEmoji.remote
|
||||
when 'remote_only'
|
||||
CustomEmoji.remote_only
|
||||
when 'by_domain'
|
||||
CustomEmoji.where(domain: value.strip.downcase)
|
||||
when 'shortcode'
|
||||
|
@ -9,17 +9,19 @@
|
||||
.filter-subset
|
||||
%strong= t('admin.accounts.location.title')
|
||||
%ul
|
||||
%li= filter_link_to t('admin.accounts.location.all'), local: nil, remote: nil
|
||||
%li= filter_link_to t('admin.accounts.location.all'), local: nil, remote: nil, remote_only: nil
|
||||
%li
|
||||
- if selected? local: '1', remote: nil
|
||||
= filter_link_to t('admin.accounts.location.local'), { local: nil, remote: nil }, { local: '1', remote: nil }
|
||||
- else
|
||||
= filter_link_to t('admin.accounts.location.local'), local: '1', remote: nil
|
||||
= filter_link_to t('admin.accounts.location.local'), local: '1', remote: nil, remote_only: nil
|
||||
%li
|
||||
- if selected? remote: '1', local: nil
|
||||
= filter_link_to t('admin.accounts.location.remote'), { remote: nil, local: nil }, { remote: '1', local: nil }
|
||||
- else
|
||||
= filter_link_to t('admin.accounts.location.remote'), remote: '1', local: nil
|
||||
= filter_link_to t('admin.accounts.location.remote'), remote: '1', local: nil, remote_only: nil
|
||||
%li
|
||||
= filter_link_to t('admin.accounts.location.remote_only'), remote_only: '1', remote: nil, local: nil
|
||||
|
||||
= form_with url: admin_custom_emojis_url, method: :get, class: :simple_form do |form|
|
||||
.fields-group
|
||||
|
Loading…
x
Reference in New Issue
Block a user