Notedb: Fix loading of draft comment refs
The draft comment refs are stored in the metadata repository, but the code tried to load them from the original repository. As result the loaded ref set was always empty (except when gerrit.noteDbPath was set to the same path as gerrit.basePath). Once draft comment refs were found the parsing of the Change ID's from the refs failed with a NumberFormatException. The new code scans only for draft comment refs of the author. This is more efficient than scanning all draft comment refs and then filtering out all draft comment refs that were not for the author. Due to these bugs when Notedb was enabled, the 'Reply' button on the ChangeScreen was not highlighted when there were draft comments on the change. Change-Id: I4e0906cc838cfad02aa43ab5fb8e46d0efe189c2 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -88,6 +88,17 @@ public class RefNames {
|
||||
|
||||
public static String refsDraftComments(Account.Id accountId,
|
||||
Change.Id changeId) {
|
||||
StringBuilder r = buildRefsDraftCommentsPrefix(accountId);
|
||||
r.append(changeId.get());
|
||||
return r.toString();
|
||||
}
|
||||
|
||||
public static String refsDraftCommentsPrefix(Account.Id accountId) {
|
||||
return buildRefsDraftCommentsPrefix(accountId).toString();
|
||||
}
|
||||
|
||||
public static StringBuilder buildRefsDraftCommentsPrefix(
|
||||
Account.Id accountId) {
|
||||
StringBuilder r = new StringBuilder();
|
||||
r.append(REFS_DRAFT_COMMENTS);
|
||||
int n = accountId.get() % 100;
|
||||
@@ -98,8 +109,7 @@ public class RefNames {
|
||||
r.append('/');
|
||||
r.append(accountId.get());
|
||||
r.append('-');
|
||||
r.append(changeId.get());
|
||||
return r.toString();
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user