Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ const NcRichContenteditable = defineAsyncComponent(() => import('@nextcloud/vue/
const NcRichText = defineAsyncComponent(() => import('@nextcloud/vue/components/NcRichText'))
export default {
/* eslint vue/multi-word-component-names: "warn" */
name: 'Comment',
name: 'CommentEntry',
components: {
IconArrowRight,
Expand Down
23 changes: 2 additions & 21 deletions apps/comments/src/services/DavClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,9 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { getRequestToken, onRequestTokenUpdate } from '@nextcloud/auth'
import { createClient } from 'webdav'
import { getClient } from '@nextcloud/files/dav'
import { getRootPath } from '../utils/davUtils.ts'

// init webdav client
const client = createClient(getRootPath())

// set CSRF token header
/**
* @param token
*/
function setHeaders(token) {
client.setHeaders({
// Add this so the server knows it is an request from the browser
'X-Requested-With': 'XMLHttpRequest',
// Inject user auth
requesttoken: token ?? '',
})
}

// refresh headers when request token changes
onRequestTokenUpdate(setHeaders)
setHeaders(getRequestToken())
const client = getClient(getRootPath())

export default client
4 changes: 2 additions & 2 deletions apps/comments/src/services/GetComments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export async function getComments({ resourceType, resourceId }, options: { offse
/**
* https://github.com/perry-mitchell/webdav-client/blob/8d9694613c978ce7404e26a401c39a41f125f87f/source/operations/directoryContents.ts
*
* @param result
* @param isDetailed
* @param result - the DAV response result
* @param isDetailed - whether to return detailed file information
*/
function getDirectoryFiles(
result: DAVResult,
Expand Down
6 changes: 3 additions & 3 deletions apps/comments/src/views/ActivityCommentAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<template>
<Comment
<CommentEntry
v-bind="editorData"
:autoComplete="autoComplete"
:resourceType="resourceType"
Expand All @@ -19,13 +19,13 @@
import { showError } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import { defineComponent } from 'vue'
import Comment from '../components/Comment.vue'
import CommentEntry from '../components/CommentEntry.vue'
import logger from '../logger.ts'
import CommentView from '../mixins/CommentView.ts'

export default defineComponent({
components: {
Comment,
CommentEntry,
},

mixins: [CommentView],
Expand Down
6 changes: 3 additions & 3 deletions apps/comments/src/views/ActivityCommentEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-->

<template>
<Comment
<CommentEntry
ref="comment"
tag="li"
v-bind="comment.props"
Expand All @@ -21,14 +21,14 @@
import type { PropType } from 'vue'

import { t } from '@nextcloud/l10n'
import Comment from '../components/Comment.vue'
import CommentEntry from '../components/CommentEntry.vue'
import CommentView from '../mixins/CommentView.ts'

export default {
name: 'ActivityCommentEntry',

components: {
Comment,
CommentEntry,
},

mixins: [CommentView],
Expand Down
8 changes: 4 additions & 4 deletions apps/comments/src/views/CommentsApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class="comments"
:class="{ 'icon-loading': isFirstLoading }">
<!-- Editor -->
<Comment
<CommentEntry
v-bind="editorData"
editor
:autoComplete
Expand All @@ -30,7 +30,7 @@
</NcEmptyContent>
<ul v-else>
<!-- Comments -->
<Comment
<CommentEntry
v-for="comment in comments"
:key="comment.props.id"
v-model="comment.props.message"
Expand Down Expand Up @@ -78,7 +78,7 @@ import NcEmptyContent from '@nextcloud/vue/components/NcEmptyContent'
import IconAlertCircleOutline from 'vue-material-design-icons/AlertCircleOutline.vue'
import IconMessageReplyTextOutline from 'vue-material-design-icons/MessageReplyTextOutline.vue'
import IconRefresh from 'vue-material-design-icons/Refresh.vue'
import Comment from '../components/Comment.vue'
import CommentEntry from '../components/CommentEntry.vue'
import logger from '../logger.ts'
import CommentView from '../mixins/CommentView.ts'
import { DEFAULT_LIMIT, getComments } from '../services/GetComments.ts'
Expand All @@ -89,7 +89,7 @@ export default {
name: 'CommentsApp',

components: {
Comment,
CommentEntry,
NcEmptyContent,
NcButton,
IconRefresh,
Expand Down
2 changes: 0 additions & 2 deletions dist/ActivityCommentAction-CxhX-kOL.chunk.mjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/ActivityCommentAction-CxhX-kOL.chunk.mjs.map

This file was deleted.

2 changes: 2 additions & 0 deletions dist/ActivityCommentAction-D_cVu02p.chunk.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import{a as t}from"./index-DL1yHC1K-orb-zzee.chunk.mjs";import{t as m}from"./translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs";import{C as e,a as p}from"./CommentView-D_nHPZF0.chunk.mjs";import{l as a}from"./activity-B66lnZYB.chunk.mjs";import{b as i,r as s,o as n,c,m as u}from"./Web-ByHSuvRG.chunk.mjs";import{_ as l}from"./public-C1mLBHT3.chunk.mjs";import"./index-BRuD4Qrz.chunk.mjs";import"./NcModal-DUWLRm_F-C0gD58QY.chunk.mjs";import"./logger-D3RVzcfQ-B261d025.chunk.mjs";import"./createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs";import"./index-C6ey-Mhx.chunk.mjs";import"./TrashCanOutline-CW4_EEhq.chunk.mjs";import"./mdi-Ci0zJ0QG.chunk.mjs";import"./pinia-Bn5aG74F.chunk.mjs";import"./PencilOutline-DJX4SP_q.chunk.mjs";/* empty css */import"./NcAvatar-M3-CbKbq-DbNpmr-b.chunk.mjs";import"./index-D-iKxf2E.chunk.mjs";import"./util-djQ-4xJ5.chunk.mjs";import"./ArrowRight-BgQTbtKu.chunk.mjs";import"./colors-BDeMBgfq-D1xNHBAd.chunk.mjs";import"./NcUserStatusIcon-DsviB2Cr-CJ45dJff.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-BJuPH7S7-BRczm9CK.chunk.mjs";import"./NcUserBubble-CDQa0hGy-DMYvkftD.chunk.mjs";import"./GetComments-PgOpAezt.chunk.mjs";import"./index-CI-5vlTq.chunk.mjs";import"./dav-sq7XGhQT.chunk.mjs";import"./externalStorageUtils-CpkXDsx2.chunk.mjs";const d=i({components:{CommentEntry:p},mixins:[e],props:{reloadCallback:{type:Function,required:!0}},methods:{onNewComment(){try{this.reloadCallback()}catch(o){t(m("comments","Could not reload comments")),a.error("Could not reload comments",{error:o})}}}});function C(o,f,y,b,w,N){const r=s("CommentEntry");return n(),c(r,u(o.editorData,{autoComplete:o.autoComplete,resourceType:o.resourceType,editor:!0,userData:o.userData,resourceId:o.resourceId,class:"comments-action",onNew:o.onNewComment}),null,16,["autoComplete","resourceType","userData","resourceId","onNew"])}const V=l(d,[["render",C],["__scopeId","data-v-099b6b12"]]);export{V as default};
//# sourceMappingURL=ActivityCommentAction-D_cVu02p.chunk.mjs.map
1 change: 1 addition & 0 deletions dist/ActivityCommentAction-D_cVu02p.chunk.mjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dist/ActivityCommentEntry-DFdL49TV.chunk.mjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/ActivityCommentEntry-DFdL49TV.chunk.mjs.map

This file was deleted.

2 changes: 2 additions & 0 deletions dist/ActivityCommentEntry-DpJ3zirU.chunk.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import{t as s}from"./translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs";import{C as p,a as i}from"./CommentView-D_nHPZF0.chunk.mjs";import{_ as a}from"./public-C1mLBHT3.chunk.mjs";import{r as n,o as c,c as u,m as d}from"./Web-ByHSuvRG.chunk.mjs";import"./index-C6ey-Mhx.chunk.mjs";import"./pinia-Bn5aG74F.chunk.mjs";import"./PencilOutline-DJX4SP_q.chunk.mjs";import"./logger-D3RVzcfQ-B261d025.chunk.mjs";import"./createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs";import"./NcModal-DUWLRm_F-C0gD58QY.chunk.mjs";/* empty css */import"./NcAvatar-M3-CbKbq-DbNpmr-b.chunk.mjs";import"./index-D-iKxf2E.chunk.mjs";import"./util-djQ-4xJ5.chunk.mjs";import"./ArrowRight-BgQTbtKu.chunk.mjs";import"./colors-BDeMBgfq-D1xNHBAd.chunk.mjs";import"./NcUserStatusIcon-DsviB2Cr-CJ45dJff.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-BJuPH7S7-BRczm9CK.chunk.mjs";import"./TrashCanOutline-CW4_EEhq.chunk.mjs";import"./NcUserBubble-CDQa0hGy-DMYvkftD.chunk.mjs";import"./index-DL1yHC1K-orb-zzee.chunk.mjs";import"./index-BRuD4Qrz.chunk.mjs";import"./mdi-Ci0zJ0QG.chunk.mjs";import"./activity-B66lnZYB.chunk.mjs";import"./GetComments-PgOpAezt.chunk.mjs";import"./index-CI-5vlTq.chunk.mjs";import"./dav-sq7XGhQT.chunk.mjs";import"./externalStorageUtils-CpkXDsx2.chunk.mjs";const l={name:"ActivityCommentEntry",components:{CommentEntry:i},mixins:[p],props:{comment:{type:Object,required:!0},reloadCallback:{type:Function,required:!0}},data(){return{commentMessage:""}},watch:{comment(){this.commentMessage=this.comment.props.message}},mounted(){this.commentMessage=this.comment.props.message},methods:{t:s}};function g(t,e,o,y,m,C){const r=n("CommentEntry");return c(),u(r,d({ref:"comment",tag:"li"},o.comment.props,{autoComplete:t.autoComplete,resourceType:t.resourceType,message:m.commentMessage,resourceId:t.resourceId,userData:t.genMentionsData(o.comment.props.mentions),class:"comments-activity",onDelete:e[0]||(e[0]=f=>o.reloadCallback())}),null,16,["autoComplete","resourceType","message","resourceId","userData"])}const S=a(l,[["render",g],["__scopeId","data-v-2d51dbfd"]]);export{S as default};
//# sourceMappingURL=ActivityCommentEntry-DpJ3zirU.chunk.mjs.map
Loading
Loading