mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 00:08:46 +00:00
Merge commit '01ce9df88008cee705b7e02a4581802afa07c3df' into glitch-soc/merge-upstream
Conflicts: - `tsconfig.json`: Upstream made style fixes, while glitch-soc had extra options. Ported upstream's style fixes.
This commit is contained in:
@@ -30,7 +30,7 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
|
||||
end
|
||||
|
||||
def default_accounts
|
||||
Account.includes(:active_relationships, :account_stat).references(:active_relationships)
|
||||
Account.includes(:active_relationships, :account_stat, :user).references(:active_relationships)
|
||||
end
|
||||
|
||||
def paginated_follows
|
||||
|
||||
@@ -30,7 +30,7 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
|
||||
end
|
||||
|
||||
def default_accounts
|
||||
Account.includes(:passive_relationships, :account_stat).references(:passive_relationships)
|
||||
Account.includes(:passive_relationships, :account_stat, :user).references(:passive_relationships)
|
||||
end
|
||||
|
||||
def paginated_follows
|
||||
|
||||
@@ -17,7 +17,7 @@ class Api::V1::BlocksController < Api::BaseController
|
||||
end
|
||||
|
||||
def paginated_blocks
|
||||
@paginated_blocks ||= Block.eager_load(target_account: :account_stat)
|
||||
@paginated_blocks ||= Block.eager_load(target_account: [:account_stat, :user])
|
||||
.joins(:target_account)
|
||||
.merge(Account.without_suspended)
|
||||
.where(account: current_account)
|
||||
|
||||
@@ -27,7 +27,7 @@ class Api::V1::DirectoriesController < Api::BaseController
|
||||
scope.merge!(local_account_scope) if local_accounts?
|
||||
scope.merge!(account_exclusion_scope) if current_account
|
||||
scope.merge!(account_domain_block_scope) if current_account && !local_accounts?
|
||||
end
|
||||
end.includes(:account_stat, user: :role)
|
||||
end
|
||||
|
||||
def local_accounts?
|
||||
|
||||
@@ -25,7 +25,7 @@ class Api::V1::EndorsementsController < Api::BaseController
|
||||
end
|
||||
|
||||
def endorsed_accounts
|
||||
current_account.endorsed_accounts.includes(:account_stat).without_suspended
|
||||
current_account.endorsed_accounts.includes(:account_stat, :user).without_suspended
|
||||
end
|
||||
|
||||
def insert_pagination_headers
|
||||
|
||||
@@ -37,7 +37,7 @@ class Api::V1::FollowRequestsController < Api::BaseController
|
||||
end
|
||||
|
||||
def default_accounts
|
||||
Account.without_suspended.includes(:follow_requests, :account_stat).references(:follow_requests)
|
||||
Account.without_suspended.includes(:follow_requests, :account_stat, :user).references(:follow_requests)
|
||||
end
|
||||
|
||||
def paginated_follow_requests
|
||||
|
||||
@@ -37,9 +37,9 @@ class Api::V1::Lists::AccountsController < Api::BaseController
|
||||
|
||||
def load_accounts
|
||||
if unlimited?
|
||||
@list.accounts.without_suspended.includes(:account_stat).all
|
||||
@list.accounts.without_suspended.includes(:account_stat, :user).all
|
||||
else
|
||||
@list.accounts.without_suspended.includes(:account_stat).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id])
|
||||
@list.accounts.without_suspended.includes(:account_stat, :user).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Api::V1::MutesController < Api::BaseController
|
||||
end
|
||||
|
||||
def paginated_mutes
|
||||
@paginated_mutes ||= Mute.eager_load(:target_account)
|
||||
@paginated_mutes ||= Mute.eager_load(target_account: [:account_stat, :user])
|
||||
.joins(:target_account)
|
||||
.merge(Account.without_suspended)
|
||||
.where(account: current_account)
|
||||
|
||||
@@ -21,7 +21,7 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::V1::Statuses::Bas
|
||||
def default_accounts
|
||||
Account
|
||||
.without_suspended
|
||||
.includes(:favourites, :account_stat)
|
||||
.includes(:favourites, :account_stat, :user)
|
||||
.references(:favourites)
|
||||
.where(favourites: { status_id: @status.id })
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::V1::Statuses::Base
|
||||
end
|
||||
|
||||
def default_accounts
|
||||
Account.without_suspended.includes(:statuses, :account_stat).references(:statuses)
|
||||
Account.without_suspended.includes(:statuses, :account_stat, :user).references(:statuses)
|
||||
end
|
||||
|
||||
def paginated_statuses
|
||||
|
||||
@@ -35,7 +35,7 @@ class Api::V2::FiltersController < Api::BaseController
|
||||
private
|
||||
|
||||
def set_filters
|
||||
@filters = current_account.custom_filters.includes(:keywords)
|
||||
@filters = current_account.custom_filters.includes(:keywords, :statuses)
|
||||
end
|
||||
|
||||
def set_filter
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import {
|
||||
@@ -12,10 +13,15 @@ import {
|
||||
|
||||
import Search from '../components/search';
|
||||
|
||||
const getRecentSearches = createSelector(
|
||||
state => state.getIn(['search', 'recent']),
|
||||
recent => recent.reverse(),
|
||||
);
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
value: state.getIn(['search', 'value']),
|
||||
submitted: state.getIn(['search', 'submitted']),
|
||||
recent: state.getIn(['search', 'recent']).reverse(),
|
||||
recent: getRecentSearches(state),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
"compose_form.poll.duration": "Durada de l'enquesta",
|
||||
"compose_form.poll.option_placeholder": "Opció {number}",
|
||||
"compose_form.poll.remove_option": "Elimina aquesta opció",
|
||||
"compose_form.poll.switch_to_multiple": "Canvia l’enquesta per a permetre diverses opcions",
|
||||
"compose_form.poll.switch_to_multiple": "Canvia l’enquesta per a permetre múltiples opcions",
|
||||
"compose_form.poll.switch_to_single": "Canvia l’enquesta per a permetre una única opció",
|
||||
"compose_form.publish": "Tut",
|
||||
"compose_form.publish_form": "Nou tut",
|
||||
@@ -607,7 +607,7 @@
|
||||
"search.quick_action.status_search": "Tuts coincidint amb {x}",
|
||||
"search.search_or_paste": "Cerca o escriu l'URL",
|
||||
"search_popout.full_text_search_disabled_message": "No disponible a {domain}.",
|
||||
"search_popout.full_text_search_logged_out_message": "Només disponible en iniciar la sessió.",
|
||||
"search_popout.full_text_search_logged_out_message": "Només disponible amb la sessió iniciada.",
|
||||
"search_popout.language_code": "Codi de llengua ISO",
|
||||
"search_popout.options": "Opcions de cerca",
|
||||
"search_popout.quick_actions": "Accions ràpides",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"account.featured_tags.last_status_never": "Sem publicações",
|
||||
"account.featured_tags.title": "Hashtags em destaque de {name}",
|
||||
"account.follow": "Seguir",
|
||||
"account.follow_back": "Seguir de volta",
|
||||
"account.followers": "Seguidores",
|
||||
"account.followers.empty": "Nada aqui.",
|
||||
"account.followers_counter": "{count, plural, one {{counter} seguidor} other {{counter} seguidores}}",
|
||||
@@ -52,6 +53,7 @@
|
||||
"account.mute_notifications_short": "Silenciar notificações",
|
||||
"account.mute_short": "Silenciar",
|
||||
"account.muted": "Silenciado",
|
||||
"account.mutual": "Mútuo",
|
||||
"account.no_bio": "Nenhuma descrição fornecida.",
|
||||
"account.open_original_page": "Abrir a página original",
|
||||
"account.posts": "Toots",
|
||||
|
||||
@@ -29,7 +29,7 @@ class AccountSuggestions
|
||||
# a complicated query on this end.
|
||||
|
||||
account_ids = account_ids_with_sources[offset, limit]
|
||||
accounts_map = Account.where(id: account_ids.map(&:first)).includes(:account_stat).index_by(&:id)
|
||||
accounts_map = Account.where(id: account_ids.map(&:first)).includes(:account_stat, :user).index_by(&:id)
|
||||
|
||||
account_ids.filter_map do |(account_id, source)|
|
||||
next unless accounts_map.key?(account_id)
|
||||
|
||||
@@ -41,7 +41,7 @@ class Report < ApplicationRecord
|
||||
|
||||
scope :unresolved, -> { where(action_taken_at: nil) }
|
||||
scope :resolved, -> { where.not(action_taken_at: nil) }
|
||||
scope :with_accounts, -> { includes([:account, :target_account, :action_taken_by_account, :assigned_account].index_with({ user: [:invite_request, :invite] })) }
|
||||
scope :with_accounts, -> { includes([:account, :target_account, :action_taken_by_account, :assigned_account].index_with([:account_stat, { user: [:invite_request, :invite, :ips] }])) }
|
||||
|
||||
# A report is considered local if the reporter is local
|
||||
delegate :local?, to: :account
|
||||
|
||||
@@ -39,6 +39,8 @@ class Tag < ApplicationRecord
|
||||
HASHTAG_NAME_RE = /\A(#{HASHTAG_NAME_PAT})\z/i
|
||||
HASHTAG_INVALID_CHARS_RE = /[^[:alnum:]\u0E47-\u0E4E#{HASHTAG_SEPARATORS}]/
|
||||
|
||||
RECENT_STATUS_LIMIT = 1000
|
||||
|
||||
validates :name, presence: true, format: { with: HASHTAG_NAME_RE }
|
||||
validates :display_name, format: { with: HASHTAG_NAME_RE }
|
||||
validate :validate_name_change, if: -> { !new_record? && name_changed? }
|
||||
@@ -53,7 +55,7 @@ class Tag < ApplicationRecord
|
||||
scope :not_trendable, -> { where(trendable: false) }
|
||||
scope :recently_used, lambda { |account|
|
||||
joins(:statuses)
|
||||
.where(statuses: { id: account.statuses.select(:id).limit(1000) })
|
||||
.where(statuses: { id: account.statuses.select(:id).limit(RECENT_STATUS_LIMIT) })
|
||||
.group(:id).order(Arel.sql('count(*) desc'))
|
||||
}
|
||||
scope :matches_name, ->(term) { where(arel_table[:name].lower.matches(arel_table.lower("#{sanitize_sql_like(Tag.normalize(term))}%"), nil, true)) } # Search with case-sensitive to use B-tree index
|
||||
|
||||
@@ -44,7 +44,7 @@ class ActivityPub::FetchRemoteStatusService < BaseService
|
||||
|
||||
# If we fetched a status that already exists, then we need to treat the
|
||||
# activity as an update rather than create
|
||||
activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.where(uri: object_uri, account_id: actor.id).exists?
|
||||
activity_json['type'] = 'Update' if equals_or_includes_any?(activity_json['type'], %w(Create)) && Status.exists?(uri: object_uri, account_id: actor.id)
|
||||
|
||||
with_redis do |redis|
|
||||
discoveries = redis.incr("status_discovery_per_request:#{@request_id}")
|
||||
|
||||
@@ -19,7 +19,7 @@ class VoteService < BaseService
|
||||
already_voted = true
|
||||
|
||||
with_redis_lock("vote:#{@poll.id}:#{@account.id}") do
|
||||
already_voted = @poll.votes.where(account: @account).exists?
|
||||
already_voted = @poll.votes.exists?(account: @account)
|
||||
|
||||
ApplicationRecord.transaction do
|
||||
@choices.each do |choice|
|
||||
|
||||
@@ -19,7 +19,7 @@ class ReactionValidator < ActiveModel::Validator
|
||||
end
|
||||
|
||||
def new_reaction?(reaction)
|
||||
!reaction.announcement.announcement_reactions.where(name: reaction.name).exists?
|
||||
!reaction.announcement.announcement_reactions.exists?(name: reaction.name)
|
||||
end
|
||||
|
||||
def limit_reached?(reaction)
|
||||
|
||||
@@ -35,7 +35,7 @@ class VoteValidator < ActiveModel::Validator
|
||||
if vote.persisted?
|
||||
account_votes_on_same_poll(vote).where(choice: vote.choice).where.not(poll_votes: { id: vote }).exists?
|
||||
else
|
||||
account_votes_on_same_poll(vote).where(choice: vote.choice).exists?
|
||||
account_votes_on_same_poll(vote).exists?(choice: vote.choice)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user