Skip to content

Commit 39a7dfa

Browse files
authored
Merge pull request #62 from GetStream/fix-get-enriched-activities
fix: EnrichedActivity Not Returning Reactions
2 parents 655bbfe + 025a141 commit 39a7dfa

File tree

6 files changed

+109
-4
lines changed

6 files changed

+109
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ await client.flatFeed('user', 'ken').updateActivityToTargets('foreign_id:1234',
230230

231231
### Realtime (Faye)
232232

233-
Stream uses [Faye](http://faye.jcoglan.com) for realtime notifications. Below is quick guide to subscribing to feed changes
233+
Stream uses [Faye](https://faye.jcoglan.com) for realtime notifications. Below is quick guide to subscribing to feed changes
234234

235235
```dart
236236

packages/stream_feed/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
**🔗 Quick Links**
77

8-
- [Register](https://getstream.io/activity-feed/sdk/flutter/tutorial/) to get an API key for Stream Activity Feeds
9-
- [Stream Activity Feeds UI Kit](https://getstream.io/activity-feeds/ui-kit/)
8+
- [Register](https://getstream.io/activity-feeds/try-for-free) to get an API key for Stream Activity Feeds
9+
- [Tutorial](https://getstream.io/activity-feed/sdk/flutter/tutorial/) to learn how to setup a timeline feed, follow other feeds and post new activities.
10+
- [Stream Activity Feeds UI Kit](https://getstream.io/activity-feeds/ui-kit/) to jumpstart your design with notifications and social feeds
1011

1112
## 🛠 Installation
1213

@@ -239,7 +240,7 @@ final subscription = await userFeed.subscribe((message) => print(message));
239240
await subscription.cancel();
240241
```
241242

242-
Docs are available on [GetStream.io](http://getstream.io/docs/?language=dart).
243+
Docs are available on [GetStream.io](https://getstream.io/activity-feeds/docs/flutter-dart/?language=dart).
243244

244245
## 🔮 Example Project
245246

packages/stream_feed/lib/src/client/flat_feed.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class FlatFeed extends Feed {
119119
'offset': offset ?? Default.offset, //TODO:add session everywhere
120120
...filter?.params ?? Default.filter.params,
121121
...Default.marker.params,
122+
if (flags != null) ...flags.params,
122123
if (ranking != null) 'ranking': ranking,
123124
if (session != null) 'session': session,
124125
};
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"actor": {
3+
"created_at": "2021-04-13T22:53:19.670051Z",
4+
"updated_at": "2021-04-13T22:53:19.670051Z",
5+
"id": "eTHVBnEm0FQB2HeaRKVlEfVf58B3personal",
6+
"data": {
7+
"gender": "Male",
8+
"name": "Rickey Lee",
9+
"photo": "https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e"
10+
}
11+
},
12+
"foreign_id": "",
13+
"id": "d442580f-b4c3-11eb-8d9e-128a130028af",
14+
"latest_reactions": {
15+
"like": [
16+
{
17+
"created_at": "2021-05-14T14:51:13.998272Z",
18+
"updated_at": "2021-05-14T14:51:13.998272Z",
19+
"id": "c3b3be8a-ab90-42a9-b659-c46db1dab261",
20+
"user_id": "eTHVBnEm0FQB2HeaRKVlEfVf58B3personal",
21+
"user": {
22+
"created_at": "2021-04-13T22:53:19.670051Z",
23+
"updated_at": "2021-04-13T22:53:19.670051Z",
24+
"id": "eTHVBnEm0FQB2HeaRKVlEfVf58B3personal",
25+
"data": {
26+
"gender": "Male",
27+
"name": "Rickey Lee",
28+
"photo": "https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e"
29+
}
30+
},
31+
"kind": "like",
32+
"activity_id": "d442580f-b4c3-11eb-8d9e-128a130028af",
33+
"data": {},
34+
"parent": "",
35+
"latest_children": {},
36+
"children_counts": {}
37+
}
38+
]
39+
},
40+
"latest_reactions_extra": {
41+
"like": {
42+
"next": ""
43+
}
44+
},
45+
"message": "@Jessica check out getstream.io it's awesome!",
46+
"object": "tweet:id",
47+
"origin": null,
48+
"own_reactions": {
49+
"like": [
50+
{
51+
"created_at": "2021-05-14T14:51:13.998272Z",
52+
"updated_at": "2021-05-14T14:51:13.998272Z",
53+
"id": "c3b3be8a-ab90-42a9-b659-c46db1dab261",
54+
"user_id": "eTHVBnEm0FQB2HeaRKVlEfVf58B3personal",
55+
"user": {
56+
"created_at": "2021-04-13T22:53:19.670051Z",
57+
"updated_at": "2021-04-13T22:53:19.670051Z",
58+
"id": "eTHVBnEm0FQB2HeaRKVlEfVf58B3personal",
59+
"data": {
60+
"gender": "Male",
61+
"name": "Rickey Lee",
62+
"photo": "https://firebasestorage.googleapis.com/v0/b/fire-snab.appspot.com/o/profile-image-placeholder.png?alt=media&token=b17598bb-a510-4167-8354-ab75642ba89e"
63+
}
64+
},
65+
"kind": "like",
66+
"activity_id": "d442580f-b4c3-11eb-8d9e-128a130028af",
67+
"data": {},
68+
"parent": "",
69+
"latest_children": {},
70+
"children_counts": {}
71+
}
72+
]
73+
},
74+
"reaction_counts": {
75+
"like": 1
76+
},
77+
"target": "",
78+
"time": "2021-05-14T14:51:13.767221",
79+
"to": [
80+
"notification:Jessica"
81+
],
82+
"verb": "tweet"
83+
}

packages/stream_feed/test/flat_client_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ void main() {
158158
'offset': offset,
159159
...filter.params,
160160
...Default.marker.params,
161+
...flags.params,
161162
'ranking': ranking,
162163
};
163164

packages/stream_feed/test/models_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ import 'utils.dart';
1717

1818
void main() {
1919
group('EnrichmentFlags', () {
20+
test('combination', () {
21+
final flags = EnrichmentFlags()
22+
.withReactionCounts()
23+
.withOwnReactions()
24+
.withRecentReactions();
25+
expect(flags.params, {
26+
'with_reaction_counts': true,
27+
'with_own_reactions': true,
28+
'with_recent_reactions': true
29+
});
30+
});
2031
test('withOwnChildren', () {
2132
final withOwnChildren = EnrichmentFlags().withOwnChildren();
2233
expect(withOwnChildren.params, {'with_own_children': true});
@@ -113,6 +124,14 @@ void main() {
113124
});
114125
});
115126
});
127+
128+
test('EnrichedActivity issue 61', () {
129+
final enrichedActivity = EnrichedActivity.fromJson(
130+
jsonFixture('enriched_activity_issue61.json'));
131+
expect(enrichedActivity.latestReactions, isNotNull);
132+
expect(enrichedActivity.ownReactions, isNotNull);
133+
expect(enrichedActivity.reactionCounts, isNotNull);
134+
});
116135
test('EnrichedActivity', () {
117136
final reaction1 = Reaction(
118137
id: 'test',

0 commit comments

Comments
 (0)