Merge "Apply comment link processing to approval values"

This commit is contained in:
Shawn Pearce
2012-11-28 11:33:38 -08:00
committed by Gerrit Code Review
3 changed files with 13 additions and 3 deletions

View File

@@ -850,6 +850,10 @@ The new column will appear at the end of the table (in position 3),
and `-1 Do not have copyright` will block submit, while `+1 Copyright
clear` is required to enable submit.
link:config-gerrit.html#commentlink[Comment link] processing is applied to the
text description of the approval categories (the `name` column). This can be
used to display HTML links in the approval category value descriptions.
[[restart_changes]]
[NOTE]
Restart the Gerrit web application and reload all browsers after

View File

@@ -695,8 +695,9 @@ By default this is false (test is not enabled).
[[commentlink]]Section commentlink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Comment links are find/replace strings applied to change descriptions,
patch comments, and in-line code comments to turn set strings into
hyperlinks. One common use is for linking to bug-tracking systems.
patch comments, in-line code comments and approval category value descriptions
to turn set strings into hyperlinks. One common use is for linking to
bug-tracking systems.
In the following example configuration the 'changeid' comment link
will match typical Gerrit Change-Id values and create a hyperlink

View File

@@ -22,6 +22,7 @@ import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.rpc.RestApi;
import com.google.gerrit.client.rpc.ScreenLoadCallback;
import com.google.gerrit.client.ui.AccountScreen;
import com.google.gerrit.client.ui.CommentLinkProcessor;
import com.google.gerrit.client.ui.PatchLink;
import com.google.gerrit.client.ui.SmallHeading;
import com.google.gerrit.common.PageLinks;
@@ -48,6 +49,8 @@ import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwtexpui.globalkey.client.NpTextArea;
import com.google.gwtexpui.safehtml.client.SafeHtml;
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
import com.google.gwtjsonrpc.common.VoidResult;
import java.util.ArrayList;
@@ -254,7 +257,9 @@ public class PublishCommentScreen extends AccountScreen implements
}
ValueRadioButton b = new ValueRadioButton(ct.getCategory(), buttonValue);
b.setText(buttonValue.format());
SafeHtml buf = new SafeHtmlBuilder().append(buttonValue.format());
buf = CommentLinkProcessor.apply(buf);
SafeHtml.set(b, buf);
if (lastState != null && patchSetId.equals(lastState.patchSetId)
&& lastState.approvals.containsKey(buttonValue.getCategoryId())) {