Merge changes from topic 'draft-comments-highlighting'
* changes: Remove ListChangesOption.DRAFT_COMMENTS Remove draft comment icons from 'Patch Sets' drop-down panel Highlight 'Reply' button if there are draft comments on any patch set
This commit is contained in:
@@ -231,13 +231,6 @@ default. Optional fields are:
|
||||
`CURRENT_REVISION` or `ALL_REVISIONS` option is selected.
|
||||
--
|
||||
|
||||
[[draft_comments]]
|
||||
--
|
||||
* `DRAFT_COMMENTS`: include the `has_draft_comments` field for
|
||||
revisions. Only valid when the `CURRENT_REVISION` or `ALL_REVISIONS`
|
||||
option is selected.
|
||||
--
|
||||
|
||||
[[current-commit]]
|
||||
--
|
||||
* `CURRENT_COMMIT`: parse and output all header fields from the
|
||||
@@ -4198,9 +4191,6 @@ link:#list-changes[Query Changes].
|
||||
|===========================
|
||||
|Field Name ||Description
|
||||
|`draft` |not set if `false`|Whether the patch set is a draft.
|
||||
|`has_draft_comments` |not set if `false`|Whether the patch
|
||||
set has one or more draft comments by the calling user. Only set if
|
||||
link:#draft_comments[DRAFT_COMMENTS] option is requested.
|
||||
|`_number` ||The patch set number.
|
||||
|`created` ||
|
||||
The link:rest-api.html#timestamp[timestamp] of when the patch set was
|
||||
|
||||
@@ -408,9 +408,6 @@ The patch set drop-down list shows the list of patch sets and allows to
|
||||
switch between them. The patch sets are sorted in descending order so
|
||||
that the current patch set is always on top.
|
||||
|
||||
Patch sets that have unpublished draft comments are marked by a comment
|
||||
icon.
|
||||
|
||||
Draft patch sets are marked with `DRAFT`.
|
||||
|
||||
image::images/user-review-ui-change-screen-patch-set-list.png[width=800, link="images/user-review-ui-change-screen-patch-set-list.png"]
|
||||
|
||||
@@ -46,9 +46,6 @@ public enum ListChangesOption {
|
||||
/** Set the reviewed boolean for the caller. */
|
||||
REVIEWED(11),
|
||||
|
||||
/** Include draft comments for the caller. */
|
||||
DRAFT_COMMENTS(12),
|
||||
|
||||
/** Include download commands for the caller. */
|
||||
DOWNLOAD_COMMANDS(13),
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.Map;
|
||||
public class RevisionInfo {
|
||||
public transient boolean isCurrent;
|
||||
public Boolean draft;
|
||||
public Boolean hasDraftComments;
|
||||
public int _number;
|
||||
public Timestamp created;
|
||||
public AccountInfo uploader;
|
||||
|
||||
@@ -33,7 +33,6 @@ interface ChangeConstants extends Constants {
|
||||
String date();
|
||||
String author();
|
||||
String draft();
|
||||
String draftCommentsTooltip();
|
||||
|
||||
String notAvailable();
|
||||
String relatedChanges();
|
||||
|
||||
@@ -14,7 +14,6 @@ commit = Commit
|
||||
date = Date
|
||||
author = Author / Committer
|
||||
draft = (DRAFT)
|
||||
draftCommentsTooltip = Draft comment(s) inside
|
||||
|
||||
notAvailable = N/A
|
||||
relatedChanges = Related Changes
|
||||
|
||||
@@ -96,6 +96,7 @@ import net.codemirror.lib.CodeMirror;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
@@ -223,6 +224,18 @@ public class ChangeScreen extends Screen {
|
||||
super.onLoad();
|
||||
CallbackGroup group = new CallbackGroup();
|
||||
if (Gerrit.isSignedIn()) {
|
||||
ChangeList.query("change:" + changeId.get() + " has:draft",
|
||||
Collections.<ListChangesOption> emptySet(),
|
||||
group.add(new AsyncCallback<ChangeList>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeList result) {
|
||||
hasDraftComments = result.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
}));
|
||||
ChangeApi.editWithFiles(changeId.get(), group.add(
|
||||
new AsyncCallback<EditInfo>() {
|
||||
@Override
|
||||
@@ -957,7 +970,6 @@ public class ChangeScreen extends Screen {
|
||||
@Override
|
||||
public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
|
||||
r.add(result);
|
||||
hasDraftComments = !result.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.ImageResourceRenderer;
|
||||
import com.google.gwt.user.client.ui.PopupPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
|
||||
@@ -122,8 +121,7 @@ class PatchSetsBox extends Composite {
|
||||
RestApi call = ChangeApi.detail(changeId.get());
|
||||
ChangeList.addOptions(call, EnumSet.of(
|
||||
ListChangesOption.ALL_COMMITS,
|
||||
ListChangesOption.ALL_REVISIONS,
|
||||
ListChangesOption.DRAFT_COMMENTS));
|
||||
ListChangesOption.ALL_REVISIONS));
|
||||
call.get(new AsyncCallback<ChangeInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo result) {
|
||||
@@ -187,15 +185,6 @@ class PatchSetsBox extends Composite {
|
||||
if (r.draft()) {
|
||||
sb.append(Resources.C.draft()).append(' ');
|
||||
}
|
||||
if (r.hasDraftComments()) {
|
||||
sb.openSpan()
|
||||
.addStyleName(style.draft_comment())
|
||||
.setAttribute("title", Resources.C.draftCommentsTooltip())
|
||||
.append(new ImageResourceRenderer()
|
||||
.render(Gerrit.RESOURCES.draftComments()))
|
||||
.closeSpan()
|
||||
.append(' ');
|
||||
}
|
||||
sb.append(r.id());
|
||||
sb.closeTd();
|
||||
|
||||
|
||||
@@ -307,7 +307,6 @@ public class ChangeInfo extends JavaScriptObject {
|
||||
public final native int _number() /*-{ return this._number; }-*/;
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
public final native boolean draft() /*-{ return this.draft || false; }-*/;
|
||||
public final native boolean hasDraftComments() /*-{ return this.has_draft_comments || false; }-*/;
|
||||
public final native boolean isEdit() /*-{ return this._number == 0; }-*/;
|
||||
public final native CommitInfo commit() /*-{ return this.commit; }-*/;
|
||||
public final native void setCommit(CommitInfo c) /*-{ this.commit = c; }-*/;
|
||||
|
||||
@@ -27,7 +27,6 @@ import static com.google.gerrit.extensions.client.ListChangesOption.CURRENT_REVI
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_ACCOUNTS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DOWNLOAD_COMMANDS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.DRAFT_COMMENTS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.LABELS;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.MESSAGES;
|
||||
import static com.google.gerrit.extensions.client.ListChangesOption.REVIEWED;
|
||||
@@ -86,7 +85,6 @@ import com.google.gerrit.server.AnonymousUser;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.PatchLineCommentsUtil;
|
||||
import com.google.gerrit.server.WebLinks;
|
||||
import com.google.gerrit.server.account.AccountLoader;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
@@ -141,7 +139,6 @@ public class ChangeJson {
|
||||
private final WebLinks webLinks;
|
||||
private final EnumSet<ListChangesOption> options;
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final PatchLineCommentsUtil plcUtil;
|
||||
private final Provider<ConsistencyChecker> checkerProvider;
|
||||
private final ActionJson actionJson;
|
||||
private final RebaseChange rebaseChange;
|
||||
@@ -166,7 +163,6 @@ public class ChangeJson {
|
||||
DynamicMap<DownloadCommand> downloadCommands,
|
||||
WebLinks webLinks,
|
||||
ChangeMessagesUtil cmUtil,
|
||||
PatchLineCommentsUtil plcUtil,
|
||||
Provider<ConsistencyChecker> checkerProvider,
|
||||
ActionJson actionJson,
|
||||
RebaseChange rebaseChange) {
|
||||
@@ -185,7 +181,6 @@ public class ChangeJson {
|
||||
this.downloadCommands = downloadCommands;
|
||||
this.webLinks = webLinks;
|
||||
this.cmUtil = cmUtil;
|
||||
this.plcUtil = plcUtil;
|
||||
this.checkerProvider = checkerProvider;
|
||||
this.actionJson = actionJson;
|
||||
this.rebaseChange = rebaseChange;
|
||||
@@ -881,15 +876,6 @@ public class ChangeJson {
|
||||
new RevisionResource(new ChangeResource(ctl, rebaseChange), in));
|
||||
}
|
||||
|
||||
if (has(DRAFT_COMMENTS)
|
||||
&& userProvider.get().isIdentifiedUser()) {
|
||||
IdentifiedUser user = (IdentifiedUser)userProvider.get();
|
||||
out.hasDraftComments =
|
||||
plcUtil.draftByPatchSetAuthor(db.get(), in.getId(),
|
||||
user.getAccountId(), ctl.getNotes()).iterator().hasNext()
|
||||
? true
|
||||
: null;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user