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.
|
`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]]
|
||||||
--
|
--
|
||||||
* `CURRENT_COMMIT`: parse and output all header fields from the
|
* `CURRENT_COMMIT`: parse and output all header fields from the
|
||||||
@@ -4198,9 +4191,6 @@ link:#list-changes[Query Changes].
|
|||||||
|===========================
|
|===========================
|
||||||
|Field Name ||Description
|
|Field Name ||Description
|
||||||
|`draft` |not set if `false`|Whether the patch set is a draft.
|
|`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.
|
|`_number` ||The patch set number.
|
||||||
|`created` ||
|
|`created` ||
|
||||||
The link:rest-api.html#timestamp[timestamp] of when the patch set was
|
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
|
switch between them. The patch sets are sorted in descending order so
|
||||||
that the current patch set is always on top.
|
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`.
|
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"]
|
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. */
|
/** Set the reviewed boolean for the caller. */
|
||||||
REVIEWED(11),
|
REVIEWED(11),
|
||||||
|
|
||||||
/** Include draft comments for the caller. */
|
|
||||||
DRAFT_COMMENTS(12),
|
|
||||||
|
|
||||||
/** Include download commands for the caller. */
|
/** Include download commands for the caller. */
|
||||||
DOWNLOAD_COMMANDS(13),
|
DOWNLOAD_COMMANDS(13),
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import java.util.Map;
|
|||||||
public class RevisionInfo {
|
public class RevisionInfo {
|
||||||
public transient boolean isCurrent;
|
public transient boolean isCurrent;
|
||||||
public Boolean draft;
|
public Boolean draft;
|
||||||
public Boolean hasDraftComments;
|
|
||||||
public int _number;
|
public int _number;
|
||||||
public Timestamp created;
|
public Timestamp created;
|
||||||
public AccountInfo uploader;
|
public AccountInfo uploader;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ interface ChangeConstants extends Constants {
|
|||||||
String date();
|
String date();
|
||||||
String author();
|
String author();
|
||||||
String draft();
|
String draft();
|
||||||
String draftCommentsTooltip();
|
|
||||||
|
|
||||||
String notAvailable();
|
String notAvailable();
|
||||||
String relatedChanges();
|
String relatedChanges();
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ commit = Commit
|
|||||||
date = Date
|
date = Date
|
||||||
author = Author / Committer
|
author = Author / Committer
|
||||||
draft = (DRAFT)
|
draft = (DRAFT)
|
||||||
draftCommentsTooltip = Draft comment(s) inside
|
|
||||||
|
|
||||||
notAvailable = N/A
|
notAvailable = N/A
|
||||||
relatedChanges = Related Changes
|
relatedChanges = Related Changes
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ import net.codemirror.lib.CodeMirror;
|
|||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -223,6 +224,18 @@ public class ChangeScreen extends Screen {
|
|||||||
super.onLoad();
|
super.onLoad();
|
||||||
CallbackGroup group = new CallbackGroup();
|
CallbackGroup group = new CallbackGroup();
|
||||||
if (Gerrit.isSignedIn()) {
|
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(
|
ChangeApi.editWithFiles(changeId.get(), group.add(
|
||||||
new AsyncCallback<EditInfo>() {
|
new AsyncCallback<EditInfo>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -957,7 +970,6 @@ public class ChangeScreen extends Screen {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
|
public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
|
||||||
r.add(result);
|
r.add(result);
|
||||||
hasDraftComments = !result.isEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
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.PopupPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
|
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
|
||||||
@@ -122,8 +121,7 @@ class PatchSetsBox extends Composite {
|
|||||||
RestApi call = ChangeApi.detail(changeId.get());
|
RestApi call = ChangeApi.detail(changeId.get());
|
||||||
ChangeList.addOptions(call, EnumSet.of(
|
ChangeList.addOptions(call, EnumSet.of(
|
||||||
ListChangesOption.ALL_COMMITS,
|
ListChangesOption.ALL_COMMITS,
|
||||||
ListChangesOption.ALL_REVISIONS,
|
ListChangesOption.ALL_REVISIONS));
|
||||||
ListChangesOption.DRAFT_COMMENTS));
|
|
||||||
call.get(new AsyncCallback<ChangeInfo>() {
|
call.get(new AsyncCallback<ChangeInfo>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ChangeInfo result) {
|
public void onSuccess(ChangeInfo result) {
|
||||||
@@ -187,15 +185,6 @@ class PatchSetsBox extends Composite {
|
|||||||
if (r.draft()) {
|
if (r.draft()) {
|
||||||
sb.append(Resources.C.draft()).append(' ');
|
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.append(r.id());
|
||||||
sb.closeTd();
|
sb.closeTd();
|
||||||
|
|
||||||
|
|||||||
@@ -307,7 +307,6 @@ public class ChangeInfo extends JavaScriptObject {
|
|||||||
public final native int _number() /*-{ return this._number; }-*/;
|
public final native int _number() /*-{ return this._number; }-*/;
|
||||||
public final native String name() /*-{ return this.name; }-*/;
|
public final native String name() /*-{ return this.name; }-*/;
|
||||||
public final native boolean draft() /*-{ return this.draft || false; }-*/;
|
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 boolean isEdit() /*-{ return this._number == 0; }-*/;
|
||||||
public final native CommitInfo commit() /*-{ return this.commit; }-*/;
|
public final native CommitInfo commit() /*-{ return this.commit; }-*/;
|
||||||
public final native void setCommit(CommitInfo c) /*-{ this.commit = c; }-*/;
|
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_ACCOUNTS;
|
||||||
import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS;
|
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.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.LABELS;
|
||||||
import static com.google.gerrit.extensions.client.ListChangesOption.MESSAGES;
|
import static com.google.gerrit.extensions.client.ListChangesOption.MESSAGES;
|
||||||
import static com.google.gerrit.extensions.client.ListChangesOption.REVIEWED;
|
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.ChangeMessagesUtil;
|
||||||
import com.google.gerrit.server.CurrentUser;
|
import com.google.gerrit.server.CurrentUser;
|
||||||
import com.google.gerrit.server.IdentifiedUser;
|
import com.google.gerrit.server.IdentifiedUser;
|
||||||
import com.google.gerrit.server.PatchLineCommentsUtil;
|
|
||||||
import com.google.gerrit.server.WebLinks;
|
import com.google.gerrit.server.WebLinks;
|
||||||
import com.google.gerrit.server.account.AccountLoader;
|
import com.google.gerrit.server.account.AccountLoader;
|
||||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||||
@@ -141,7 +139,6 @@ public class ChangeJson {
|
|||||||
private final WebLinks webLinks;
|
private final WebLinks webLinks;
|
||||||
private final EnumSet<ListChangesOption> options;
|
private final EnumSet<ListChangesOption> options;
|
||||||
private final ChangeMessagesUtil cmUtil;
|
private final ChangeMessagesUtil cmUtil;
|
||||||
private final PatchLineCommentsUtil plcUtil;
|
|
||||||
private final Provider<ConsistencyChecker> checkerProvider;
|
private final Provider<ConsistencyChecker> checkerProvider;
|
||||||
private final ActionJson actionJson;
|
private final ActionJson actionJson;
|
||||||
private final RebaseChange rebaseChange;
|
private final RebaseChange rebaseChange;
|
||||||
@@ -166,7 +163,6 @@ public class ChangeJson {
|
|||||||
DynamicMap<DownloadCommand> downloadCommands,
|
DynamicMap<DownloadCommand> downloadCommands,
|
||||||
WebLinks webLinks,
|
WebLinks webLinks,
|
||||||
ChangeMessagesUtil cmUtil,
|
ChangeMessagesUtil cmUtil,
|
||||||
PatchLineCommentsUtil plcUtil,
|
|
||||||
Provider<ConsistencyChecker> checkerProvider,
|
Provider<ConsistencyChecker> checkerProvider,
|
||||||
ActionJson actionJson,
|
ActionJson actionJson,
|
||||||
RebaseChange rebaseChange) {
|
RebaseChange rebaseChange) {
|
||||||
@@ -185,7 +181,6 @@ public class ChangeJson {
|
|||||||
this.downloadCommands = downloadCommands;
|
this.downloadCommands = downloadCommands;
|
||||||
this.webLinks = webLinks;
|
this.webLinks = webLinks;
|
||||||
this.cmUtil = cmUtil;
|
this.cmUtil = cmUtil;
|
||||||
this.plcUtil = plcUtil;
|
|
||||||
this.checkerProvider = checkerProvider;
|
this.checkerProvider = checkerProvider;
|
||||||
this.actionJson = actionJson;
|
this.actionJson = actionJson;
|
||||||
this.rebaseChange = rebaseChange;
|
this.rebaseChange = rebaseChange;
|
||||||
@@ -881,15 +876,6 @@ public class ChangeJson {
|
|||||||
new RevisionResource(new ChangeResource(ctl, rebaseChange), in));
|
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;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user