Skip to content

Commit

Permalink
Do not push DMs into the home feed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Oct 9, 2018
1 parent 46e4a75 commit 82f5c8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
13 changes: 6 additions & 7 deletions app/javascript/mastodon/actions/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,20 @@ export function submitCompose() {
dispatch(insertIntoTagHistory(response.data.tags, status));
dispatch(submitComposeSuccess({ ...response.data }));

// To make the app more responsive, immediately get the status into the columns
// To make the app more responsive, immediately push the status
// into the columns

const insertIfOnline = (timelineId) => {
const insertIfOnline = timelineId => {
if (getState().getIn(['timelines', timelineId, 'items', 0]) !== null) {
dispatch(updateTimeline(timelineId, { ...response.data }));
}
};

insertIfOnline('home');

if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {
if (response.data.visibility !== 'direct') {
insertIfOnline('home');
} else if (response.data.in_reply_to_id === null && response.data.visibility === 'public') {
insertIfOnline('community');
insertIfOnline('public');
} else if (response.data.visibility === 'direct') {
insertIfOnline('direct');
}
}).catch(function (error) {
dispatch(submitComposeFail(error));
Expand Down
25 changes: 1 addition & 24 deletions app/services/fan_out_on_write_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ class FanOutOnWriteService < BaseService
def call(status)
raise Mastodon::RaceConditionError if status.visibility.nil?

deliver_to_self(status) if status.account.local?

render_anonymous_payload(status)

if status.direct_visibility?
deliver_to_mentioned_followers(status)
deliver_to_direct_timelines(status)
deliver_to_own_conversation(status)
else
deliver_to_self(status) if status.account.local?
deliver_to_followers(status)
deliver_to_lists(status)
end
Expand Down Expand Up @@ -56,16 +53,6 @@ def deliver_to_lists(status)
end
end

def deliver_to_mentioned_followers(status)
Rails.logger.debug "Delivering status #{status.id} to mentioned followers"

status.mentions.includes(:account).each do |mention|
mentioned_account = mention.account
next if !mentioned_account.local? || !mentioned_account.following?(status.account) || FeedManager.instance.filter?(:home, status, mention.account_id)
FeedManager.instance.push_to_home(mentioned_account, status)
end
end

def render_anonymous_payload(status)
@payload = InlineRenderer.render(status, nil, :status)
@payload = Oj.dump(event: :update, payload: @payload)
Expand Down Expand Up @@ -94,16 +81,6 @@ def deliver_to_media(status)
Redis.current.publish('timeline:public:local:media', @payload) if status.local?
end

def deliver_to_direct_timelines(status)
Rails.logger.debug "Delivering status #{status.id} to direct timelines"

status.mentions.includes(:account).each do |mention|
Redis.current.publish("timeline:direct:#{mention.account.id}", @payload) if mention.account.local?
end

Redis.current.publish("timeline:direct:#{status.account.id}", @payload) if status.account.local?
end

def deliver_to_own_conversation(status)
AccountConversation.add_status(status.account, status)
end
Expand Down

0 comments on commit 82f5c8a

Please sign in to comment.