Skip to content
Snippets Groups Projects

Display Contributor and Author badges on notes

Merged Mycroft Kang requested to merge TaehyeokKang/gitlab:mycroft-note-badge into master
4 unresolved threads
Compare and Show latest version
11 files
+ 35
22
Compare changes
  • Side-by-side
  • Inline
Files
11
@@ -7,6 +7,7 @@ import ReplyButton from './note_actions/reply_button.vue';
import eventHub from '~/sidebar/event_hub';
import Api from '~/api';
import { deprecatedCreateFlash as flash } from '~/flash';
import { splitCamelCase } from '../../lib/utils/text_utility';
export default {
name: 'NoteActions',
@@ -57,6 +58,16 @@ export default {
required: false,
default: false,
},
noteableType: {
type: String,
required: false,
default: null,
},
projectName: {
type: String,
required: false,
default: null,
},
showReply: {
type: Boolean,
required: true,
@@ -131,8 +142,8 @@ export default {
targetType() {
return this.getNoteableData.targetType;
},
humanTargetType() {
return this.targetType.replaceAll('_', ' ');
noteableDisplayName() {
return splitCamelCase(this.noteableType).toLowerCase();
},
assignees() {
return this.getNoteableData.assignees || [];
@@ -143,16 +154,14 @@ export default {
canAssign() {
return this.getNoteableData.current_user?.can_update && this.isIssue;
},
projectName() {
return this.getNoteableData.project_name;
},
displayAuthorBadgeText() {
return sprintf(__('This user is the author of this %{noteable}.'), {
noteable: this.humanTargetType,
noteable: this.noteableDisplayName,
});
},
displayMemberBadgeText() {
return sprintf(__('This user is a member of the %{name} project.'), {
return sprintf(__('This user is a %{access} of the %{name} project.'), {
access: this.accessLevel.toLowerCase(),
name: this.projectName,
});
},
@@ -209,19 +218,19 @@ export default {
<span
v-if="isAuthor"
class="note-role user-access-role has-tooltip"
title="displayAuthorBadgeText"
:title="displayAuthorBadgeText"
>{{ __('Author') }}</span
>
<span
v-if="accessLevel"
class="note-role user-access-role has-tooltip"
title="displayMemberBadgeText"
:title="displayMemberBadgeText"
>{{ accessLevel }}</span
>
<span
v-else-if="isContributor"
class="note-role user-access-role has-tooltip"
title="displayContributorBadgeText"
:title="displayContributorBadgeText"
>{{ __('Contributor') }}</span
>
<div v-if="canResolve" class="note-actions-item">
Loading