You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/7462-7462.js

3 lines
12 KiB
JavaScript

/*! For license information please see 7462-7462.js.license?v=b735580166116f78952c */
"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[7462],{10396:(e,n,a)=>{a.d(n,{A:()=>m});var o=a(85168),i=a(70395),s=a(80486),r=a(10767),c=a(96689),d=a(96763);const m={props:{id:{type:Number,default:null},message:{type:String,default:""},resourceId:{type:[String,Number],required:!0},resourceType:{type:String,default:"files"}},data:()=>({deleted:!1,editing:!1,loading:!1}),methods:{onEdit(){this.editing=!0},onEditCancel(){this.editing=!1,this.updateLocalMessage(this.message)},async onEditComment(e){this.loading=!0;try{await(0,r.A)(this.resourceType,this.resourceId,this.id,e),c.A.debug("Comment edited",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id,message:e}),this.$emit("update:message",e),this.editing=!1}catch(e){(0,o.Qg)(t("comments","An error occurred while trying to edit the comment")),d.error(e)}finally{this.loading=!1}},onDeleteWithUndo(){this.deleted=!0;const e=setTimeout(this.onDelete,o.Br);(0,o._h)(t("comments","Comment deleted"),(()=>{clearTimeout(e),this.deleted=!1}))},async onDelete(){try{await(0,s.A)(this.resourceType,this.resourceId,this.id),c.A.debug("Comment deleted",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id}),this.$emit("delete",this.id)}catch(e){(0,o.Qg)(t("comments","An error occurred while trying to delete the comment")),d.error(e),this.deleted=!1}},async onNewComment(e){this.loading=!0;try{const t=await(0,i.A)(this.resourceType,this.resourceId,e);c.A.debug("New comment posted",{resourceType:this.resourceType,resourceId:this.resourceId,newComment:t}),this.$emit("new",t),this.$emit("update:message",""),this.localMessage=""}catch(e){(0,o.Qg)(t("comments","An error occurred while trying to create the comment")),d.error(e)}finally{this.loading=!1}}}}},80486:(t,e,n)=>{n.d(e,{A:()=>o});var a=n(35550);async function o(t,e,n){const o=["",t,e,n].join("/");await a.A.deleteFile(o)}},10767:(t,e,n)=>{n.d(e,{A:()=>o});var a=n(35550);async function o(t,e,n,o){const i=["",t,e,n].join("/");return await a.A.customRequest(i,Object.assign({method:"PROPPATCH",data:'<?xml version="1.0"?>\n\t\t\t<d:propertyupdate\n\t\t\t\txmlns:d="DAV:"\n\t\t\t\txmlns:oc="http://owncloud.org/ns">\n\t\t\t<d:set>\n\t\t\t\t<d:prop>\n\t\t\t\t\t<oc:message>'.concat(o,"</oc:message>\n\t\t\t\t</d:prop>\n\t\t\t</d:set>\n\t\t\t</d:propertyupdate>")}))}},70395:(t,e,n)=>{n.d(e,{A:()=>c});var a=n(92457),o=n(17003),i=n(51195),s=n(26287),r=n(35550);async function c(t,e,n){const c=["",t,e].join("/"),d=await s.A.post((0,o.e)()+c,{actorDisplayName:(0,a.HW)().displayName,actorId:(0,a.HW)().uid,actorType:"users",creationDateTime:(new Date).toUTCString(),message:n,objectType:t,verb:"comment"}),m=c+"/"+parseInt(d.headers["content-location"].split("/").pop()),l=await r.A.stat(m,{details:!0}),A=l.data.props;return A.actorDisplayName=(0,i.j)(A.actorDisplayName,2),A.message=(0,i.j)(A.message,2),l.data}},51195:(t,e,n)=>{function a(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=new DOMParser;let a=t;for(let t=0;t<e;t++)a=n.parseFromString(a,"text/html").documentElement.textContent;return a}n.d(e,{j:()=>a})},70452:(t,e,n)=>{n.d(e,{A:()=>r});var a=n(26287),o=n(92457),i=n(38613),s=n(63814);const r=(0,n(85471).pM)({props:{resourceId:{type:Number,required:!0},resourceType:{type:String,default:"files"}},data:()=>({editorData:{actorDisplayName:(0,o.HW)().displayName,actorId:(0,o.HW)().uid,key:"editor"},userData:{}}),methods:{async autoComplete(t,e){const{data:n}=await a.A.get((0,s.KT)("core/autocomplete/get"),{params:{search:t,itemType:"files",itemId:this.resourceId,sorter:"commenters|share-recipients",limit:(0,i.C)("comments","maxAutoCompleteResults")}});return n.ocs.data.forEach((t=>{this.userData[t.id]=t})),e(Object.values(this.userData))},genMentionsData(t){return Object.values(t).flat().forEach((t=>{var e;this.userData[t.mentionId]={icon:"icon-user",id:t.mentionId,label:t.mentionDisplayName,source:"users",primary:(null===(e=(0,o.HW)())||void 0===e?void 0:e.uid)===t.mentionId}})),this.userData}}})},29369:(t,e,n)=>{n.d(e,{A:()=>u});var a=n(92457),o=n(53334),i=n(634
//# sourceMappingURL=7462-7462.js.map?v=b735580166116f78952c