-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
source
attribute of Suggestion
entity in `/api/v2/suggesti…
…ons` back to a string (#29108)
- Loading branch information
1 parent
1e0b0a3
commit 7ee93b7
Showing
6 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AccountSuggestions::Suggestion < ActiveModelSerializers::Model | ||
attributes :account, :source | ||
attributes :account, :sources | ||
|
||
delegate :id, to: :account, prefix: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters