Merge remote-tracking branch 'parent/main' into upstream-20231107
This commit is contained in:
commit
64578feeb4
69 changed files with 437 additions and 218 deletions
|
@ -41,32 +41,34 @@ const normalizeAccounts = (
|
|||
return state;
|
||||
};
|
||||
|
||||
export const accountsReducer: Reducer<typeof initialState> = (
|
||||
state = initialState,
|
||||
action,
|
||||
) => {
|
||||
const currentUserId = me;
|
||||
|
||||
if (!currentUserId)
|
||||
function getCurrentUser() {
|
||||
if (!me)
|
||||
throw new Error(
|
||||
'No current user (me) defined when calling `accountsReducer`',
|
||||
);
|
||||
|
||||
return me;
|
||||
}
|
||||
|
||||
export const accountsReducer: Reducer<typeof initialState> = (
|
||||
state = initialState,
|
||||
action,
|
||||
) => {
|
||||
if (revealAccount.match(action))
|
||||
return state.setIn([action.payload.id, 'hidden'], false);
|
||||
else if (importAccounts.match(action))
|
||||
return normalizeAccounts(state, action.payload.accounts);
|
||||
else if (followAccountSuccess.match(action))
|
||||
else if (followAccountSuccess.match(action)) {
|
||||
return state
|
||||
.update(
|
||||
action.payload.relationship.id,
|
||||
(account) => account?.update('followers_count', (n) => n + 1),
|
||||
)
|
||||
.update(
|
||||
currentUserId,
|
||||
getCurrentUser(),
|
||||
(account) => account?.update('following_count', (n) => n + 1),
|
||||
);
|
||||
else if (unfollowAccountSuccess.match(action))
|
||||
} else if (unfollowAccountSuccess.match(action))
|
||||
return state
|
||||
.update(
|
||||
action.payload.relationship.id,
|
||||
|
@ -74,7 +76,7 @@ export const accountsReducer: Reducer<typeof initialState> = (
|
|||
account?.update('followers_count', (n) => Math.max(0, n - 1)),
|
||||
)
|
||||
.update(
|
||||
currentUserId,
|
||||
getCurrentUser(),
|
||||
(account) =>
|
||||
account?.update('following_count', (n) => Math.max(0, n - 1)),
|
||||
);
|
||||
|
|
|
@ -1886,12 +1886,14 @@ a.account__display-name {
|
|||
&.activate {
|
||||
& > .icon {
|
||||
animation: spring-rotate-in 1s linear;
|
||||
transform-origin: 50% 55%;
|
||||
}
|
||||
}
|
||||
|
||||
&.deactivate {
|
||||
& > .icon {
|
||||
animation: spring-rotate-out 1s linear;
|
||||
transform-origin: 50% 55%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,8 @@ class ActivityPub::Parser::StatusParser
|
|||
end
|
||||
|
||||
def created_at
|
||||
@object['published']&.to_datetime
|
||||
datetime = @object['published']&.to_datetime
|
||||
datetime if datetime.present? && (0..9999).cover?(datetime.year)
|
||||
rescue ArgumentError
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ class DeliveryFailureTracker
|
|||
key.delete_prefix(exhausted_deliveries_key_by(''))
|
||||
end
|
||||
|
||||
domains - UnavailableDomain.all.pluck(:domain)
|
||||
domains - UnavailableDomain.pluck(:domain)
|
||||
end
|
||||
|
||||
def warning_domains_map(domains = nil)
|
||||
|
|
|
@ -261,7 +261,7 @@ class FeedManager
|
|||
# @param [Account] target_account
|
||||
# @return [void]
|
||||
def clear_from_lists(account, target_account)
|
||||
List.where(account: account).each do |list|
|
||||
List.where(account: account).find_each do |list|
|
||||
clear_from_list(list, target_account)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ class ActivityPub::FetchFeaturedTagsCollectionService < BaseService
|
|||
|
||||
FeaturedTag.includes(:tag).references(:tag).where(account: @account).where.not(tag: { name: normalized_names }).delete_all
|
||||
|
||||
FeaturedTag.includes(:tag).references(:tag).where(account: @account, tag: { name: normalized_names }).each do |featured_tag|
|
||||
FeaturedTag.includes(:tag).references(:tag).where(account: @account, tag: { name: normalized_names }).find_each do |featured_tag|
|
||||
featured_tag.update(name: tags.delete(featured_tag.tag.name))
|
||||
end
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class ActivityPub::SynchronizeFollowersService < BaseService
|
|||
private
|
||||
|
||||
def remove_unexpected_local_followers!
|
||||
@account.followers.local.where.not(id: @expected_followers.map(&:id)).each do |unexpected_follower|
|
||||
@account.followers.local.where.not(id: @expected_followers.map(&:id)).reorder(nil).find_each do |unexpected_follower|
|
||||
UnfollowService.new.call(unexpected_follower, @account)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ class AppealService < BaseService
|
|||
end
|
||||
|
||||
def notify_staff!
|
||||
User.those_who_can(:manage_appeals).includes(:account).each do |u|
|
||||
User.those_who_can(:manage_appeals).includes(:account).find_each do |u|
|
||||
AdminMailer.with(recipient: u.account).new_appeal(@appeal).deliver_later if u.allows_appeal_emails?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ class ApproveAppealService < BaseService
|
|||
|
||||
def undo_mark_statuses_as_sensitive!
|
||||
representative_account = Account.representative
|
||||
@strike.statuses.includes(:media_attachments).each do |status|
|
||||
@strike.statuses.includes(:media_attachments).find_each do |status|
|
||||
UpdateStatusService.new.call(status, representative_account.id, sensitive: false) if status.with_media?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ class ProcessHashtagsService < BaseService
|
|||
added_tags = @current_tags - @previous_tags
|
||||
|
||||
unless added_tags.empty?
|
||||
@account.featured_tags.where(tag_id: added_tags.map(&:id)).each do |featured_tag|
|
||||
@account.featured_tags.where(tag_id: added_tags.map(&:id)).find_each do |featured_tag|
|
||||
featured_tag.increment(@status.created_at)
|
||||
end
|
||||
end
|
||||
|
@ -32,7 +32,7 @@ class ProcessHashtagsService < BaseService
|
|||
removed_tags = @previous_tags - @current_tags
|
||||
|
||||
unless removed_tags.empty?
|
||||
@account.featured_tags.where(tag_id: removed_tags.map(&:id)).each do |featured_tag|
|
||||
@account.featured_tags.where(tag_id: removed_tags.map(&:id)).find_each do |featured_tag|
|
||||
featured_tag.decrement(@status.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -134,7 +134,7 @@ class RemoveStatusService < BaseService
|
|||
end
|
||||
|
||||
def remove_from_hashtags
|
||||
@account.featured_tags.where(tag_id: @status.tags.map(&:id)).each do |featured_tag|
|
||||
@account.featured_tags.where(tag_id: @status.tags.map(&:id)).find_each do |featured_tag|
|
||||
featured_tag.decrement(@status.id)
|
||||
end
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class ReportService < BaseService
|
|||
def notify_staff!
|
||||
return if @report.unresolved_siblings?
|
||||
|
||||
User.those_who_can(:manage_reports).includes(:account).each do |u|
|
||||
User.those_who_can(:manage_reports).includes(:account).find_each do |u|
|
||||
LocalNotificationWorker.perform_async(u.account_id, @report.id, 'Report', 'admin.report')
|
||||
AdminMailer.with(recipient: u.account).new_report(@report).deliver_later if u.allows_report_emails?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue