Merge "Support to delete a comment with 'NoteDbRewriter' in BatchUpdate"
This commit is contained in:
@@ -17,9 +17,11 @@ package com.google.gerrit.server.api.changes;
|
||||
import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
|
||||
|
||||
import com.google.gerrit.extensions.api.changes.CommentApi;
|
||||
import com.google.gerrit.extensions.api.changes.DeleteCommentInput;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.server.change.CommentResource;
|
||||
import com.google.gerrit.server.change.DeleteComment;
|
||||
import com.google.gerrit.server.change.GetComment;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
@@ -30,11 +32,14 @@ class CommentApiImpl implements CommentApi {
|
||||
}
|
||||
|
||||
private final GetComment getComment;
|
||||
private final DeleteComment deleteComment;
|
||||
private final CommentResource comment;
|
||||
|
||||
@Inject
|
||||
CommentApiImpl(GetComment getComment, @Assisted CommentResource comment) {
|
||||
CommentApiImpl(
|
||||
GetComment getComment, DeleteComment deleteComment, @Assisted CommentResource comment) {
|
||||
this.getComment = getComment;
|
||||
this.deleteComment = deleteComment;
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
@@ -46,4 +51,13 @@ class CommentApiImpl implements CommentApi {
|
||||
throw asRestApiException("Cannot retrieve comment", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommentInfo delete(DeleteCommentInput input) throws RestApiException {
|
||||
try {
|
||||
return deleteComment.apply(comment, input);
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot delete comment", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -16,9 +16,11 @@ package com.google.gerrit.server.api.changes;
|
||||
|
||||
import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
|
||||
|
||||
import com.google.gerrit.extensions.api.changes.DeleteCommentInput;
|
||||
import com.google.gerrit.extensions.api.changes.DraftApi;
|
||||
import com.google.gerrit.extensions.api.changes.DraftInput;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.restapi.NotImplementedException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.server.change.DeleteDraftComment;
|
||||
import com.google.gerrit.server.change.DraftCommentResource;
|
||||
@@ -75,4 +77,9 @@ class DraftApiImpl implements DraftApi {
|
||||
throw asRestApiException("Cannot delete draft", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommentInfo delete(DeleteCommentInput input) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user