-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
The client.feed.addActivity's NewActivity parameter type allows actor to be an object
Lines 87 to 94 in bffb182
| export type NewActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = | |
| StreamFeedGenerics['activityType'] & | |
| BaseActivity & { | |
| actor: string | StreamUser; | |
| object: string | unknown; | |
| foreign_id?: string; | |
| time?: string; | |
| }; |
Here it allows the actor to be either a string or a StreamUser object
But when we try to update the activity, the client.updateActivity's activity parameter does not allow actor to be an object.
Lines 96 to 103 in bffb182
| export type UpdateActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = | |
| StreamFeedGenerics['activityType'] & | |
| BaseActivity & { | |
| actor: string; | |
| foreign_id: string; | |
| object: string | unknown; | |
| time: string; | |
| }; |
This is an issue because when we use client.feed.getActivity, the activities can be returned as enriched stream users. If we wish to update activities, we can not update the item directly
Sample code in text:
import {StreamClient} from 'getstream';
const client = new StreamClient('STREAM_KEY', 'STREAM_SECRET');
const data = await client.getActivities({ids: ['id1']});
const activities = data.results;
activities.forEach(activity => {
activity.title = 'Updated Title';
});
client.updateActivities(activities);Metadata
Metadata
Assignees
Labels
No labels