# HG changeset patch # User nanaya # Date 1697468651 -32400 # Node ID 151bc6d97d397cc72a1bb6491a14c3c587efeee7 # Parent 43cbceac80abf321cf02579093fc538959734752 Include pinned tweet diff -r 43cbceac80ab -r 151bc6d97d39 app/lib/legit_client.rb --- a/app/lib/legit_client.rb Mon Jul 17 20:54:04 2023 +0900 +++ b/app/lib/legit_client.rb Tue Oct 17 00:04:11 2023 +0900 @@ -98,8 +98,15 @@ end def self.normalize_timeline(json, user_id) - json.find { |instruction| instruction['type'] == 'TimelineAddEntries' }['entries'] - .filter { |entry| entry['entryId'] =~ /\A(profile-conversation|tweet)-/ } + json + .reduce([]) do |acc, instruction| + case instruction['type'] + when 'TimelineAddEntries' then acc += instruction['entries'] + when 'TimelinePinEntry' then acc << instruction['entry'] + end + + acc + end.filter { |entry| entry['entryId'] =~ /\A(profile-conversation|tweet)-/ } .reduce([]) do |acc, entry| if entry['content']['entryType'] == 'TimelineTimelineItem' acc.push(entry['content'])