Skip to content

Commit 7d57f2d

Browse files
Post-merge changes
1 parent 03f0850 commit 7d57f2d

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

packages/feeds-client/src/feed/event-handlers/follow/handle-follow-deleted.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ import type {
66
UpdateStateResult,
77
} from '../../../types-internal';
88

9-
import { isFeedResponse } from '../../../utils';
109
import { getStateUpdateQueueId, shouldUpdateState } from '../../../utils';
1110

1211
export const updateStateFollowDeleted = (
13-
follow:
14-
| FollowResponse
15-
| { source_feed: { fid: string }; target_feed: { fid: string } },
12+
follow: FollowResponse,
1613
currentState: FeedState,
1714
currentFeedId: string,
1815
connectedUserId?: string,
@@ -46,7 +43,6 @@ export const updateStateFollowDeleted = (
4643
};
4744

4845
if (
49-
isFeedResponse(source) &&
5046
source.created_by.id === connectedUserId &&
5147
currentState.own_follows !== undefined
5248
) {
@@ -68,11 +64,10 @@ export const updateStateFollowDeleted = (
6864

6965
export function handleFollowDeleted(
7066
this: Feed,
71-
eventOrResponse:
72-
| PartializeAllBut<EventPayload<'feeds.follow.deleted'>, 'follow'>
73-
| {
74-
follow: { source_feed: { fid: string }; target_feed: { fid: string } };
75-
},
67+
eventOrResponse: PartializeAllBut<
68+
EventPayload<'feeds.follow.deleted'>,
69+
'follow'
70+
>,
7671
) {
7772
const follow = eventOrResponse.follow;
7873

packages/feeds-client/src/feeds-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ export class FeedsClient extends FeedsApi {
419419
[request.source, request.target].forEach((fid) => {
420420
const feed = this.activeFeeds[fid];
421421
if (feed) {
422-
handleFollowDeleted.bind(this)(response.follow);
422+
handleFollowDeleted.bind(feed)(response);
423423
}
424424
});
425425

packages/feeds-client/src/utils/type-assertions.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import { CommentResponse, FeedResponse, FollowResponse } from '../gen/models';
1+
import { CommentResponse, FollowResponse } from '../gen/models';
22
import { StreamFile } from '../types';
33
import { CommentParent } from '../types';
44

55
export const isFollowResponse = (data: object): data is FollowResponse => {
66
return 'source_feed' in data && 'target_feed' in data;
77
};
88

9-
export const isFeedResponse = (data: object): data is FeedResponse => {
10-
return 'created_by' in data;
11-
};
12-
139
export const isCommentResponse = (
1410
entity: CommentParent,
1511
): entity is CommentResponse => {

0 commit comments

Comments
 (0)