Apply comment link processing to approval values

Allow comment link processing to be applied to
approval values. So specfic phrases can be converted
to HTML links.

Change-Id: Id588611a389dfcdc9b7eafd1b17f66f608b4bde0
This commit is contained in:
Chris Harris
2012-11-23 12:17:36 -05:00
parent 482c2a5497
commit 63c7cdde69
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

@@ -21,6 +21,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;
@@ -47,6 +48,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;
@@ -253,7 +256,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())) {