package org.sonar.server.issue.notification;
import com.google.common.base.Strings;
+import java.io.UnsupportedEncodingException;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.plugins.emailnotifications.api.EmailTemplate;
+import static java.net.URLEncoder.encode;
+
/**
* Creates email message for notification "issue-changes".
*/
appendField(sb, "Message", null, notif.getFieldValue("message"));
}
- private void appendFooter(StringBuilder sb, Notification notification) {
+ private void appendFooter(StringBuilder sb, Notification notification){
String issueKey = notification.getFieldValue("key");
- sb.append("See it in SonarQube: ").append(settings.getServerBaseURL()).append("/issues?issues=").append(issueKey).append(NEW_LINE);
+ try {
+ sb.append("See it in SonarQube: ").append(settings.getServerBaseURL())
+ .append("/project/issues?id=").append(encode(notification.getFieldValue("projectKey"), "UTF-8"))
+ .append("&issues=").append(issueKey)
+ .append("&open=").append(issueKey)
+ .append(NEW_LINE);
+ } catch (UnsupportedEncodingException e) {
+ throw new IllegalStateException("Encoding not supported", e);
+ }
}
private static void appendLine(StringBuilder sb, @Nullable String line) {
Message: Has 3 cycles
-See it in SonarQube: http://nemo.sonarsource.org/issues?issues=ABCDE
+See it in SonarQube: http://nemo.sonarsource.org/project/issues?id=org.apache%3Astruts&issues=ABCDE&open=ABCDE
Resolution: FIXED (was FALSE-POSITIVE)
-See it in SonarQube: http://nemo.sonarsource.org/issues?issues=ABCDE
+See it in SonarQube: http://nemo.sonarsource.org/project/issues?id=org.apache%3Astruts&issues=ABCDE&open=ABCDE
Action Plan changed to ABC 1.0
-See it in SonarQube: http://nemo.sonarsource.org/issues?issues=ABCDE
+See it in SonarQube: http://nemo.sonarsource.org/project/issues?id=org.apache%3Astruts&issues=ABCDE&open=ABCDE
Assignee changed to louis
-See it in SonarQube: http://nemo.sonarsource.org/issues?issues=ABCDE
+See it in SonarQube: http://nemo.sonarsource.org/project/issues?id=org.apache%3Astruts&issues=ABCDE&open=ABCDE
Status: RESOLVED
Tags: [bug performance]
-See it in SonarQube: http://nemo.sonarsource.org/issues?issues=ABCDE
+See it in SonarQube: http://nemo.sonarsource.org/project/issues?id=org.apache%3Astruts&issues=ABCDE&open=ABCDE
import SimilarIssuesFilter from './SimilarIssuesFilter';
import LocationIndex from '../../common/LocationIndex';
import Tooltip from '../../controls/Tooltip';
-import { getSingleIssueUrl } from '../../../helpers/urls';
+import { getComponentIssuesUrl } from '../../../helpers/urls';
import { formatMeasure } from '../../../helpers/measures';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import type { Issue } from '../types';
// dirty trick :(
const onIssuesPage = document.getElementById('issues-page') != null;
+ const issueUrl = getComponentIssuesUrl(issue.project, { issues: issue.key, open: issue.key });
+
return (
<table className="issue-table">
<tbody>
<li className="issue-meta">
{onIssuesPage
? locationsBadge
- : <Link
- onClick={stopPropagation}
- target="_blank"
- to={getSingleIssueUrl(issue.key)}>
+ : <Link onClick={stopPropagation} target="_blank" to={issueUrl}>
{locationsBadge}
</Link>}
</li>}
className="js-issue-permalink icon-link"
onClick={stopPropagation}
target="_blank"
- to={getSingleIssueUrl(issue.key)}
+ to={issueUrl}
/>
</li>
{hasSimilarIssuesFilter &&
line: 26,
creationDate: '2017-03-01T09:36:01+0100',
organization: 'myorg',
+ project: 'myproject',
key: 'AVsae-CQS-9G3txfbFN2',
rule: 'javascript:S1067',
message: 'Reduce the number of conditional operators (4) used in the expression',
"line": 26,
"message": "Reduce the number of conditional operators (4) used in the expression",
"organization": "myorg",
+ "project": "myproject",
"rule": "javascript:S1067",
"secondaryLocations": Array [],
}
target="_blank"
to={
Object {
- "pathname": "/issues",
+ "pathname": "/project/issues",
"query": Object {
+ "id": "myproject",
"issues": "AVsae-CQS-9G3txfbFN2",
"open": "AVsae-CQS-9G3txfbFN2",
},
"line": 26,
"message": "Reduce the number of conditional operators (4) used in the expression",
"organization": "myorg",
+ "project": "myproject",
"rule": "javascript:S1067",
"secondaryLocations": Array [],
}
target="_blank"
to={
Object {
- "pathname": "/issues",
+ "pathname": "/project/issues",
"query": Object {
+ "id": "myproject",
"issues": "AVsae-CQS-9G3txfbFN2",
"open": "AVsae-CQS-9G3txfbFN2",
},
"line": 26,
"message": "Reduce the number of conditional operators (4) used in the expression",
"organization": "myorg",
+ "project": "myproject",
"rule": "javascript:S1067",
"secondaryLocations": Array [],
}
return `${window.baseUrl}${path.pathname}?${stringify(path.query)}`;
}
-/**
- * Generate URL for a single issue
- */
-export function getSingleIssueUrl(issues) {
- return { pathname: '/issues', query: { issues, open: issues } };
-}
-
/**
* Generate URL for a component's drilldown page
* @param {string} componentKey