Skip to content

Commit

Permalink
fix review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rschnekenbu committed Apr 24, 2023
1 parent 276b98a commit 830e637
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ export class CommentThreadWidget extends BaseWidget {
if (this._commentThread.comments && this._commentThread.comments.length) {
const onlyUnique = (value: Comment, index: number, self: Comment[]) => self.indexOf(value) === index;
const participantsList = this._commentThread.comments.filter(onlyUnique).map(comment => `@${comment.userName}`).join(', ');
const resolved = (this._commentThread.state === CommentThreadState.Resolved) ? '(Resolved)' : '(Unresolved)';
label = `Participants: ${participantsList} ${resolved}`;
const resolutionState = (this._commentThread.state === CommentThreadState.Resolved) ? '(Resolved)' : '(Unresolved)';
label = `Participants: ${participantsList} ${resolutionState}`;
} else {
label = 'Start discussion';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ export class CommentThreadImpl implements CommentThread, Disposable {
}

set state(newState: CommentThreadState | undefined) {
this._state = newState;
this.onDidChangeStateEmitter.fire(this._state);
if (this._state !== newState) {
this._state = newState;
this.onDidChangeStateEmitter.fire(this._state);
}
}

private readonly onDidChangeStateEmitter = new Emitter<CommentThreadState | undefined>();
Expand Down
14 changes: 8 additions & 6 deletions packages/plugin-ext/src/plugin/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,18 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
this._onDidUpdateCommentThread.fire();
}

private threadState?: theia.CommentThreadState;
private _state?: theia.CommentThreadState;

get state(): theia.CommentThreadState {
return this.threadState!;
return this._state!;
}

set state(newState: theia.CommentThreadState) {
this.threadState = newState;
this.modifications.state = newState;
this._onDidUpdateCommentThread.fire();
if (this._state !== newState) {
this._state = newState;
this.modifications.state = newState;
this._onDidUpdateCommentThread.fire();
}
}

private localDisposables: Disposable[];
Expand Down Expand Up @@ -372,7 +374,7 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
formattedModifications.collapseState = convertToCollapsibleState(this.collapseState);
}
if (modified('state')) {
formattedModifications.state = convertToState(this.threadState);
formattedModifications.state = convertToState(this._state);
}
if (modified('canReply')) {
formattedModifications.canReply = this.canReply;
Expand Down

0 comments on commit 830e637

Please sign in to comment.