aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-03-23 17:56:23 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-03-24 08:43:19 +0100
commitee3d55716baf2a3e8cee0f35f4f73bd42aa1fc20 (patch)
treee29d299ce213c7afa3a7adcb84cb48610277e498 /server/sonar-web/src
parentf90f904436231604f842d4bca99f8508ca2e664a (diff)
downloadsonarqube-ee3d55716baf2a3e8cee0f35f4f73bd42aa1fc20.tar.gz
sonarqube-ee3d55716baf2a3e8cee0f35f4f73bd42aa1fc20.zip
SONAR-8969 use avatar field
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs2
-rw-r--r--server/sonar-web/src/main/js/components/issue/templates/issue-changelog.hbs2
-rw-r--r--server/sonar-web/src/main/js/components/issue/templates/issue.hbs6
-rw-r--r--server/sonar-web/src/main/js/helpers/handlebars/avatarHelperNew.js36
4 files changed, 41 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs b/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs
index 58764e59543..f18f6845d3a 100644
--- a/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs
+++ b/server/sonar-web/src/main/js/apps/issues/templates/issues-issue-filter-form.hbs
@@ -37,7 +37,7 @@
{{#if assignee}}
<a href="#" class="issue-action-option" data-property="assignees" data-value="{{assignee}}">
{{t "assigned_to"}}
- {{#ifShowAvatars}}<span class="spacer-left">{{avatarHelper assigneeEmail 16}}</span>{{/ifShowAvatars}}
+ {{#ifShowAvatars}}<span class="spacer-left">{{avatarHelperNew assigneeAvatar 16}}</span>{{/ifShowAvatars}}
{{assigneeName}}
</a>
{{else}}
diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue-changelog.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue-changelog.hbs
index e94ba28c14a..7ba2e7c2937 100644
--- a/server/sonar-web/src/main/js/components/issue/templates/issue-changelog.hbs
+++ b/server/sonar-web/src/main/js/components/issue/templates/issue-changelog.hbs
@@ -19,7 +19,7 @@
<td class="thin text-left text-top" nowrap>{{dt creationDate}}</td>
<td class="thin text-left text-top" nowrap>
{{#if userName}}
- {{#ifShowAvatars}}{{avatarHelper email 16}}{{/ifShowAvatars}}
+ {{#ifShowAvatars}}{{avatarHelperNew avatar 16}}{{/ifShowAvatars}}
{{/if}}
{{userName}}
</td>
diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
index a828ecf5e3e..1af970cc4d0 100644
--- a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
+++ b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
@@ -80,7 +80,7 @@
<button class="button-link issue-action issue-action-with-options js-issue-assign">
{{#if assignee}}
{{#ifShowAvatars}}
- <span class="text-top">{{avatarHelper assigneeEmail 16}}</span>
+ <span class="text-top">{{avatarHelperNew assigneeAvatar 16}}</span>
{{/ifShowAvatars}}
{{/if}}
<span class="issue-meta-label">{{#if assignee}}{{assigneeName}}{{else}}{{t 'unassigned'}}{{/if}}</span>&nbsp;<i
@@ -89,7 +89,7 @@
{{else}}
{{#if assignee}}
{{#ifShowAvatars}}
- <span class="text-top">{{avatarHelper assigneeEmail 16}}</span>
+ <span class="text-top">{{avatarHelperNew assigneeAvatar 16}}</span>
{{/ifShowAvatars}}
{{/if}}
<span class="issue-meta-label">{{#if assignee}}{{assigneeName}}{{else}}{{t 'unassigned'}}{{/if}}</span>
@@ -142,7 +142,7 @@
{{#each comments}}
<div class="issue-comment" data-comment-key="{{key}}">
<div class="issue-comment-author" title="{{authorName}}">
- {{#ifShowAvatars}}{{avatarHelper authorEmail 16}}{{else}}
+ {{#ifShowAvatars}}{{avatarHelperNew authorAvatar 16}}{{else}}
<i class="icon-comment icon-half-transparent"></i>{{/ifShowAvatars}}&nbsp;{{authorName}}
</div>
<div class="issue-comment-text markdown">{{{show html htmlText}}}</div>
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/avatarHelperNew.js b/server/sonar-web/src/main/js/helpers/handlebars/avatarHelperNew.js
new file mode 100644
index 00000000000..6732b09be45
--- /dev/null
+++ b/server/sonar-web/src/main/js/helpers/handlebars/avatarHelperNew.js
@@ -0,0 +1,36 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import Handlebars from 'handlebars/runtime';
+
+function gravatarServer () {
+ const getStore = require('../../app/utils/getStore').default;
+ const { getSettingValue } = require('../../store/rootReducer');
+
+ const store = getStore();
+ return (getSettingValue(store.getState(), 'sonar.lf.gravatarServerUrl') || {}).value;
+}
+
+module.exports = function (emailHash, size) {
+ // double the size for high pixel density screens
+ const url = gravatarServer().replace('{EMAIL_MD5}', emailHash).replace('{SIZE}', size * 2);
+ return new Handlebars.default.SafeString(
+ `<img class="rounded" src="${url}" width="${size}" height="${size}" alt="">`
+ );
+};