Skip to content

Commit

Permalink
bulk follows and fof
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomchak committed Dec 22, 2023
1 parent 3a2ba85 commit 5162acc
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions app/lib/mammoth/status_origin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@ class NotFound < StandardError; end
MAX_ITEMS = 1000

# Add Trending Follows and Reason
def add_trending_follows(status, user)
list_key = key(user[:acct], status[:id])
reason = trending_follow_reason(status)

add_reason(list_key, status[:id], reason)
def bulk_add_trending_follows(statuses, user)
reasons = statuses.map do |s|
list_key = key(user[:acct], s[:id])
reason = trending_follow_reason(s)
{key: list_key, id: s[:id], reason: reason}
end
bulk_reasons(reasons)
end

# Add FOF and Reason to list
def add_friends_of_friends(status, user)
list_key = key(user[:acct], status[:id])
reason = trending_fof_reason(status)

add_reason(list_key, status[:id], reason)
end

# Add Status and Reason to list
def add_channel(status, user, channel)
list_key = key(user[:acct], status[:id])
reason = channel_reason(status, channel)

add_reason(list_key, status[:id], reason)
def bulk_add_friends_of_friends(statuses, user)
reasons = statuses.map do |s|
list_key = key(user[:acct], s[:id])
reason = trending_fof_reason(s)
{key: list_key, id: s[:id], reason: reason}
end
bulk_reasons(reasons)
end

def bulk_add_channel(statuses, user, channel)
Expand All @@ -43,15 +39,7 @@ def bulk_add_channel(statuses, user, channel)
end
bulk_reasons(reasons)
end

# Add MammothPick and Reason to list
def add_mammoth_pick(status, user)
list_key = key(user[:acct], status[:id])
reason = mammoth_pick_reason(status)

add_reason(list_key, status[:id], reason)
end


# Array of statuses
def bulk_add_mammoth_pick(statuses, user)
reasons = statuses.map do |s|
Expand Down

0 comments on commit 5162acc

Please sign in to comment.