curated world: also consider public favs
parent
b507a598c5
commit
7580036307
|
@ -356,7 +356,7 @@ class Status < ApplicationRecord
|
||||||
query = timeline_scope(local_only).without_replies
|
query = timeline_scope(local_only).without_replies
|
||||||
else
|
else
|
||||||
# instead of our ftl being a noisy irrelevant firehose
|
# instead of our ftl being a noisy irrelevant firehose
|
||||||
# only show public stuff boosted by the community
|
# only show public stuff boosted/faved by the community
|
||||||
query = Status.network
|
query = Status.network
|
||||||
if local_only then
|
if local_only then
|
||||||
# we don't want to change the ltl
|
# we don't want to change the ltl
|
||||||
|
@ -366,14 +366,21 @@ class Status < ApplicationRecord
|
||||||
.without_reblogs
|
.without_reblogs
|
||||||
else # but on the ftl
|
else # but on the ftl
|
||||||
query = query.without_replies unless Setting.show_replies_in_public_timelines
|
query = query.without_replies unless Setting.show_replies_in_public_timelines
|
||||||
|
# grab the stuff we faved
|
||||||
|
fav_query = Favourite.select('status_id')
|
||||||
|
.where(account_id: Account.local)
|
||||||
|
.reorder(:status_id)
|
||||||
|
.distinct
|
||||||
# grab the stuff we boosted
|
# grab the stuff we boosted
|
||||||
subquery = query.reblogs.select(:reblog_of_id)
|
boost_query = query.reblogs.select(:reblog_of_id)
|
||||||
.reorder(nil)
|
.reorder(nil)
|
||||||
.distinct
|
.distinct
|
||||||
# map those ids to actual statuses
|
# map those ids to actual statuses
|
||||||
# THIS QUERY IS EXPENSIVE AS FUCK!!!!!!!
|
# THIS QUERY IS EXPENSIVE AS FUCK!!!!!!!
|
||||||
# but it does the job
|
# but it does the job
|
||||||
query = Status.where(id: subquery).with_public_visibility
|
query = Status.where(id: boost_query)
|
||||||
|
.or(where(id: fav_query))
|
||||||
|
.with_public_visibility
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class FanOutOnWriteService < BaseService
|
class FanOutOnWriteService < BaseService
|
||||||
# Push a status into home and mentions feeds
|
# Push a status into home and mentions feeds
|
||||||
# @param [Status] status
|
# @param [Status] status
|
||||||
def call(status)
|
def call(status, allow_nonlocal = false, deliver_to_local = true)
|
||||||
raise Mastodon::RaceConditionError if status.visibility.nil?
|
raise Mastodon::RaceConditionError if status.visibility.nil?
|
||||||
|
|
||||||
deliver_to_self(status) if status.account.local?
|
deliver_to_self(status) if status.account.local?
|
||||||
|
@ -27,8 +27,7 @@ class FanOutOnWriteService < BaseService
|
||||||
deliver_to_hashtags(status) if !status.reblog? && status.distributable?
|
deliver_to_hashtags(status) if !status.reblog? && status.distributable?
|
||||||
|
|
||||||
# we want to let community users decide what goes on the ftl with boosts
|
# we want to let community users decide what goes on the ftl with boosts
|
||||||
return unless status.network? || status.relayed?
|
return unless allow_nonlocal || status.network? || status.relayed?
|
||||||
deliver_to_local = true
|
|
||||||
|
|
||||||
if status.reblog? then
|
if status.reblog? then
|
||||||
status = Status.find(status.reblog_of_id)
|
status = Status.find(status.reblog_of_id)
|
||||||
|
|
|
@ -16,6 +16,9 @@ class FavouriteService < BaseService
|
||||||
|
|
||||||
favourite = Favourite.create!(account: account, status: status)
|
favourite = Favourite.create!(account: account, status: status)
|
||||||
|
|
||||||
|
# stream it to the world timeline if public
|
||||||
|
FanOutOnWriteService.new.call(status, true, false) if status.public_visibility?
|
||||||
|
|
||||||
create_notification(favourite)
|
create_notification(favourite)
|
||||||
bump_potential_friendship(account, status)
|
bump_potential_friendship(account, status)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue