0
0
Fork 0

Change source attribute of Suggestion entity in /api/v2/suggestions back to a string (#29108)

This commit is contained in:
Claire 2024-02-06 18:10:17 +01:00 committed by GitHub
parent 1e0b0a3486
commit 7ee93b7431
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 41 additions and 10 deletions

View file

@ -1,7 +1,20 @@
# frozen_string_literal: true
class REST::SuggestionSerializer < ActiveModel::Serializer
attributes :source
attributes :source, :sources
has_one :account, serializer: REST::AccountSerializer
LEGACY_SOURCE_TYPE_MAP = {
featured: 'staff',
most_followed: 'global',
most_interactions: 'global',
# NOTE: Those are not completely accurate, but those are personalized interactions
similar_to_recently_followed: 'past_interactions',
friends_of_friends: 'past_interactions',
}.freeze
def source
LEGACY_SOURCE_TYPE_MAP[object.sources.first]
end
end