Show commit message on the per-file review pages.
When reviewing changes the review may be interrupted for any number of reasons. When continuing the review process the review might have forgotten the content of the commit message. This change shows the commit message at the per-file review page. The area for the commit message is limited in order to preserve the space for the diff view(s). If the commit message doesn't fit into the commit message area a vertical/horizontal scrollbar will appear. The commit message for the patch set to the right side (the "new version") of the PatchScreen is cached to avoid one RPC every time the patch screen switches to next/prev file. Bug: issue 426 Bug: issue 680 Change-Id: I8db497e44cadab6be8895e1c477516d3b3b2d9c2 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com> Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
committed by
Shawn O. Pearce
parent
c25b07b89c
commit
9b218bc0ad
@@ -14,42 +14,29 @@
|
||||
|
||||
package com.google.gerrit.client.changes;
|
||||
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.ui.CommentLinkProcessor;
|
||||
import com.google.gerrit.common.data.AccountInfoCache;
|
||||
import com.google.gerrit.reviewdb.Change;
|
||||
import com.google.gerrit.reviewdb.PatchSetInfo;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwtexpui.safehtml.client.SafeHtml;
|
||||
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
|
||||
|
||||
public class ChangeDescriptionBlock extends Composite {
|
||||
private final ChangeInfoBlock infoBlock;
|
||||
private final HTML description;
|
||||
private final CommitMessageBlock messageBlock;
|
||||
|
||||
public ChangeDescriptionBlock() {
|
||||
infoBlock = new ChangeInfoBlock();
|
||||
description = new HTML();
|
||||
description.setStyleName(Gerrit.RESOURCES.css().changeScreenDescription());
|
||||
messageBlock = new CommitMessageBlock();
|
||||
|
||||
final HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.add(infoBlock);
|
||||
hp.add(description);
|
||||
hp.add(messageBlock);
|
||||
initWidget(hp);
|
||||
}
|
||||
|
||||
public void display(final Change chg, final PatchSetInfo info,
|
||||
final AccountInfoCache acc) {
|
||||
infoBlock.display(chg, acc);
|
||||
|
||||
SafeHtml msg = new SafeHtmlBuilder().append(info.getMessage());
|
||||
msg = msg.linkify();
|
||||
msg = CommentLinkProcessor.apply(msg);
|
||||
msg = new SafeHtmlBuilder().openElement("p").append(msg).closeElement("p");
|
||||
msg = msg.replaceAll("\n\n", "</p><p>");
|
||||
msg = msg.replaceAll("\n", "<br />");
|
||||
SafeHtml.set(description, msg);
|
||||
messageBlock.display(info.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user