diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-09 15:15:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-09 15:15:13 +0300 |
commit | 0b4adad74b76b34855e9a6d943f9b9188c3914fa (patch) | |
tree | 1084ffd8336bc8e9af6f7042a093bf78e0852ac3 /app/assets/javascripts/profile | |
parent | ece36a21699c2a218b8bd14b22bea47d22218354 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/profile')
-rw-r--r-- | app/assets/javascripts/profile/components/user_achievements.vue | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/app/assets/javascripts/profile/components/user_achievements.vue b/app/assets/javascripts/profile/components/user_achievements.vue index 790b0e9f303..fd42b64f4c5 100644 --- a/app/assets/javascripts/profile/components/user_achievements.vue +++ b/app/assets/javascripts/profile/components/user_achievements.vue @@ -29,31 +29,29 @@ export default { }, methods: { processNodes(nodes) { - return nodes.slice(0, 3).map( - ({ - achievement, - createdAt, - achievement: { - namespace: { fullPath }, + return nodes.slice(0, 3).map(({ achievement, createdAt, achievement: { namespace } }) => { + return { + id: `user-achievement-${getIdFromGraphQLId(achievement.id)}`, + name: achievement.name, + timeAgo: this.timeFormatted(createdAt), + avatarUrl: achievement.avatarUrl || gon.gitlab_logo, + description: achievement.description, + namespace: namespace && { + fullPath: namespace.fullPath, + webUrl: this.rootUrl + namespace.fullPath, }, - }) => { - return { - id: `user-achievement-${getIdFromGraphQLId(achievement.id)}`, - name: achievement.name, - timeAgo: this.timeFormatted(createdAt), - avatarUrl: achievement.avatarUrl || gon.gitlab_logo, - description: achievement.description, - namespace: { - fullPath, - webUrl: this.rootUrl + fullPath, - }, - }; - }, - ); + }; + }); + }, + achievementAwardedMessage(userAchievement) { + return userAchievement.namespace + ? this.$options.i18n.awardedBy + : this.$options.i18n.awardedByUnknownNamespace; }, }, i18n: { awardedBy: s__('Achievements|Awarded %{timeAgo} by %{namespace}'), + awardedByUnknownNamespace: s__('Achievements|Awarded %{timeAgo} by a private namespace'), }, }; </script> @@ -76,11 +74,11 @@ export default { <gl-popover triggers="hover focus" placement="top" :target="userAchievement.id"> <div class="gl-font-weight-bold">{{ userAchievement.name }}</div> <div> - <gl-sprintf :message="$options.i18n.awardedBy"> + <gl-sprintf :message="achievementAwardedMessage(userAchievement)"> <template #timeAgo> <span>{{ userAchievement.timeAgo }}</span> </template> - <template #namespace> + <template v-if="userAchievement.namespace" #namespace> <a :href="userAchievement.namespace.webUrl">{{ userAchievement.namespace.fullPath }}</a> |