Merge branch 'gs-master' into prevent-local-only-federation
Conflicts: db/schema.rb
This commit is contained in:
@@ -287,6 +287,7 @@ class Account < ApplicationRecord
|
||||
FROM accounts
|
||||
WHERE #{query} @@ #{textsearch}
|
||||
AND accounts.suspended = false
|
||||
AND accounts.moved_to_account_id IS NULL
|
||||
ORDER BY rank DESC
|
||||
LIMIT ?
|
||||
SQL
|
||||
@@ -312,6 +313,7 @@ class Account < ApplicationRecord
|
||||
WHERE accounts.id IN (SELECT * FROM first_degree)
|
||||
AND #{query} @@ #{textsearch}
|
||||
AND accounts.suspended = false
|
||||
AND accounts.moved_to_account_id IS NULL
|
||||
GROUP BY accounts.id
|
||||
ORDER BY rank DESC
|
||||
LIMIT ?
|
||||
@@ -327,6 +329,7 @@ class Account < ApplicationRecord
|
||||
LEFT OUTER JOIN follows AS f ON (accounts.id = f.account_id AND f.target_account_id = ?) OR (accounts.id = f.target_account_id AND f.account_id = ?)
|
||||
WHERE #{query} @@ #{textsearch}
|
||||
AND accounts.suspended = false
|
||||
AND accounts.moved_to_account_id IS NULL
|
||||
GROUP BY accounts.id
|
||||
ORDER BY rank DESC
|
||||
LIMIT ?
|
||||
|
||||
@@ -45,6 +45,8 @@ class AccountFilter
|
||||
else
|
||||
Account.default_scoped
|
||||
end
|
||||
when 'staff'
|
||||
accounts_with_users.merge User.staff
|
||||
else
|
||||
raise "Unknown filter: #{key}"
|
||||
end
|
||||
|
||||
@@ -27,6 +27,8 @@ class CustomEmojiFilter
|
||||
CustomEmoji.remote
|
||||
when 'by_domain'
|
||||
CustomEmoji.where(domain: value)
|
||||
when 'shortcode'
|
||||
CustomEmoji.where(shortcode: value)
|
||||
else
|
||||
raise "Unknown filter: #{key}"
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Table name: lists
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# account_id :integer
|
||||
# account_id :integer not null
|
||||
# title :string default(""), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
@@ -13,6 +13,8 @@
|
||||
class List < ApplicationRecord
|
||||
include Paginable
|
||||
|
||||
PER_ACCOUNT_LIMIT = 50
|
||||
|
||||
belongs_to :account
|
||||
|
||||
has_many :list_accounts, inverse_of: :list, dependent: :destroy
|
||||
@@ -20,6 +22,10 @@ class List < ApplicationRecord
|
||||
|
||||
validates :title, presence: true
|
||||
|
||||
validates_each :account_id, on: :create do |record, _attr, value|
|
||||
record.errors.add(:base, I18n.t('lists.errors.limit')) if List.where(account_id: value).count >= PER_ACCOUNT_LIMIT
|
||||
end
|
||||
|
||||
before_destroy :clean_feed_manager
|
||||
|
||||
private
|
||||
|
||||
@@ -33,7 +33,7 @@ class PreviewCard < ApplicationRecord
|
||||
|
||||
has_and_belongs_to_many :statuses
|
||||
|
||||
has_attached_file :image, styles: { original: '280x280>' }, convert_options: { all: '-quality 80 -strip' }
|
||||
has_attached_file :image, styles: { original: '400x400>' }, convert_options: { all: '-quality 80 -strip' }
|
||||
|
||||
include Attachmentable
|
||||
include Remotable
|
||||
|
||||
@@ -23,7 +23,7 @@ class Tag < ApplicationRecord
|
||||
|
||||
class << self
|
||||
def search_for(term, limit = 5)
|
||||
pattern = sanitize_sql_like(term) + '%'
|
||||
pattern = sanitize_sql_like(term.strip) + '%'
|
||||
Tag.where('lower(name) like lower(?)', pattern).order(:name).limit(limit)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,7 +75,7 @@ class User < ApplicationRecord
|
||||
|
||||
has_many :session_activations, dependent: :destroy
|
||||
|
||||
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal,
|
||||
delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal,
|
||||
:reduce_motion, :system_font_ui, :noindex, :flavour, :skin,
|
||||
to: :settings, prefix: :setting, allow_nil: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user