Convert gr-comment to typescript

The change converts the following files to typescript:

* elements/shared/gr-comment/gr-comment.ts

Change-Id: I34975acf43537d9317462eb721d64a82fd21b441
This commit is contained in:
Milutin Kristofic
2020-09-17 10:38:08 +02:00
parent 7172b95421
commit afae005caf
6 changed files with 524 additions and 382 deletions

View File

@@ -789,6 +789,9 @@ suite('gr-change-view tests', () => {
suite('_recomputeComments', () => {
setup(() => {
element._changeNum = '1';
element._change = {_number: '1'};
flushAsynchronousOperations();
// Fake computeDraftCount as its required for ChangeComments,
// see gr-comment-api#reloadDrafts.
sinon.stub(element.$.commentAPI, 'reloadDrafts')
@@ -927,7 +930,9 @@ suite('gr-change-view tests', () => {
rev4: {_number: 4, commit: {parents: []}},
},
current_revision: 'rev4',
_number: '1',
};
element._changeNum = '1';
element._commentThreads = THREADS;
const paperTabs = element.shadowRoot.querySelector('#primaryTabs');
MockInteractions.tap(paperTabs.querySelectorAll('paper-tab')[3]);

File diff suppressed because it is too large Load Diff

View File

@@ -3226,7 +3226,7 @@ export class GrRestApiInterface
commentID: UrlEncodedCommentId,
reason: string
) {
return this._getChangeURLAndSend({
return (this._getChangeURLAndSend({
changeNum,
method: HttpMethod.POST,
patchNum,
@@ -3234,7 +3234,7 @@ export class GrRestApiInterface
body: {reason},
parseResponse: true,
anonymizedEndpoint: '/comments/*/delete',
});
}) as unknown) as Promise<CommentInfo>;
}
/**

View File

@@ -25,7 +25,7 @@ export interface StorageLocation {
patchNum: PatchSetNum;
path: string;
line: number;
range: CommentRange;
range?: CommentRange;
}
export interface StorageObject {

View File

@@ -78,6 +78,7 @@ import {
GroupAuditEventInfo,
EncodedGroupId,
Base64FileContent,
UrlEncodedCommentId,
} from '../../../types/common';
import {ParsedChangeInfo} from '../../../elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser';
import {HttpMethod} from '../../../constants/constants';
@@ -604,6 +605,18 @@ export interface RestApiService {
label: string
): Promise<Response>;
deleteComment(
changeNum: ChangeNum,
patchNum: PatchSetNum,
commentID: UrlEncodedCommentId,
reason: string
): Promise<CommentInfo>;
deleteDiffDraft(
changeNum: ChangeNum,
patchNum: PatchSetNum,
draft: {id: UrlEncodedCommentId}
): Promise<Response>;
deleteChangeCommitMessage(
changeNum: ChangeNum,
messageId: ChangeMessageId

View File

@@ -1039,7 +1039,7 @@ export interface UserConfigInfo {
* The CommentInfo entity contains information about an inline comment.
* https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info
*/
export interface CommentInfo {
export interface CommentInfo extends CommentInput {
patch_set?: PatchSetNum;
id: UrlEncodedCommentId;
path?: string;
@@ -1047,9 +1047,9 @@ export interface CommentInfo {
parent?: number;
line?: number;
range?: CommentRange;
in_reply_to?: string;
in_reply_to?: UrlEncodedCommentId;
message?: string;
updated: string;
updated: Timestamp;
author?: AccountInfo;
tag?: string;
unresolved?: boolean;