mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
chore: fix ESLint errors
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
c56ebcecb2
commit
e26588d78c
10 changed files with 58 additions and 57 deletions
|
|
@ -13,7 +13,7 @@
|
|||
<!-- Author -->
|
||||
<NcAvatar
|
||||
class="comment__avatar"
|
||||
:display-name="actorDisplayName"
|
||||
:displayName="actorDisplayName"
|
||||
:user="actorId"
|
||||
:size="32" />
|
||||
</div>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
<NcActions v-if="isOwnComment && id && !loading" class="comment__actions">
|
||||
<template v-if="!editing">
|
||||
<NcActionButton
|
||||
close-after-click
|
||||
closeAfterClick
|
||||
@click="onEdit">
|
||||
<template #icon>
|
||||
<IconPencilOutline :size="20" />
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
</NcActionButton>
|
||||
<NcActionSeparator />
|
||||
<NcActionButton
|
||||
close-after-click
|
||||
closeAfterClick
|
||||
@click="onDeleteWithUndo">
|
||||
<template #icon>
|
||||
<IconTrashCanOutline :size="20" />
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
v-else-if="creationDateTime"
|
||||
class="comment__timestamp"
|
||||
:timestamp="timestamp"
|
||||
:ignore-seconds="true" />
|
||||
:ignoreSeconds="true" />
|
||||
</div>
|
||||
|
||||
<!-- Message editor -->
|
||||
|
|
@ -68,14 +68,14 @@
|
|||
<div class="comment__editor-group">
|
||||
<NcRichContenteditable
|
||||
ref="editor"
|
||||
:auto-complete="autoComplete"
|
||||
v-model="localMessage"
|
||||
:autoComplete
|
||||
:contenteditable="!loading"
|
||||
:label="editor ? t('comments', 'New comment') : t('comments', 'Edit comment')"
|
||||
:placeholder="t('comments', 'Write a comment …')"
|
||||
:model-value="localMessage"
|
||||
:user-data="userData"
|
||||
:userData
|
||||
aria-describedby="tab-comments__editor-description"
|
||||
@update:model-value="updateLocalMessage"
|
||||
@update:modelValue="submitted = false"
|
||||
@submit="onSubmit" />
|
||||
<div class="comment__submit">
|
||||
<NcButton
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
:class="{ 'comment__message--expanded': expanded }"
|
||||
:text="richContent.message"
|
||||
:arguments="richContent.mentions"
|
||||
use-markdown
|
||||
useMarkdown
|
||||
@click="onExpand" />
|
||||
</div>
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import client from './DavClient.ts'
|
|||
/**
|
||||
* Delete a comment
|
||||
*
|
||||
* @param {string} resourceType the resource type
|
||||
* @param {number} resourceId the resource ID
|
||||
* @param {number} commentId the comment iD
|
||||
* @param resourceType the resource type
|
||||
* @param resourceId the resource ID
|
||||
* @param commentId the comment iD
|
||||
*/
|
||||
export default async function(resourceType, resourceId, commentId) {
|
||||
export default async function(resourceType: string, resourceId: number, commentId: number) {
|
||||
const commentPath = ['', resourceType, resourceId, commentId].join('/')
|
||||
|
||||
// Fetch newly created comment data
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ import client from './DavClient.ts'
|
|||
/**
|
||||
* Edit an existing comment
|
||||
*
|
||||
* @param {string} resourceType the resource type
|
||||
* @param {number} resourceId the resource ID
|
||||
* @param {number} commentId the comment iD
|
||||
* @param {string} message the message content
|
||||
* @param resourceType the resource type
|
||||
* @param resourceId the resource ID
|
||||
* @param commentId the comment iD
|
||||
* @param message the message content
|
||||
*/
|
||||
export default async function(resourceType, resourceId, commentId, message) {
|
||||
export default async function(resourceType: string, resourceId: number, commentId: number, message: string) {
|
||||
const commentPath = ['', resourceType, resourceId, commentId].join('/')
|
||||
|
||||
return await client.customRequest(commentPath, {
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ import client from './DavClient.ts'
|
|||
/**
|
||||
* Retrieve the comments list
|
||||
*
|
||||
* @param {string} resourceType the resource type
|
||||
* @param {number} resourceId the resource ID
|
||||
* @param {string} message the message
|
||||
* @return {object} the new comment
|
||||
* @param resourceType the resource type
|
||||
* @param resourceId the resource ID
|
||||
* @param message the message
|
||||
* @return The new comment
|
||||
*/
|
||||
export default async function(resourceType, resourceId, message) {
|
||||
export default async function(resourceType: string, resourceId: number, message: string) {
|
||||
const resourcePath = ['', resourceType, resourceId].join('/')
|
||||
|
||||
const response = await axios.post(getRootPath() + resourcePath, {
|
||||
actorDisplayName: getCurrentUser().displayName,
|
||||
actorId: getCurrentUser().uid,
|
||||
actorDisplayName: getCurrentUser()!.displayName,
|
||||
actorId: getCurrentUser()!.uid,
|
||||
actorType: 'users',
|
||||
creationDateTime: (new Date()).toUTCString(),
|
||||
message,
|
||||
|
|
|
|||
|
|
@ -6,20 +6,20 @@
|
|||
/**
|
||||
* Creates a cancelable axios 'request object'.
|
||||
*
|
||||
* @param {Function} request the axios promise request
|
||||
* @return {object}
|
||||
* @param request the axios promise request
|
||||
* @return
|
||||
*/
|
||||
function cancelableRequest(request) {
|
||||
function cancelableRequest(request: (url: string, options?: Record<string, unknown>) => Promise<unknown>) {
|
||||
const controller = new AbortController()
|
||||
const signal = controller.signal
|
||||
|
||||
/**
|
||||
* Execute the request
|
||||
*
|
||||
* @param {string} url the url to send the request to
|
||||
* @param {object} [options] optional config for the request
|
||||
* @param url the url to send the request to
|
||||
* @param [options] optional config for the request
|
||||
*/
|
||||
const fetch = async function(url, options) {
|
||||
const fetch = async function(url: string, options?: Record<string, unknown>) {
|
||||
const response = await request(
|
||||
url,
|
||||
{ signal, ...options },
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @param {any} value -
|
||||
* @param {any} passes -
|
||||
* @param value - the string to decode
|
||||
* @param passes - the number of times to decode the string, default is 1
|
||||
*/
|
||||
export function decodeHtmlEntities(value, passes = 1) {
|
||||
export function decodeHtmlEntities(value: string, passes = 1) {
|
||||
const parser = new DOMParser()
|
||||
let decoded = value
|
||||
for (let i = 0; i < passes; i++) {
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
<template>
|
||||
<Comment
|
||||
v-bind="editorData"
|
||||
:auto-complete="autoComplete"
|
||||
:resource-type="resourceType"
|
||||
:autoComplete="autoComplete"
|
||||
:resourceType="resourceType"
|
||||
:editor="true"
|
||||
:user-data="userData"
|
||||
:resource-id="resourceId"
|
||||
:userData="userData"
|
||||
:resourceId="resourceId"
|
||||
class="comments-action"
|
||||
@new="onNewComment" />
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
ref="comment"
|
||||
tag="li"
|
||||
v-bind="comment.props"
|
||||
:auto-complete="autoComplete"
|
||||
:resource-type="resourceType"
|
||||
:autoComplete="autoComplete"
|
||||
:resourceType="resourceType"
|
||||
:message="commentMessage"
|
||||
:resource-id="resourceId"
|
||||
:user-data="genMentionsData(comment.props.mentions)"
|
||||
:resourceId="resourceId"
|
||||
:userData="genMentionsData(comment.props.mentions)"
|
||||
class="comments-activity"
|
||||
@delete="reloadCallback()" />
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -11,11 +11,11 @@
|
|||
<!-- Editor -->
|
||||
<Comment
|
||||
v-bind="editorData"
|
||||
:auto-complete="autoComplete"
|
||||
:resource-type="resourceType"
|
||||
:editor="true"
|
||||
:user-data="userData"
|
||||
:resource-id="currentResourceId"
|
||||
editor
|
||||
:autoComplete
|
||||
:resourceType
|
||||
:userData
|
||||
:resourceId="currentResourceId"
|
||||
class="comments__writer"
|
||||
@new="onNewComment" />
|
||||
|
||||
|
|
@ -36,10 +36,10 @@
|
|||
v-model="comment.props.message"
|
||||
tag="li"
|
||||
v-bind="comment.props"
|
||||
:auto-complete="autoComplete"
|
||||
:resource-type="resourceType"
|
||||
:resource-id="currentResourceId"
|
||||
:user-data="genMentionsData(comment.props.mentions)"
|
||||
:autoComplete
|
||||
:resourceType
|
||||
:resourceId="currentResourceId"
|
||||
:userData="genMentionsData(comment.props.mentions)"
|
||||
class="comments__list"
|
||||
@delete="onDelete" />
|
||||
</ul>
|
||||
|
|
@ -86,8 +86,7 @@ import { markCommentsAsRead } from '../services/ReadComments.ts'
|
|||
import cancelableRequest from '../utils/cancelableRequest.ts'
|
||||
|
||||
export default {
|
||||
/* eslint vue/multi-word-component-names: "warn" */
|
||||
name: 'Comments',
|
||||
name: 'CommentsApp',
|
||||
|
||||
components: {
|
||||
Comment,
|
||||
|
|
@ -104,6 +103,8 @@ export default {
|
|||
|
||||
mixins: [CommentView],
|
||||
|
||||
expose: ['update'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
import type { IFolder, INode, IView } from '@nextcloud/files'
|
||||
|
||||
import { computed } from 'vue'
|
||||
import Comments from './Comments.vue'
|
||||
import CommentsApp from './CommentsApp.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
node?: INode
|
||||
|
|
@ -24,9 +24,9 @@ const resourceId = computed(() => props.node?.fileid)
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Comments
|
||||
<CommentsApp
|
||||
v-if="resourceId !== undefined"
|
||||
:key="resourceId"
|
||||
:resource-id="resourceId"
|
||||
resource-type="files" />
|
||||
:resourceId="resourceId"
|
||||
resourceType="files" />
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in a new issue