use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class PublishedBox method addReplyBox.
void addReplyBox(boolean quote) {
CommentInfo commentReply = CommentInfo.createReply(comment);
if (quote) {
commentReply.message(ReplyBox.quote(comment.message()));
}
getCommentManager().addDraftBox(displaySide, commentReply).setEdit(true);
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class Message method renderComments.
private void renderComments(List<CommentInfo> list) {
CommentLinkProcessor clp = history.getCommentLinkProcessor();
PatchSet.Id ps = new PatchSet.Id(history.getChangeId(), info._revisionNumber());
TreeMap<String, List<CommentInfo>> m = byPath(list);
List<CommentInfo> l = m.remove(Patch.COMMIT_MSG);
if (l != null) {
comments.add(new FileComments(clp, ps, Util.C.commitMessage(), l));
}
l = m.remove(Patch.MERGE_LIST);
if (l != null) {
comments.add(new FileComments(clp, ps, Util.C.mergeList(), l));
}
for (Map.Entry<String, List<CommentInfo>> e : m.entrySet()) {
comments.add(new FileComments(clp, ps, e.getKey(), e.getValue()));
}
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class History method comments.
private List<CommentInfo> comments(MessageInfo msg) {
if (msg.author() == null) {
return Collections.emptyList();
}
int authorId = msg.author()._accountId();
List<CommentInfo> list = byAuthor.get(authorId);
if (list == null) {
return Collections.emptyList();
}
Timestamp when = msg.date();
List<CommentInfo> match = new ArrayList<>();
List<CommentInfo> other = new ArrayList<>();
for (CommentInfo c : list) {
if (c.updated().compareTo(when) <= 0) {
match.add(c);
} else {
other.add(c);
}
}
if (match.isEmpty()) {
return Collections.emptyList();
} else if (other.isEmpty()) {
byAuthor.remove(authorId);
} else {
byAuthor.put(authorId, other);
}
return match;
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class History method addComments.
void addComments(NativeMap<JsArray<CommentInfo>> map) {
for (String path : map.keySet()) {
for (CommentInfo c : Natives.asList(map.get(path))) {
c.path(path);
if (c.author() != null) {
int authorId = c.author()._accountId();
List<CommentInfo> l = byAuthor.get(authorId);
if (l == null) {
l = new ArrayList<>();
byAuthor.put(authorId, l);
}
l.add(c);
}
}
}
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class LocalComments method getInlineComment.
private static InlineComment getInlineComment(String key) {
String path;
Side side = Side.PARENT;
int line = 0;
CommentRange range;
StorageBackend storage = new StorageBackend();
String[] elements = key.split("-");
int offset = 1;
if (key.startsWith("patchReply-") || key.startsWith("patchCommentEdit-")) {
offset = 2;
}
Change.Id changeId = new Change.Id(Integer.parseInt(elements[offset + 0]));
PatchSet.Id psId = new PatchSet.Id(changeId, Integer.parseInt(elements[offset + 1]));
path = atob(elements[offset + 2]);
side = (Side.PARENT.toString().equals(elements[offset + 3])) ? Side.PARENT : Side.REVISION;
range = null;
if (elements[offset + 4].startsWith("R")) {
String rangeStart = elements[offset + 4].substring(1);
String rangeEnd = elements[offset + 5];
String[] split = rangeStart.split(",");
int sl = Integer.parseInt(split[0]);
int sc = Integer.parseInt(split[1]);
split = rangeEnd.split(",");
int el = Integer.parseInt(split[0]);
int ec = Integer.parseInt(split[1]);
range = CommentRange.create(sl, sc, el, ec);
line = sl;
} else {
line = Integer.parseInt(elements[offset + 4]);
}
CommentInfo info = CommentInfo.create(path, side, line, range, false);
info.message(storage.getItem(key));
if (key.startsWith("patchReply-")) {
info.inReplyTo(elements[1]);
} else if (key.startsWith("patchCommentEdit-")) {
info.id(elements[1]);
}
InlineComment inlineComment = new InlineComment(psId, info);
return inlineComment;
}
Aggregations