Commit 360c1470 authored by Jarka Kadlecova's avatar Jarka Kadlecova

Disable comment form when discussion locked for user

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