Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/models/user.rb - app/serializers/initial_state_serializer.rb - app/views/admin/dashboard/index.html.haml - config/locales/simple_form.en.yml
This commit is contained in:
@@ -231,17 +231,7 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def tags_as_strings=(tag_names)
|
||||
tag_names.map! { |name| name.mb_chars.downcase.to_s }
|
||||
tag_names.uniq!
|
||||
|
||||
# Existing hashtags
|
||||
hashtags_map = Tag.where(name: tag_names).each_with_object({}) { |tag, h| h[tag.name] = tag }
|
||||
|
||||
# Initialize not yet existing hashtags
|
||||
tag_names.each do |name|
|
||||
next if hashtags_map.key?(name)
|
||||
hashtags_map[name] = Tag.new(name: name)
|
||||
end
|
||||
hashtags_map = Tag.find_or_create_by_names(tag_names).each_with_object({}) { |tag, h| h[tag.name] = tag }
|
||||
|
||||
# Remove hashtags that are to be deleted
|
||||
tags.each do |tag|
|
||||
|
||||
@@ -23,7 +23,7 @@ class FeaturedTag < ApplicationRecord
|
||||
validate :validate_featured_tags_limit, on: :create
|
||||
|
||||
def name=(str)
|
||||
self.tag = Tag.find_or_initialize_by(name: str.strip.delete('#').mb_chars.downcase.to_s)
|
||||
self.tag = Tag.find_or_create_by_names(str.strip)&.first
|
||||
end
|
||||
|
||||
def increment(timestamp)
|
||||
|
||||
@@ -35,6 +35,7 @@ class Form::AdminSettings
|
||||
show_reblogs_in_public_timelines
|
||||
show_replies_in_public_timelines
|
||||
spam_check_enabled
|
||||
trends
|
||||
).freeze
|
||||
|
||||
BOOLEAN_KEYS = %i(
|
||||
@@ -51,6 +52,7 @@ class Form::AdminSettings
|
||||
show_reblogs_in_public_timelines
|
||||
show_replies_in_public_timelines
|
||||
spam_check_enabled
|
||||
trends
|
||||
).freeze
|
||||
|
||||
UPLOAD_KEYS = %i(
|
||||
|
||||
@@ -31,7 +31,8 @@ class Tag < ApplicationRecord
|
||||
|
||||
scope :reviewed, -> { where.not(reviewed_at: nil) }
|
||||
scope :pending_review, -> { where(reviewed_at: nil).where.not(requested_review_at: nil) }
|
||||
scope :discoverable, -> { where.not(listable: false).joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).order(Arel.sql('account_tag_stats.accounts_count desc')) }
|
||||
scope :usable, -> { where(usable: [true, nil]) }
|
||||
scope :discoverable, -> { where(listable: [true, nil]).joins(:account_tag_stat).where(AccountTagStat.arel_table[:accounts_count].gt(0)).order(Arel.sql('account_tag_stats.accounts_count desc')) }
|
||||
scope :most_used, ->(account) { joins(:statuses).where(statuses: { account: account }).group(:id).order(Arel.sql('count(*) desc')) }
|
||||
|
||||
delegate :accounts_count,
|
||||
|
||||
@@ -66,6 +66,10 @@ class TrendingTags
|
||||
end
|
||||
|
||||
def request_review!(tag)
|
||||
return unless Setting.trends
|
||||
|
||||
tag.touch(:requested_review_at)
|
||||
|
||||
User.staff.includes(:account).find_each { |u| AdminMailer.new_trending_tag(u.account, tag).deliver_later! if u.allows_trending_tag_emails? }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -107,7 +107,9 @@ class User < ApplicationRecord
|
||||
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
|
||||
:reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_network, :hide_followers_count,
|
||||
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
|
||||
:advanced_layout, :default_content_type, :use_blurhash, :use_pending_items, :use_pending_items, to: :settings, prefix: :setting, allow_nil: false
|
||||
:advanced_layout, :use_blurhash, :use_pending_items, :trends,
|
||||
:default_content_type,
|
||||
to: :settings, prefix: :setting, allow_nil: false
|
||||
|
||||
attr_reader :invite_code
|
||||
attr_writer :external
|
||||
|
||||
Reference in New Issue
Block a user