Merge branch 'master' into glitch-soc/tentative-merge

Conflicts:
	README.md
	app/controllers/statuses_controller.rb
	app/lib/feed_manager.rb
	config/navigation.rb
	spec/lib/feed_manager_spec.rb

Conflicts were resolved by taking both versions for each change.
This means the two filter systems (glitch-soc's keyword mutes and tootsuite's
custom filters) are in place, which will be changed in a follow-up commit.
This commit is contained in:
Thibaut Girka
2018-07-09 07:05:29 +02:00
3127 changed files with 7554 additions and 3945 deletions

View File

@ -15,7 +15,10 @@ class FavouriteService < BaseService
return favourite unless favourite.nil?
favourite = Favourite.create!(account: account, status: status)
create_notification(favourite)
bump_potential_friendship(account, status)
favourite
end
@ -33,6 +36,11 @@ class FavouriteService < BaseService
end
end
def bump_potential_friendship(account, status)
return if account.following?(status.account_id)
PotentialFriendshipTracker.record(account.id, status.account_id, :favourite)
end
def build_json(favourite)
Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(
favourite,

View File

@ -50,6 +50,8 @@ class PostStatusService < BaseService
redis.setex("idempotency:status:#{account.id}:#{options[:idempotency]}", 3_600, status.id)
end
bump_potential_friendship(account, status)
status
end
@ -82,4 +84,9 @@ class PostStatusService < BaseService
def redis
Redis.current
end
def bump_potential_friendship(account, status)
return if !status.reply? || account.following?(status.in_reply_to_account_id)
PotentialFriendshipTracker.record(account.id, status.in_reply_to_account_id, :reply)
end
end

View File

@ -27,6 +27,8 @@ class ReblogService < BaseService
end
create_notification(reblog)
bump_potential_friendship(account, reblog)
reblog
end
@ -44,6 +46,11 @@ class ReblogService < BaseService
end
end
def bump_potential_friendship(account, reblog)
return if account.following?(reblog.reblog.account_id)
PotentialFriendshipTracker.record(account.id, reblog.reblog.account_id, :reblog)
end
def build_json(reblog)
Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(
reblog,

View File

@ -67,7 +67,9 @@ class RemoveStatusService < BaseService
# delete notification - so here, we explicitly
# send it to them
target_accounts = (@mentions.map(&:account).reject(&:local?) + @reblogs.map(&:account).reject(&:local?)).uniq(&:id)
target_accounts = (@mentions.map(&:account).reject(&:local?) + @reblogs.map(&:account).reject(&:local?))
target_accounts << @status.reblog.account if @status.reblog? && !@status.reblog.account.local?
target_accounts.uniq!(&:id)
# Ostatus
NotificationWorker.push_bulk(target_accounts.select(&:ostatus?).uniq(&:domain)) do |target_account|