Convert static PutDraftComment#side(Comment) method to method on Comment
Change-Id: I9c3956257f1187150d62a228d2ab91515960174d Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -59,6 +59,13 @@ public abstract class Comment {
|
||||
}
|
||||
}
|
||||
|
||||
public short side() {
|
||||
if (side == Side.PARENT) {
|
||||
return (short) (parent == null ? 0 : -parent.shortValue());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import static com.google.gerrit.server.PatchLineCommentsUtil.setCommentRevId;
|
||||
import static com.google.gerrit.server.change.PutDraftComment.side;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
@@ -119,7 +118,7 @@ public class CreateDraftComment implements RestModifyView<RevisionResource, Draf
|
||||
ChangeUtil.messageUUID(ctx.getDb())),
|
||||
line, ctx.getAccountId(), Url.decode(in.inReplyTo),
|
||||
ctx.getWhen());
|
||||
comment.setSide(side(in));
|
||||
comment.setSide(in.side());
|
||||
comment.setMessage(in.message.trim());
|
||||
comment.setRange(in.range);
|
||||
comment.setTag(in.tag);
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.google.gerrit.server.change;
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.gerrit.server.PatchLineCommentsUtil.setCommentRevId;
|
||||
import static com.google.gerrit.server.change.PutDraftComment.side;
|
||||
import static com.google.gerrit.server.notedb.ReviewerStateInternal.REVIEWER;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
|
||||
@@ -484,7 +483,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
}
|
||||
e.setStatus(PatchLineComment.Status.PUBLISHED);
|
||||
e.setWrittenOn(ctx.getWhen());
|
||||
e.setSide(side(c));
|
||||
e.setSide(c.side());
|
||||
setCommentRevId(e, patchListCache, ctx.getChange(), ps);
|
||||
e.setMessage(c.message);
|
||||
e.setTag(in.tag);
|
||||
|
||||
@@ -19,8 +19,6 @@ import static com.google.gerrit.server.PatchLineCommentsUtil.setCommentRevId;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
import com.google.gerrit.extensions.api.changes.DraftInput;
|
||||
import com.google.gerrit.extensions.client.Comment;
|
||||
import com.google.gerrit.extensions.client.Side;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
@@ -164,7 +162,7 @@ public class PutDraftComment implements RestModifyView<DraftCommentResource, Dra
|
||||
private static PatchLineComment update(PatchLineComment e, DraftInput in,
|
||||
Timestamp when) {
|
||||
if (in.side != null) {
|
||||
e.setSide(side(in));
|
||||
e.setSide(in.side());
|
||||
}
|
||||
if (in.inReplyTo != null) {
|
||||
e.setParentUuid(Url.decode(in.inReplyTo));
|
||||
@@ -181,11 +179,4 @@ public class PutDraftComment implements RestModifyView<DraftCommentResource, Dra
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
static short side(Comment c) {
|
||||
if (c.side == Side.PARENT) {
|
||||
return (short) (c.parent == null ? 0 : -c.parent.shortValue());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user