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
+ 22
18
Compare changes
  • Side-by-side
  • Inline
Files
11
@@ -7,6 +7,7 @@ import ReplyButton from './note_actions/reply_button.vue';
@@ -7,6 +7,7 @@ import ReplyButton from './note_actions/reply_button.vue';
import eventHub from '~/sidebar/event_hub';
import eventHub from '~/sidebar/event_hub';
import Api from '~/api';
import Api from '~/api';
import { deprecatedCreateFlash as flash } from '~/flash';
import { deprecatedCreateFlash as flash } from '~/flash';
 
import { splitCamelCase } from '../../lib/utils/text_utility';
export default {
export default {
name: 'NoteActions',
name: 'NoteActions',
@@ -59,7 +60,13 @@ export default {
@@ -59,7 +60,13 @@ export default {
},
},
noteableType: {
noteableType: {
type: String,
type: String,
required: true,
required: false,
 
default: null,
 
},
 
projectName: {
 
type: String,
 
required: false,
 
default: null,
},
},
showReply: {
showReply: {
type: Boolean,
type: Boolean,
@@ -147,16 +154,14 @@ export default {
@@ -147,16 +154,14 @@ export default {
canAssign() {
canAssign() {
return this.getNoteableData.current_user?.can_update && this.isIssue;
return this.getNoteableData.current_user?.can_update && this.isIssue;
},
},
projectName() {
return this.getNoteableData.project_name;
},
displayAuthorBadgeText() {
displayAuthorBadgeText() {
return sprintf(__('This user is the author of this %{noteable}.'), {
return sprintf(__('This user is the author of this %{noteable}.'), {
noteable: this.noteableDisplayName,
noteable: this.noteableDisplayName,
});
});
},
},
displayMemberBadgeText() {
displayMemberBadgeText() {
return sprintf(__('This user is a member of the %{name} project.'), {
return sprintf(__('This user is the %{access} of the %{name} project.'), {
 
access: this.accessLevel.toLowerCase(),
name: this.projectName,
name: this.projectName,
});
});
},
},
@@ -213,19 +218,19 @@ export default {
@@ -213,19 +218,19 @@ export default {
<span
<span
v-if="isAuthor"
v-if="isAuthor"
class="note-role user-access-role has-tooltip"
class="note-role user-access-role has-tooltip"
title="displayAuthorBadgeText"
:title="displayAuthorBadgeText"
>{{ __('Author') }}</span
>{{ __('Author') }}</span
>
>
<span
<span
v-if="accessLevel"
v-if="accessLevel"
class="note-role user-access-role has-tooltip"
class="note-role user-access-role has-tooltip"
title="displayMemberBadgeText"
:title="displayMemberBadgeText"
>{{ accessLevel }}</span
>{{ accessLevel }}</span
>
>
<span
<span
v-else-if="isContributor"
v-else-if="isContributor"
class="note-role user-access-role has-tooltip"
class="note-role user-access-role has-tooltip"
title="displayContributorBadgeText"
:title="displayContributorBadgeText"
>{{ __('Contributor') }}</span
>{{ __('Contributor') }}</span
>
>
<div v-if="canResolve" class="note-actions-item">
<div v-if="canResolve" class="note-actions-item">
Loading