Skip to content

Commit d0d48bf

Browse files
committed
feat(CommentView): Parse prepareAccountCommand
1 parent 3f960ef commit d0d48bf

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/parser/classes/comments/CommentView.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default class CommentView extends YTNode {
3434
public unlike_command?: NavigationEndpoint;
3535
public undislike_command?: NavigationEndpoint;
3636
public reply_command?: NavigationEndpoint;
37+
public prepare_account_command?: NavigationEndpoint;
3738

3839
public comment_id: string;
3940
public is_pinned: boolean;
@@ -117,12 +118,16 @@ export default class CommentView extends YTNode {
117118
this.is_disliked = toolbar_state.likeState === 'TOOLBAR_LIKE_STATE_DISLIKED';
118119
}
119120

120-
if (toolbar_surface && !Reflect.has(toolbar_surface, 'prepareAccountCommand')) {
121-
this.like_command = new NavigationEndpoint(toolbar_surface.likeCommand);
122-
this.dislike_command = new NavigationEndpoint(toolbar_surface.dislikeCommand);
123-
this.unlike_command = new NavigationEndpoint(toolbar_surface.unlikeCommand);
124-
this.undislike_command = new NavigationEndpoint(toolbar_surface.undislikeCommand);
125-
this.reply_command = new NavigationEndpoint(toolbar_surface.replyCommand);
121+
if (toolbar_surface) {
122+
if (!('prepareAccountCommand' in toolbar_surface)) {
123+
this.like_command = new NavigationEndpoint(toolbar_surface.likeCommand);
124+
this.dislike_command = new NavigationEndpoint(toolbar_surface.dislikeCommand);
125+
this.unlike_command = new NavigationEndpoint(toolbar_surface.unlikeCommand);
126+
this.undislike_command = new NavigationEndpoint(toolbar_surface.undislikeCommand);
127+
this.reply_command = new NavigationEndpoint(toolbar_surface.replyCommand);
128+
} else if ('prepareAccountCommand' in toolbar_surface) {
129+
this.prepare_account_command = new NavigationEndpoint(toolbar_surface.prepareAccountCommand);
130+
}
126131
}
127132
}
128133

0 commit comments

Comments
 (0)