Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - README.md - app/javascript/styles/mastodon/components.scss conflicts caused by image URLs being different - app/models/status.rb as_home_timeline removed, kept glitch-soc-only as_direct_timeline - app/views/statuses/_simple_status.html.haml - config/locales/en.yml some strings were changed upstream - spec/models/status_spec.rb as_home_timeline removed, kept glitch-soc-only as_direct_timeline
This commit is contained in:
@ -202,7 +202,7 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def unsilence!
|
||||
update!(silenced_at: nil, trust_level: trust_level == TRUST_LEVELS[:untrusted] ? TRUST_LEVELS[:trusted] : trust_level)
|
||||
update!(silenced_at: nil)
|
||||
end
|
||||
|
||||
def suspended?
|
||||
@ -312,10 +312,9 @@ class Account < ApplicationRecord
|
||||
def save_with_optional_media!
|
||||
save!
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
self.avatar = nil
|
||||
self.header = nil
|
||||
self[:avatar_remote_url] = ''
|
||||
self[:header_remote_url] = ''
|
||||
self.avatar = nil
|
||||
self.header = nil
|
||||
|
||||
save!
|
||||
end
|
||||
|
||||
|
@ -62,6 +62,8 @@ class Admin::AccountAction
|
||||
|
||||
def process_action!
|
||||
case type
|
||||
when 'none'
|
||||
handle_resolve!
|
||||
when 'disable'
|
||||
handle_disable!
|
||||
when 'silence'
|
||||
@ -103,6 +105,16 @@ class Admin::AccountAction
|
||||
end
|
||||
end
|
||||
|
||||
def handle_resolve!
|
||||
if with_report? && report.account_id == -99 && target_account.trust_level == Account::TRUST_LEVELS[:untrusted]
|
||||
# This is an automated report and it is being dismissed, so it's
|
||||
# a false positive, in which case update the account's trust level
|
||||
# to prevent further spam checks
|
||||
|
||||
target_account.update(trust_level: Account::TRUST_LEVELS[:trusted])
|
||||
end
|
||||
end
|
||||
|
||||
def handle_disable!
|
||||
authorize(target_account.user, :disable?)
|
||||
log_action(:disable, target_account.user)
|
||||
|
@ -18,7 +18,7 @@ module Remotable
|
||||
return
|
||||
end
|
||||
|
||||
return if !%w(http https).include?(parsed_url.scheme) || parsed_url.host.blank? || self[attribute_name] == url
|
||||
return if !%w(http https).include?(parsed_url.scheme) || parsed_url.host.blank? || (self[attribute_name] == url && send("#{attachment_name}_file_name").present?)
|
||||
|
||||
begin
|
||||
Request.new(:get, url).perform do |response|
|
||||
|
@ -36,6 +36,7 @@ class Form::AdminSettings
|
||||
show_replies_in_public_timelines
|
||||
spam_check_enabled
|
||||
trends
|
||||
trendable_by_default
|
||||
show_domain_blocks
|
||||
show_domain_blocks_rationale
|
||||
noindex
|
||||
@ -56,6 +57,7 @@ class Form::AdminSettings
|
||||
show_replies_in_public_timelines
|
||||
spam_check_enabled
|
||||
trends
|
||||
trendable_by_default
|
||||
noindex
|
||||
).freeze
|
||||
|
||||
|
@ -7,19 +7,7 @@ class HomeFeed < Feed
|
||||
@account = account
|
||||
end
|
||||
|
||||
def get(limit, max_id = nil, since_id = nil, min_id = nil)
|
||||
if redis.exists("account:#{@account.id}:regeneration")
|
||||
from_database(limit, max_id, since_id, min_id)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def from_database(limit, max_id, since_id, min_id)
|
||||
Status.as_home_timeline(@account)
|
||||
.paginate_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
|
||||
.reject { |status| FeedManager.instance.filter?(:home, status, @account.id) }
|
||||
def regenerating?
|
||||
redis.exists("account:#{@id}:regeneration")
|
||||
end
|
||||
end
|
||||
|
@ -57,6 +57,7 @@ class MediaAttachment < ApplicationRecord
|
||||
small: {
|
||||
convert_options: {
|
||||
output: {
|
||||
'loglevel' => 'fatal',
|
||||
vf: 'scale=\'min(400\, iw):min(400\, ih)\':force_original_aspect_ratio=decrease',
|
||||
},
|
||||
},
|
||||
@ -70,6 +71,7 @@ class MediaAttachment < ApplicationRecord
|
||||
keep_same_format: true,
|
||||
convert_options: {
|
||||
output: {
|
||||
'loglevel' => 'fatal',
|
||||
'map_metadata' => '-1',
|
||||
'c:v' => 'copy',
|
||||
'c:a' => 'copy',
|
||||
@ -84,6 +86,7 @@ class MediaAttachment < ApplicationRecord
|
||||
content_type: 'audio/mpeg',
|
||||
convert_options: {
|
||||
output: {
|
||||
'loglevel' => 'fatal',
|
||||
'q:a' => 2,
|
||||
},
|
||||
},
|
||||
|
@ -291,10 +291,6 @@ class Status < ApplicationRecord
|
||||
where(language: nil).or where(language: account.chosen_languages)
|
||||
end
|
||||
|
||||
def as_home_timeline(account)
|
||||
where(account: [account] + account.following).where(visibility: [:public, :unlisted, :private])
|
||||
end
|
||||
|
||||
def as_direct_timeline(account, limit = 20, max_id = nil, since_id = nil, cache_ids = false)
|
||||
# direct timeline is mix of direct message from_me and to_me.
|
||||
# 2 queries are executed with pagination.
|
||||
|
@ -37,6 +37,7 @@ class Tag < ApplicationRecord
|
||||
scope :pending_review, -> { unreviewed.where.not(requested_review_at: nil) }
|
||||
scope :usable, -> { where(usable: [true, nil]) }
|
||||
scope :listable, -> { where(listable: [true, nil]) }
|
||||
scope :trendable, -> { Setting.trendable_by_default ? where(trendable: [true, nil]) : where(trendable: true) }
|
||||
scope :discoverable, -> { listable.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')) }
|
||||
scope :matches_name, ->(value) { where(arel_table[:name].matches("#{value}%")) }
|
||||
@ -76,7 +77,7 @@ class Tag < ApplicationRecord
|
||||
alias listable? listable
|
||||
|
||||
def trendable
|
||||
boolean_with_default('trendable', false)
|
||||
boolean_with_default('trendable', Setting.trendable_by_default)
|
||||
end
|
||||
|
||||
alias trendable? trendable
|
||||
|
@ -90,7 +90,7 @@ class TrendingTags
|
||||
tag_ids = redis.zrevrange(KEY, 0, LIMIT - 1).map(&:to_i)
|
||||
|
||||
tags = Tag.where(id: tag_ids)
|
||||
tags = tags.where(trendable: true) if filtered
|
||||
tags = tags.trendable if filtered
|
||||
tags = tags.each_with_object({}) { |tag, h| h[tag.id] = tag }
|
||||
|
||||
tag_ids.map { |tag_id| tags[tag_id] }.compact.take(limit)
|
||||
|
Reference in New Issue
Block a user