Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle file uri in CommentAuthorInformation.iconPath (fix #174690) #175361

Merged
merged 4 commits into from Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vs/editor/common/languages.ts
Expand Up @@ -1664,7 +1664,7 @@ export interface Comment {
readonly uniqueIdInThread: number;
readonly body: string | IMarkdownString;
readonly userName: string;
readonly userIconPath?: string;
readonly userIconPath?: UriComponents;
readonly contextValue?: string;
readonly commentReactions?: CommentReaction[];
readonly label?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHost.protocol.ts
Expand Up @@ -112,7 +112,7 @@ export interface CommentChanges {
readonly uniqueIdInThread: number;
readonly body: string | IMarkdownString;
readonly userName: string;
readonly userIconPath?: string;
readonly userIconPath?: UriComponents;
readonly contextValue?: string;
readonly commentReactions?: languages.CommentReaction[];
readonly label?: string;
Expand Down
4 changes: 1 addition & 3 deletions src/vs/workbench/api/common/extHostComments.ts
Expand Up @@ -651,15 +651,13 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
commentsMap.set(vscodeComment, commentUniqueId);
}

const iconPath = vscodeComment.author && vscodeComment.author.iconPath ? vscodeComment.author.iconPath.toString() : undefined;

return {
mode: vscodeComment.mode,
contextValue: vscodeComment.contextValue,
uniqueIdInThread: commentUniqueId,
body: (typeof vscodeComment.body === 'string') ? vscodeComment.body : extHostTypeConverter.MarkdownString.from(vscodeComment.body),
userName: vscodeComment.author.name,
userIconPath: iconPath,
userIconPath: vscodeComment.author.iconPath,
label: vscodeComment.label,
commentReactions: vscodeComment.reactions ? vscodeComment.reactions.map(reaction => convertToReaction(reaction)) : undefined,
timestamp: vscodeComment.timestamp?.toJSON()
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/contrib/comments/browser/commentNode.ts
Expand Up @@ -45,6 +45,7 @@ import { Scrollable, ScrollbarVisibility } from 'vs/base/common/scrollable';
import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { DomEmitter } from 'vs/base/browser/event';
import { CommentContextKeys } from 'vs/workbench/contrib/comments/common/commentContextKeys';
import { FileAccess } from 'vs/base/common/network';

export class CommentNode<T extends IRange | ICellRange> extends Disposable {
private _domNode: HTMLElement;
Expand Down Expand Up @@ -116,7 +117,7 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
const avatar = dom.append(this._domNode, dom.$('div.avatar-container'));
if (comment.userIconPath) {
const img = <HTMLImageElement>dom.append(avatar, dom.$('img.avatar'));
img.src = comment.userIconPath.toString();
img.src = FileAccess.uriToBrowserUri(URI.from(comment.userIconPath)).toString(true);
alexr00 marked this conversation as resolved.
Show resolved Hide resolved
img.onerror = _ => img.remove();
}
this._commentDetailsContainer = dom.append(this._domNode, dom.$('.review-comment-contents'));
Expand Down