1
0
Fork 0
forked from gitea/nas

Merge remote-tracking branch 'parent/main' into upstream-20240821

This commit is contained in:
KMY 2024-08-21 12:39:30 +09:00
commit af0f8f01e1
136 changed files with 693 additions and 756 deletions

View file

@ -152,6 +152,7 @@ class Account < ApplicationRecord
scope :dormant, -> { joins(:account_stat).merge(AccountStat.without_recent_activity) }
scope :with_username, ->(value) { where arel_table[:username].lower.eq(value.to_s.downcase) }
scope :with_domain, ->(value) { where arel_table[:domain].lower.eq(value&.to_s&.downcase) }
scope :without_memorial, -> { where(memorial: false) }
after_update_commit :trigger_update_webhooks

View file

@ -31,6 +31,7 @@ class AccountSuggestions::FriendsOfFriendsSource < AccountSuggestions::Source
AND accounts.suspended_at IS NULL
AND accounts.silenced_at IS NULL
AND accounts.moved_to_account_id IS NULL
AND accounts.memorial = FALSE
AND follow_recommendation_mutes.target_account_id IS NULL
GROUP BY accounts.id, account_stats.id
ORDER BY frequency DESC, account_stats.followers_count ASC

View file

@ -14,6 +14,7 @@ class AccountSuggestions::Source
.searchable
.where(discoverable: true)
.without_silenced
.without_memorial
.where.not(follows_sql, id: account.id)
.where.not(follow_requests_sql, id: account.id)
.not_excluded_by_account(account)

View file

@ -209,8 +209,8 @@ class Notification < ApplicationRecord
# Notifications that have no `group_key` each count as a separate group.
def paginate_groups_by_max_id(limit, max_id: nil, since_id: nil)
query = reorder(id: :desc)
query = query.where(id: ...max_id) if max_id.present?
query = query.where(id: (since_id + 1)...) if since_id.present?
query = query.where(id: ...(max_id.to_i)) if max_id.present?
query = query.where(id: (since_id.to_i + 1)...) if since_id.present?
query.paginate_groups(limit, :desc)
end
@ -219,8 +219,8 @@ class Notification < ApplicationRecord
# Results will be in ascending order by id.
def paginate_groups_by_min_id(limit, max_id: nil, min_id: nil)
query = reorder(id: :asc)
query = query.where(id: (min_id + 1)...) if min_id.present?
query = query.where(id: ...max_id) if max_id.present?
query = query.where(id: (min_id.to_i + 1)...) if min_id.present?
query = query.where(id: ...(max_id.to_i)) if max_id.present?
query.paginate_groups(limit, :asc)
end

View file

@ -14,7 +14,7 @@ class Trends::TagFilter
def results
scope = if params[:status] == 'pending_review'
Tag.unscoped
Tag.unscoped.order(id: :desc)
else
trending_scope
end