BigW Consortium Gitlab

Commit 360c1470 by Jarka Kadlecova

Disable comment form when discussion locked for user

parent 142bbd90
......@@ -9,6 +9,7 @@
import eventHub from '../event_hub';
import issueWarning from '../../vue_shared/components/issue/issue_warning.vue';
import issueNoteSignedOutWidget from './issue_note_signed_out_widget.vue';
import issueDiscussionLockedWidget from './issue_discussion_locked_widget.vue';
import markdownField from '../../vue_shared/components/markdown/field.vue';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import issuableStateMixin from '../mixins/issuable_state';
......@@ -29,6 +30,7 @@
components: {
issueWarning,
issueNoteSignedOutWidget,
issueDiscussionLockedWidget,
markdownField,
userAvatarLink,
},
......@@ -239,6 +241,7 @@
<template>
<div>
<issue-note-signed-out-widget v-if="!isLoggedIn" />
<issue-discussion-locked-widget v-else-if="!canCreate" />
<ul
v-else
class="notes notes-form timeline">
......
<script>
import { mapGetters } from 'vuex';
export default {
name: 'discussionLockedWidget',
};
</script>
<template>
<div class="disabled-comment text-center">
<span class="issuable-note-warning">
This issue is locked. Only <b>project members</b> can comment.
</span>
</div>
</template>
......@@ -15,7 +15,7 @@ class IssueEntity < IssuableEntity
expose :current_user do
expose :can_create_note do |issue|
can?(request.current_user, :create_note, issue.project)
can?(request.current_user, :create_note, issue)
end
expose :can_update do |issue|
......
......@@ -25,9 +25,11 @@
= link_to "sign in", new_session_path(:user, redirect_to_referer: 'yes'), class: 'js-sign-in-link'
to comment
- elsif discussion_locked
.discussion_locked
%span
.disabled-comment.text-center.prepend-top-default
%span.issuable-note-warning
This
= issuable.class.to_s
has been locked. Posting comments has been restricted to project members.
= issuable.class.to_s.titleize
is locked. Only
%b project members
can comment.
%script.js-notes-data{ type: "application/json" }= initial_notes_data(autocomplete).to_json.html_safe
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