aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/src/views/ActivityCommentAction.vue
blob: f9a9a97796fe5c55571e5c23b184012c7e9ffd18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!--
  - SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
	<Comment v-bind="editorData"
		:auto-complete="autoComplete"
		:resource-type="resourceType"
		:editor="true"
		:user-data="userData"
		:resource-id="resourceId"
		class="comments-action"
		@new="onNewComment" />
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import Comment from '../components/Comment.vue'
import CommentView from '../mixins/CommentView.js'
import logger from '../logger'
import { showError } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'

export default defineComponent({
	components: {
		Comment,
	},
	mixins: [CommentView],
	props: {
		reloadCallback: {
			type: Function,
			required: true,
		},
	},
	methods: {
		onNewComment() {
			try {
				// just force reload
				this.reloadCallback()
			} catch (e) {
				showError(t('comments', 'Could not reload comments'))
				logger.debug(e)
			}
		},
	},
})
</script>

<style scoped>
.comments-action {
	padding: 0;
}
</style>