Commit 1624438f authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '351028-add-confidential-comments-support-for-epics' into 'master'

Add support for confidential comments in epics

See merge request gitlab-org/gitlab!83967
parents 387ccb03 8ddf4fc1
......@@ -6,10 +6,12 @@ import {
GlSafeHtmlDirective as SafeHtml,
} from '@gitlab/ui';
import { mapActions } from 'vuex';
import { __ } from '~/locale';
import { __, s__ } from '~/locale';
import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import UserNameWithStatus from '../../sidebar/components/assignees/user_name_with_status.vue';
import { NOTEABLE_TYPE_MAPPING } from '../constants';
export default {
safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] },
components: {
......@@ -45,6 +47,11 @@ export default {
required: false,
default: null,
},
noteableType: {
type: String,
required: false,
default: '',
},
includeToggle: {
type: Boolean,
required: false,
......@@ -103,6 +110,15 @@ export default {
authorName() {
return this.author.name;
},
noteConfidentialityTooltip() {
if (
this.noteableType === NOTEABLE_TYPE_MAPPING.Issue ||
this.noteableType === NOTEABLE_TYPE_MAPPING.MergeRequest
) {
return s__('Notes|This comment is confidential and only visible to project members');
}
return s__('Notes|This comment is confidential and only visible to group members');
},
},
mounted() {
this.emojiTitle = this.emojiElement ? this.emojiElement.getAttribute('title') : '';
......@@ -226,7 +242,7 @@ export default {
data-testid="confidentialIndicator"
name="eye-slash"
:size="16"
:title="s__('Notes|This comment is confidential and only visible to project members')"
:title="noteConfidentialityTooltip"
class="gl-ml-1 gl-text-orange-700 align-middle"
/>
<slot name="extra-controls"></slot>
......
......@@ -432,6 +432,7 @@ export default {
:created-at="note.created_at"
:note-id="note.id"
:is-confidential="note.confidential"
:noteable-type="noteableType"
>
<template #note-header-info>
<slot name="note-header-info"></slot>
......
......@@ -18,6 +18,7 @@ class Groups::EpicsController < Groups::ApplicationController
before_action do
push_frontend_feature_flag(:related_epics_widget, @group, type: :development, default_enabled: :yaml)
push_frontend_feature_flag(:confidential_notes, @group, type: :development, default_enabled: :yaml)
end
feature_category :portfolio_management
......
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import waitForPromises from 'helpers/wait_for_promises';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import GitlabTeamMemberBadge from 'ee/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue';
import NoteHeader from '~/notes/components/note_header.vue';
......@@ -20,7 +20,7 @@ describe('NoteHeader component', () => {
};
const createComponent = (props) => {
wrapper = shallowMount(NoteHeader, {
wrapper = shallowMountExtended(NoteHeader, {
store: new Vuex.Store(),
propsData: { ...props },
});
......@@ -47,4 +47,12 @@ describe('NoteHeader component', () => {
expect(wrapper.findComponent(GitlabTeamMemberBadge).exists()).toBe(expected);
},
);
it('shows confidential indicator tooltip for group context when isConfidential is true for epics', () => {
createComponent({ isConfidential: true, noteableType: 'epic' });
expect(wrapper.findByTestId('confidentialIndicator').attributes('title')).toBe(
'This comment is confidential and only visible to group members',
);
});
});
......@@ -25661,6 +25661,9 @@ msgstr ""
msgid "Notes|This comment has changed since you started editing, please review the %{open_link}updated comment%{close_link} to ensure information is not lost"
msgstr ""
msgid "Notes|This comment is confidential and only visible to group members"
msgstr ""
msgid "Notes|This comment is confidential and only visible to project members"
msgstr ""
......
......@@ -296,5 +296,13 @@ describe('NoteHeader component', () => {
createComponent({ isConfidential: status });
expect(findConfidentialIndicator().exists()).toBe(status);
});
it('shows confidential indicator tooltip for project context', () => {
createComponent({ isConfidential: true, noteableType: 'issue' });
expect(findConfidentialIndicator().attributes('title')).toBe(
'This comment is confidential and only visible to project members',
);
});
});
});
......@@ -11,6 +11,7 @@ import NoteBody from '~/notes/components/note_body.vue';
import NoteHeader from '~/notes/components/note_header.vue';
import issueNote from '~/notes/components/noteable_note.vue';
import NotesModule from '~/notes/stores/modules';
import { NOTEABLE_TYPE_MAPPING } from '~/notes/constants';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
......@@ -226,6 +227,7 @@ describe('issue_note', () => {
expect(noteHeaderProps.author).toBe(note.author);
expect(noteHeaderProps.createdAt).toBe(note.created_at);
expect(noteHeaderProps.noteId).toBe(note.id);
expect(noteHeaderProps.noteableType).toBe(NOTEABLE_TYPE_MAPPING[note.noteable_type]);
});
it('should render note actions', () => {
......
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