Merge commit 'c357a7f8d697ede4df4be74456b0497118c9d049' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2025-06-30 17:52:22 +02:00
commit 2eec4da8fc
154 files changed
+1168 -826

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ class AccountSuggestions
AccountSuggestions::FriendsOfFriendsSource,
AccountSuggestions::SimilarProfilesSource,
AccountSuggestions::GlobalSource,
AccountSuggestions::FaspSource,
].freeze
BATCH_SIZE = 40
@@ -0,0 +1,17 @@
# frozen_string_literal: true
class AccountSuggestions::FaspSource < AccountSuggestions::Source
def get(account, limit: DEFAULT_LIMIT)
return [] unless Mastodon::Feature.fasp_enabled?
base_account_scope(account).where(id: fasp_follow_recommendations_for(account)).limit(limit).pluck(:id).map do |account_id|
[account_id, :fasp]
end
end
private
def fasp_follow_recommendations_for(account)
Fasp::FollowRecommendation.for_account(account).newest_first.select(:recommended_account_id)
end
end
+22
View File
@@ -0,0 +1,22 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: fasp_follow_recommendations
#
# id :bigint(8) not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# recommended_account_id :bigint(8) not null
# requesting_account_id :bigint(8) not null
#
class Fasp::FollowRecommendation < ApplicationRecord
MAX_AGE = 1.day.freeze
belongs_to :requesting_account, class_name: 'Account'
belongs_to :recommended_account, class_name: 'Account'
scope :outdated, -> { where(created_at: ...(MAX_AGE.ago)) }
scope :for_account, ->(account) { where(requesting_account: account) }
scope :newest_first, -> { order(created_at: :desc) }
end
+3 -3
View File
@@ -15,9 +15,9 @@
#
class TermsOfService < ApplicationRecord
scope :published, -> { where.not(published_at: nil).order(Arel.sql('coalesce(effective_date, published_at) DESC')) }
scope :live, -> { published.where('effective_date IS NULL OR effective_date < now()').limit(1) }
scope :upcoming, -> { published.reorder(effective_date: :asc).where('effective_date IS NOT NULL AND effective_date > now()').limit(1) }
scope :draft, -> { where(published_at: nil).order(id: :desc).limit(1) }
scope :live, -> { published.where('effective_date IS NULL OR effective_date < now()') }
scope :upcoming, -> { published.reorder(effective_date: :asc).where('effective_date IS NOT NULL AND effective_date > now()') }
scope :draft, -> { where(published_at: nil).order(id: :desc) }
validates :text, presence: true
validates :changelog, :effective_date, presence: true, if: -> { published? }