Commit b5e91ff8 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch...

Merge branch '207471-expose-note-confidential-attribute-in-apis-and-display-on-frontend' into 'master'

Add confidential status support for comment and replies

See merge request gitlab-org/gitlab!31622
parents 9cf9955d a2392795
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
export default { export default {
...@@ -7,6 +8,10 @@ export default { ...@@ -7,6 +8,10 @@ export default {
timeAgoTooltip, timeAgoTooltip,
GitlabTeamMemberBadge: () => GitlabTeamMemberBadge: () =>
import('ee_component/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue'), import('ee_component/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue'),
GlIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
}, },
props: { props: {
author: { author: {
...@@ -44,6 +49,11 @@ export default { ...@@ -44,6 +49,11 @@ export default {
required: false, required: false,
default: true, default: true,
}, },
isConfidential: {
type: Boolean,
required: false,
default: false,
},
}, },
data() { data() {
return { return {
...@@ -174,6 +184,15 @@ export default { ...@@ -174,6 +184,15 @@ export default {
</a> </a>
<time-ago-tooltip v-else ref="noteTimestamp" :time="createdAt" tooltip-placement="bottom" /> <time-ago-tooltip v-else ref="noteTimestamp" :time="createdAt" tooltip-placement="bottom" />
</template> </template>
<gl-icon
v-if="isConfidential"
v-gl-tooltip:tooltipcontainer.bottom
data-testid="confidentialIndicator"
name="eye-slash"
:size="14"
:title="s__('Notes|Private comments are accessible by internal staff only')"
class="gl-ml-1 gl-text-gray-800 align-middle"
/>
<slot name="extra-controls"></slot> <slot name="extra-controls"></slot>
<i <i
v-if="showSpinner" v-if="showSpinner"
......
...@@ -255,7 +255,13 @@ export default { ...@@ -255,7 +255,13 @@ export default {
</div> </div>
<div class="timeline-content"> <div class="timeline-content">
<div class="note-header"> <div class="note-header">
<note-header v-once :author="author" :created-at="note.created_at" :note-id="note.id"> <note-header
v-once
:author="author"
:created-at="note.created_at"
:note-id="note.id"
:is-confidential="note.confidential"
>
<slot slot="note-header-info" name="note-header-info"></slot> <slot slot="note-header-info" name="note-header-info"></slot>
<span v-if="commit" v-html="actionText"></span> <span v-if="commit" v-html="actionText"></span>
<span v-else-if="note.created_at" class="d-none d-sm-inline">&middot;</span> <span v-else-if="note.created_at" class="d-none d-sm-inline">&middot;</span>
......
---
title: Add confidential status support for comment and replies
merge_request: 31622
author:
type: added
...@@ -14519,6 +14519,9 @@ msgstr "" ...@@ -14519,6 +14519,9 @@ msgstr ""
msgid "Notes|Collapse replies" msgid "Notes|Collapse replies"
msgstr "" msgstr ""
msgid "Notes|Private comments are accessible by internal staff only"
msgstr ""
msgid "Notes|Show all activity" msgid "Notes|Show all activity"
msgstr "" msgstr ""
......
...@@ -18,6 +18,7 @@ describe('NoteHeader component', () => { ...@@ -18,6 +18,7 @@ describe('NoteHeader component', () => {
const findActionText = () => wrapper.find({ ref: 'actionText' }); const findActionText = () => wrapper.find({ ref: 'actionText' });
const findTimestampLink = () => wrapper.find({ ref: 'noteTimestampLink' }); const findTimestampLink = () => wrapper.find({ ref: 'noteTimestampLink' });
const findTimestamp = () => wrapper.find({ ref: 'noteTimestamp' }); const findTimestamp = () => wrapper.find({ ref: 'noteTimestamp' });
const findConfidentialIndicator = () => wrapper.find('[data-testid="confidentialIndicator"]');
const findSpinner = () => wrapper.find({ ref: 'spinner' }); const findSpinner = () => wrapper.find({ ref: 'spinner' });
const author = { const author = {
...@@ -231,4 +232,15 @@ describe('NoteHeader component', () => { ...@@ -231,4 +232,15 @@ describe('NoteHeader component', () => {
}); });
}); });
}); });
describe('with confidentiality indicator', () => {
it.each`
status | condition
${true} | ${'shows'}
${false} | ${'hides'}
`('$condition icon indicator when isConfidential is $status', ({ status }) => {
createComponent({ isConfidential: status });
expect(findConfidentialIndicator().exists()).toBe(status);
});
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment