Skip to content

Commit

Permalink
feat(CommentView): Parse prepareAccountCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Feb 5, 2025
1 parent 3f960ef commit d0d48bf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/parser/classes/comments/CommentView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class CommentView extends YTNode {
public unlike_command?: NavigationEndpoint;
public undislike_command?: NavigationEndpoint;
public reply_command?: NavigationEndpoint;
public prepare_account_command?: NavigationEndpoint;

public comment_id: string;
public is_pinned: boolean;
Expand Down Expand Up @@ -117,12 +118,16 @@ export default class CommentView extends YTNode {
this.is_disliked = toolbar_state.likeState === 'TOOLBAR_LIKE_STATE_DISLIKED';
}

if (toolbar_surface && !Reflect.has(toolbar_surface, 'prepareAccountCommand')) {
this.like_command = new NavigationEndpoint(toolbar_surface.likeCommand);
this.dislike_command = new NavigationEndpoint(toolbar_surface.dislikeCommand);
this.unlike_command = new NavigationEndpoint(toolbar_surface.unlikeCommand);
this.undislike_command = new NavigationEndpoint(toolbar_surface.undislikeCommand);
this.reply_command = new NavigationEndpoint(toolbar_surface.replyCommand);
if (toolbar_surface) {
if (!('prepareAccountCommand' in toolbar_surface)) {
this.like_command = new NavigationEndpoint(toolbar_surface.likeCommand);
this.dislike_command = new NavigationEndpoint(toolbar_surface.dislikeCommand);
this.unlike_command = new NavigationEndpoint(toolbar_surface.unlikeCommand);
this.undislike_command = new NavigationEndpoint(toolbar_surface.undislikeCommand);
this.reply_command = new NavigationEndpoint(toolbar_surface.replyCommand);
} else if ('prepareAccountCommand' in toolbar_surface) {
this.prepare_account_command = new NavigationEndpoint(toolbar_surface.prepareAccountCommand);
}
}
}

Expand Down

0 comments on commit d0d48bf

Please sign in to comment.