New comment from "Create Pull Request Suggestion" should probably be expanded by default (#6185)

Fixes #6170
This commit is contained in:
Alex Ross 2024-08-28 18:29:39 +02:00 коммит произвёл GitHub
Родитель a501657610
Коммит fe157bc6de
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -133,8 +133,9 @@ export const COMMENT_EXPAND_STATE_SETTING = 'commentExpandState';
export const COMMENT_EXPAND_STATE_COLLAPSE_VALUE = 'collapseAll';
export const COMMENT_EXPAND_STATE_EXPAND_VALUE = 'expandUnresolved';
export function getCommentCollapsibleState(thread: IReviewThread, expand?: boolean, currentUser?: string) {
if (thread.isResolved
|| (!thread.isOutdated && currentUser && (thread.comments[thread.comments.length - 1].user?.login === currentUser))) {
const isFromCurrent = (currentUser && (thread.comments[thread.comments.length - 1].user?.login === currentUser));
const isJustSuggestion = thread.comments.length === 1 && thread.comments[0].body.startsWith('```suggestion') && thread.comments[0].body.endsWith('```');
if (thread.isResolved || (!thread.isOutdated && isFromCurrent && !isJustSuggestion)) {
return vscode.CommentThreadCollapsibleState.Collapsed;
}
if (expand === undefined) {