Merge branch 'main' into glitch-soc/merge-upstream
- `app/views/statuses/_simple_status.html.haml`: Small markup change in glitch-soc, on a line that has been modified by upstream. Ported upstream changes.
This commit is contained in:
@@ -5,6 +5,8 @@ class ActivityPub::FetchRemoteKeyService < BaseService
|
||||
|
||||
# Returns account that owns the key
|
||||
def call(uri, id: true, prefetched_body: nil)
|
||||
return if uri.blank?
|
||||
|
||||
if prefetched_body.nil?
|
||||
if id
|
||||
@json = fetch_resource_without_id_validation(uri)
|
||||
|
@@ -87,6 +87,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||
@account.url = url || @uri
|
||||
@account.uri = @uri
|
||||
@account.actor_type = actor_type
|
||||
@account.created_at = @json['published'] if @json['published'].present?
|
||||
end
|
||||
|
||||
def set_immediate_attributes!
|
||||
@@ -101,7 +102,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||
end
|
||||
|
||||
def set_fetchable_key!
|
||||
@account.public_key = public_key || ''
|
||||
@account.public_key = public_key || ''
|
||||
end
|
||||
|
||||
def set_fetchable_attributes!
|
||||
|
@@ -5,48 +5,13 @@ class BootstrapTimelineService < BaseService
|
||||
@source_account = source_account
|
||||
|
||||
autofollow_inviter!
|
||||
autofollow_bootstrap_timeline_accounts! if Setting.enable_bootstrap_timeline_accounts
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def autofollow_inviter!
|
||||
return unless @source_account&.user&.invite&.autofollow?
|
||||
|
||||
FollowService.new.call(@source_account, @source_account.user.invite.user.account)
|
||||
end
|
||||
|
||||
def autofollow_bootstrap_timeline_accounts!
|
||||
bootstrap_timeline_accounts.each do |target_account|
|
||||
begin
|
||||
FollowService.new.call(@source_account, target_account)
|
||||
rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def bootstrap_timeline_accounts
|
||||
return @bootstrap_timeline_accounts if defined?(@bootstrap_timeline_accounts)
|
||||
|
||||
@bootstrap_timeline_accounts = bootstrap_timeline_accounts_usernames.empty? ? admin_accounts : local_unlocked_accounts(bootstrap_timeline_accounts_usernames)
|
||||
end
|
||||
|
||||
def bootstrap_timeline_accounts_usernames
|
||||
@bootstrap_timeline_accounts_usernames ||= (Setting.bootstrap_timeline_accounts || '').split(',').map { |str| str.strip.gsub(/\A@/, '') }.reject(&:blank?)
|
||||
end
|
||||
|
||||
def admin_accounts
|
||||
User.admins
|
||||
.includes(:account)
|
||||
.where(accounts: { locked: false })
|
||||
.map(&:account)
|
||||
end
|
||||
|
||||
def local_unlocked_accounts(usernames)
|
||||
Account.local
|
||||
.without_suspended
|
||||
.where(username: usernames)
|
||||
.where(locked: false)
|
||||
.where(moved_to_account_id: nil)
|
||||
end
|
||||
end
|
||||
|
@@ -30,6 +30,11 @@ class FollowService < BaseService
|
||||
|
||||
ActivityTracker.increment('activity:interactions')
|
||||
|
||||
# When an account follows someone for the first time, avoid showing
|
||||
# an empty home feed while the follow request is being processed
|
||||
# and the feeds are being merged
|
||||
mark_home_feed_as_partial! if @source_account.not_following_anyone?
|
||||
|
||||
if (@target_account.locked? && !@options[:bypass_locked]) || @source_account.silenced? || @target_account.activitypub?
|
||||
request_follow!
|
||||
elsif @target_account.local?
|
||||
@@ -39,6 +44,10 @@ class FollowService < BaseService
|
||||
|
||||
private
|
||||
|
||||
def mark_home_feed_as_partial!
|
||||
redis.set("account:#{@source_account.id}:regeneration", true, nx: true, ex: 1.day.seconds)
|
||||
end
|
||||
|
||||
def following_not_possible?
|
||||
@target_account.nil? || @target_account.id == @source_account.id || @target_account.suspended?
|
||||
end
|
||||
|
@@ -8,8 +8,7 @@ class ProcessHashtagsService < BaseService
|
||||
Tag.find_or_create_by_names(tags) do |tag|
|
||||
status.tags << tag
|
||||
records << tag
|
||||
|
||||
TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility?
|
||||
tag.use!(status.account, status: status, at_time: status.created_at) if status.public_visibility?
|
||||
end
|
||||
|
||||
return unless status.distributable?
|
||||
|
@@ -35,6 +35,7 @@ class ReblogService < BaseService
|
||||
|
||||
create_notification(reblog)
|
||||
bump_potential_friendship(account, reblog)
|
||||
record_use(account, reblog)
|
||||
|
||||
reblog
|
||||
end
|
||||
@@ -59,6 +60,16 @@ class ReblogService < BaseService
|
||||
PotentialFriendshipTracker.record(account.id, reblog.reblog.account_id, :reblog)
|
||||
end
|
||||
|
||||
def record_use(account, reblog)
|
||||
return unless reblog.public_visibility?
|
||||
|
||||
original_status = reblog.reblog
|
||||
|
||||
original_status.tags.each do |tag|
|
||||
tag.use!(account)
|
||||
end
|
||||
end
|
||||
|
||||
def build_json(reblog)
|
||||
Oj.dump(serialize_payload(ActivityPub::ActivityPresenter.from_status(reblog), ActivityPub::ActivitySerializer, signer: reblog.account))
|
||||
end
|
||||
|
Reference in New Issue
Block a user