summaryrefslogtreecommitdiffstats
path: root/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java')
-rw-r--r--gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java39
1 files changed, 31 insertions, 8 deletions
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
index 7f61977c38..4e710db053 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
@@ -20,6 +20,7 @@ import com.google.gerrit.client.changes.ChangeInfo.LabelInfo;
import com.google.gerrit.client.patches.AbstractPatchContentTable;
import com.google.gerrit.client.patches.CommentEditorContainer;
import com.google.gerrit.client.patches.CommentEditorPanel;
+import com.google.gerrit.client.projects.ConfigInfoCache;
import com.google.gerrit.client.rpc.CallbackGroup;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.rpc.Natives;
@@ -79,6 +80,7 @@ public class PublishCommentScreen extends AccountScreen implements
private boolean saveStateOnUnload = true;
private List<CommentEditorPanel> commentEditors;
private ChangeInfo change;
+ private CommentLinkProcessor commentLinkProcessor;
public PublishCommentScreen(final PatchSet.Id psi) {
patchSetId = psi;
@@ -149,8 +151,8 @@ public class PublishCommentScreen extends AccountScreen implements
super.onLoad();
CallbackGroup cbs = new CallbackGroup();
- ChangeApi.revision(patchSetId).view("review").get(cbs.add(
- new AsyncCallback<ChangeInfo>() {
+ ChangeApi.revision(patchSetId).view("review")
+ .get(cbs.add(new AsyncCallback<ChangeInfo>() {
@Override
public void onSuccess(ChangeInfo result) {
result.init();
@@ -167,7 +169,7 @@ public class PublishCommentScreen extends AccountScreen implements
@Override
protected void preDisplay(final PatchSetPublishDetail result) {
send.setEnabled(true);
- display(result);
+ PublishCommentScreen.this.preDisplay(result, this);
}
@Override
@@ -177,6 +179,24 @@ public class PublishCommentScreen extends AccountScreen implements
}));
}
+ private void preDisplay(final PatchSetPublishDetail pubDetail,
+ final ScreenLoadCallback<PatchSetPublishDetail> origCb) {
+ ConfigInfoCache.get(pubDetail.getChange().getProject(),
+ new AsyncCallback<ConfigInfoCache.Entry>() {
+ @Override
+ public void onSuccess(ConfigInfoCache.Entry result) {
+ commentLinkProcessor = result.getCommentLinkProcessor();
+ setTheme(result.getTheme());
+ display(pubDetail);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ origCb.onFailure(caught);
+ }
+ });
+ }
+
@Override
protected void onUnload() {
super.onUnload();
@@ -282,7 +302,7 @@ public class PublishCommentScreen extends AccountScreen implements
for (String value : values) {
ValueRadioButton b = new ValueRadioButton(label, value);
SafeHtml buf = new SafeHtmlBuilder().append(b.format());
- buf = CommentLinkProcessor.apply(buf);
+ buf = commentLinkProcessor.apply(buf);
SafeHtml.set(b, buf);
if (lastState != null && patchSetId.equals(lastState.patchSetId)
@@ -305,7 +325,7 @@ public class PublishCommentScreen extends AccountScreen implements
setPageTitle(Util.M.publishComments(r.getChange().getKey().abbreviate(),
patchSetId.get()));
descBlock.display(changeDetail, null, false, r.getPatchSetInfo(), r.getAccounts(),
- r.getSubmitTypeRecord());
+ r.getSubmitTypeRecord(), commentLinkProcessor);
if (r.getChange().getStatus().isOpen()) {
initApprovals(approvalPanel);
@@ -341,11 +361,14 @@ public class PublishCommentScreen extends AccountScreen implements
priorFile = fn;
}
- final CommentEditorPanel editor = new CommentEditorPanel(c);
+ final CommentEditorPanel editor =
+ new CommentEditorPanel(c, commentLinkProcessor);
if (c.getLine() == AbstractPatchContentTable.R_HEAD) {
- editor.setAuthorNameText(Util.C.fileCommentHeader());
+ editor.setAuthorNameText(Gerrit.getUserAccountInfo(),
+ Util.C.fileCommentHeader());
} else {
- editor.setAuthorNameText(Util.M.lineHeader(c.getLine()));
+ editor.setAuthorNameText(Gerrit.getUserAccountInfo(),
+ Util.M.lineHeader(c.getLine()));
}
editor.setOpen(true);
commentEditors.add(editor);