Fix 'user followed you' notifications sometimes parsing as 'new recommended post' notifications
This commit is contained in:
parent
859431f012
commit
e319dc1988
@ -131,6 +131,9 @@ func (t *TweetResponse) ToTweetTroveAsNotifications(current_user_id UserID) (Twe
|
||||
}
|
||||
notification.UserID = current_user_id
|
||||
notification.SortIndex = entry.SortIndex
|
||||
|
||||
// Determine a notification type if there isn't one yet
|
||||
if notification.Type == 0 {
|
||||
if strings.Contains(entry.Content.Item.ClientEventInfo.Element, "replied") {
|
||||
notification.Type = NOTIFICATION_TYPE_REPLY
|
||||
} else if strings.Contains(entry.Content.Item.ClientEventInfo.Element, "recommended") {
|
||||
@ -147,6 +150,7 @@ func (t *TweetResponse) ToTweetTroveAsNotifications(current_user_id UserID) (Twe
|
||||
delete(ret.Notifications, notification.ID)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if strings.Contains(entry.Content.Item.ClientEventInfo.Element, "multiple") {
|
||||
notification.HasDetail = true
|
||||
|
@ -129,6 +129,10 @@ func TestParseNotificationsPage(t *testing.T) {
|
||||
assert.True(is_ok)
|
||||
assert.True(notif12.HasDetail)
|
||||
|
||||
notif13, is_ok := tweet_trove.Notifications["FDzeDIfVUAIAAAABiJONcrvLSfVQeHf9GlI"]
|
||||
assert.True(is_ok)
|
||||
assert.Equal(NOTIFICATION_TYPE_FOLLOW, notif13.Type)
|
||||
|
||||
// TODO: communities
|
||||
// notif12, is_ok := tweet_trove.Notifications["FDzeDIfVUAIAAAABiJONco_yJRHPBNsDH88"]
|
||||
// assert.True(is_ok)
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user