Revert "Clean up comment experiment flags"

This reverts commit 0430b58f18.

Reason for revert: Breaks existing CI flows b/c of PS-level comments

Change-Id: I8b45988a05cacc553294e8e6ed802dd52eb1e96d
This commit is contained in:
Patrick Hiesel
2020-12-07 14:11:14 +00:00
parent be98d8c640
commit 5f000f8509
3 changed files with 29 additions and 15 deletions

View File

@@ -43,6 +43,7 @@ import {
ReviewerState,
SpecialFilePath,
} from '../../../constants/constants';
import {KnownExperimentId} from '../../../services/flags/flags';
import {fetchChangeUpdates} from '../../../utils/patch-set-util';
import {KeyboardShortcutMixin} from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin';
import {accountKey, removeServiceUsers} from '../../../utils/account-util';
@@ -379,6 +380,8 @@ export class GrReplyDialog extends KeyboardShortcutMixin(
};
}
_isPatchsetCommentsExperimentEnabled = false;
constructor() {
super();
this.filterReviewerSuggestion = this._filterReviewerSuggestionGenerator(
@@ -418,6 +421,9 @@ export class GrReplyDialog extends KeyboardShortcutMixin(
/** @override */
ready() {
super.ready();
this._isPatchsetCommentsExperimentEnabled = this.flagsService.isEnabled(
KnownExperimentId.PATCHSET_COMMENTS
);
this.$.jsAPI.addElement(TargetElement.REPLY_DIALOG, this);
}
@@ -680,13 +686,17 @@ export class GrReplyDialog extends KeyboardShortcutMixin(
}
if (this.draft) {
const comment: CommentInput = {
message: this.draft,
unresolved: !this._isResolvedPatchsetLevelComment,
};
reviewInput.comments = {
[SpecialFilePath.PATCHSET_LEVEL_COMMENTS]: [comment],
};
if (this._isPatchsetCommentsExperimentEnabled) {
const comment: CommentInput = {
message: this.draft,
unresolved: !this._isResolvedPatchsetLevelComment,
};
reviewInput.comments = {
[SpecialFilePath.PATCHSET_LEVEL_COMMENTS]: [comment],
};
} else {
reviewInput.message = this.draft;
}
}
const accountAdditions = new Map<AccountId | EmailAddress, boolean>();

View File

@@ -303,14 +303,16 @@ export const htmlTemplate = html`
</gr-endpoint-decorator>
</section>
<section class="previewContainer">
<label>
<input
id="resolvedPatchsetLevelCommentCheckbox"
type="checkbox"
checked="{{_isResolvedPatchsetLevelComment::change}}"
/>
Resolved
</label>
<template is="dom-if" if="[[_isPatchsetCommentsExperimentEnabled]]">
<label>
<input
id="resolvedPatchsetLevelCommentCheckbox"
type="checkbox"
checked="{{_isResolvedPatchsetLevelComment::change}}"
/>
Resolved
</label>
</template>
<label class="preview-formatting">
<input type="checkbox" checked="{{_previewFormatting::change}}" />
Preview formatting

View File

@@ -24,5 +24,7 @@ export interface FlagsService {
* @desc Experiment ids used in Gerrit.
*/
export enum KnownExperimentId {
PATCHSET_COMMENTS = 'UiFeature__patchset_comments',
PATCHSET_CHOICE_FOR_COMMENT_LINKS = 'UiFeature__patchset_choice_for_comment_links',
NEW_CONTEXT_CONTROLS = 'UiFeature__new_context_controls',
}