Skip to content
Snippets Groups Projects
Verified Commit 9529a2e6 authored by Himanshu Kapoor's avatar Himanshu Kapoor Committed by GitLab
Browse files

Merge branch 'feat/maintainers-edit-wiki-comments' into 'master'

allow maintainers to edit/delete notes

See merge request !177654



Merged-by: default avatarHimanshu Kapoor <info@fleon.org>
Approved-by: default avatarAlex Fracazo <afracazo@gitlab.com>
Approved-by: default avatarHimanshu Kapoor <info@fleon.org>
Co-authored-by: Salihu Dickson's avatarSalihu <salihudickson@gmail.com>
parents 90b16b69 6021e90f
No related branches found
No related tags found
3 merge requests!181325Fix ambiguous `created_at` in project.rb,!179611Draft: Rebase CR approach for zoekt assignments,!177654allow maintainers to edit/delete notes
Pipeline #1627564057 passed with warnings
Pipeline: GitLab

#1627590908

    Pipeline: GitLab

    #1627590904

      Pipeline: GitLab

      #1627586016

        +30
        ......@@ -36,11 +36,6 @@ export default {
        required: false,
        default: false,
        },
        userPermissions: {
        type: Object,
        required: false,
        default: () => ({}),
        },
        },
        data() {
        return {
        ......@@ -53,18 +48,14 @@ export default {
        userSignedId() {
        return Boolean(this.currentUserData?.id);
        },
        userPermissions() {
        return this.note.userPermissions;
        },
        canReply() {
        const {
        userPermissions: { createNote },
        userSignedId,
        } = this;
        return createNote && userSignedId && !this.replyNote;
        return this.userPermissions?.createNote && this.userSignedId && !this.replyNote;
        },
        canEdit() {
        const { currentUserData, userSignedId } = this;
        return userSignedId && currentUserData?.id.toString() === this.authorId;
        return this.userSignedId && this.userPermissions?.adminNote;
        },
        canReportAsAbuse() {
        const { currentUserData, userSignedId } = this;
        ......
        ......@@ -22,7 +22,6 @@ describe('WikiNote', () => {
        const createWrapper = (props) => {
        return shallowMountExtended(WikiNote, {
        propsData: {
        note,
        noteableId,
        ...props,
        },
        ......@@ -47,7 +46,7 @@ describe('WikiNote', () => {
        };
        beforeEach(() => {
        wrapper = createWrapper();
        wrapper = createWrapper({ note });
        });
        describe('renders correctly by default', () => {
        ......@@ -95,7 +94,7 @@ describe('WikiNote', () => {
        expect(noteActions.props()).toMatchObject({
        authorId: '1',
        noteUrl: note.url,
        showReply: false,
        showReply: true,
        showEdit: false,
        canReportAsAbuse: true,
        });
        ......@@ -114,7 +113,7 @@ describe('WikiNote', () => {
        describe('when user is signed in', () => {
        beforeEach(() => {
        wrapper = createWrapper();
        wrapper = createWrapper({ note });
        });
        it('should emit reply when reply event is fired from note actions', () => {
        ......@@ -125,11 +124,7 @@ describe('WikiNote', () => {
        });
        it('should pass prop "showReply" as true to note actions when user can reply', () => {
        wrapper = createWrapper({
        userPermissions: {
        createNote: true,
        },
        });
        wrapper = createWrapper({ note });
        const noteActions = wrapper.findComponent(NoteActions);
        expect(noteActions.props().showReply).toBe(true);
        ......@@ -137,8 +132,12 @@ describe('WikiNote', () => {
        it('should pass prop "showReply" as false to note actions when user cannot reply', () => {
        wrapper = createWrapper({
        userPermissions: {
        createNote: false,
        note: {
        ...note,
        userPermissions: {
        ...note.userPermissions,
        createNote: false,
        },
        },
        });
        ......@@ -176,9 +175,9 @@ describe('WikiNote', () => {
        wrapper = createWrapper({
        note: {
        ...note,
        author: {
        ...note.author,
        id: 'gid://gitlab/User/70',
        userPermissions: {
        ...note.userPermissions,
        adminNote: true,
        },
        },
        });
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment