Inline Patch.Key#getParentKey
This refactoring step was missed in I9087151a. Change-Id: Idb00e5917cde398c02295dd892182a165f41bb38
This commit is contained in:
@@ -118,13 +118,13 @@ public class CatServlet extends HttpServlet {
|
||||
}
|
||||
}
|
||||
|
||||
final Change.Id changeId = patchKey.getParentKey().changeId();
|
||||
final Change.Id changeId = patchKey.patchSetId().changeId();
|
||||
String revision;
|
||||
try {
|
||||
ChangeNotes notes = changeNotesFactory.createChecked(changeId);
|
||||
permissionBackend.currentUser().change(notes).check(ChangePermission.READ);
|
||||
projectCache.checkedGet(notes.getProjectName()).checkStatePermitsRead();
|
||||
if (patchKey.getParentKey().get() == 0) {
|
||||
if (patchKey.patchSetId().get() == 0) {
|
||||
// change edit
|
||||
Optional<ChangeEdit> edit = changeEditUtil.byChange(notes);
|
||||
if (edit.isPresent()) {
|
||||
@@ -134,7 +134,7 @@ public class CatServlet extends HttpServlet {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
PatchSet patchSet = psUtil.get(notes, patchKey.getParentKey());
|
||||
PatchSet patchSet = psUtil.get(notes, patchKey.patchSetId());
|
||||
if (patchSet == null) {
|
||||
rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
|
||||
@@ -64,10 +64,6 @@ public final class Patch {
|
||||
public abstract PatchSet.Id patchSetId();
|
||||
|
||||
public abstract String fileName();
|
||||
|
||||
public PatchSet.Id getParentKey() {
|
||||
return patchSetId();
|
||||
}
|
||||
}
|
||||
|
||||
/** Type of modification made to the file path. */
|
||||
|
||||
@@ -149,7 +149,7 @@ public final class PatchLineComment {
|
||||
}
|
||||
|
||||
public PatchSet.Id getPatchSetId() {
|
||||
return patchKey.getParentKey();
|
||||
return patchKey.patchSetId();
|
||||
}
|
||||
|
||||
public int getLine() {
|
||||
@@ -259,7 +259,7 @@ public final class PatchLineComment {
|
||||
public Comment asComment(String serverId) {
|
||||
Comment c =
|
||||
new Comment(
|
||||
new Comment.Key(uuid, patchKey.fileName(), patchKey.getParentKey().get()),
|
||||
new Comment.Key(uuid, patchKey.fileName(), patchKey.patchSetId().get()),
|
||||
author,
|
||||
writtenOn,
|
||||
side,
|
||||
|
||||
@@ -140,7 +140,7 @@ public class GetDiff implements RestReadView<FileResource> {
|
||||
|
||||
PatchScriptFactory psf;
|
||||
PatchSet basePatchSet = null;
|
||||
PatchSet.Id pId = resource.getPatchKey().getParentKey();
|
||||
PatchSet.Id pId = resource.getPatchKey().patchSetId();
|
||||
String fileName = resource.getPatchKey().fileName();
|
||||
ChangeNotes notes = resource.getRevision().getNotes();
|
||||
if (base != null) {
|
||||
@@ -204,11 +204,11 @@ public class GetDiff implements RestReadView<FileResource> {
|
||||
List<DiffWebLinkInfo> links =
|
||||
webLinks.getDiffLinks(
|
||||
state.getName(),
|
||||
resource.getPatchKey().getParentKey().changeId().get(),
|
||||
resource.getPatchKey().patchSetId().changeId().get(),
|
||||
basePatchSet != null ? basePatchSet.getId().get() : null,
|
||||
revA,
|
||||
MoreObjects.firstNonNull(ps.getOldName(), ps.getNewName()),
|
||||
resource.getPatchKey().getParentKey().get(),
|
||||
resource.getPatchKey().patchSetId().get(),
|
||||
revB,
|
||||
ps.getNewName());
|
||||
result.webLinks = links.isEmpty() ? null : links;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Reviewed {
|
||||
accountPatchReviewStore.call(
|
||||
s ->
|
||||
s.markReviewed(
|
||||
resource.getPatchKey().getParentKey(),
|
||||
resource.getPatchKey().patchSetId(),
|
||||
resource.getAccountId(),
|
||||
resource.getPatchKey().fileName()));
|
||||
return reviewFlagUpdated ? Response.created("") : Response.ok("");
|
||||
@@ -61,7 +61,7 @@ public class Reviewed {
|
||||
accountPatchReviewStore.run(
|
||||
s ->
|
||||
s.clearReviewed(
|
||||
resource.getPatchKey().getParentKey(),
|
||||
resource.getPatchKey().patchSetId(),
|
||||
resource.getAccountId(),
|
||||
resource.getPatchKey().fileName()));
|
||||
return Response.none();
|
||||
|
||||
Reference in New Issue
Block a user