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

2 lines
23 KiB

  1. /*! For license information please see comments-comments-app.js.LICENSE.txt */
  2. (()=>{var e,s={19919:(e,s,n)=>{"use strict";var o=n(17499),a=n(31352),i=n(79753),r=n(45994),c=n(79954),m=n(64024),l=n(4820),d=n(2324),u=n(20144),p=n(74347),h=n(93455),g=n.n(h),A=n(10861),C=n.n(A),f=n(36272),j=n(92141),v=n(94603),y=n(80351),_=n.n(y),b=n(45400),x=n.n(b),w=n(12945),k=n.n(w),D=n(875),N=n.n(D),I=n(75925),T=n.n(I),O=n(12323),M=n.n(O),E=n(13408),B=n.n(E),S=n(39429);const z={name:"Moment",props:{timestamp:{type:Number,required:!0},format:{type:String,default:"LLL"}},computed:{title(){return _().unix(this.timestamp).format(this.format)},formatted(){return _().unix(this.timestamp).fromNow()}}};var R=n(51900);const q=(0,R.Z)(z,(function(){var t=this;return(0,t._self._c)("span",{staticClass:"live-relative-timestamp",attrs:{"data-timestamp":1e3*t.timestamp,title:t.title}},[t._v(t._s(t.formatted))])}),[],!1,null,null,null).exports,P=function(){return(0,i.generateRemoteUrl)("dav/comments")};function Z(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const s=new DOMParser;let n=t;for(let t=0;t<e;t++)n=s.parseFromString(n,"text/html").documentElement.textContent;return n}var L,U=n(14596);const $=(0,U.eI)(P(),{headers:{"X-Requested-With":"XMLHttpRequest",requesttoken:null!==(L=(0,r.IH)())&&void 0!==L?L:""}});var F=n(25108);const G={props:{id:{type:Number,default:null},message:{type:String,default:""},ressourceId:{type:[String,Number],required:!0}},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 async function(t,e,s,n){const o=["",t,e,s].join("/");return await $.customRequest(o,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(n,"</oc:message>\n\t\t\t\t</d:prop>\n\t\t\t</d:set>\n\t\t\t</d:propertyupdate>")}))}(this.commentsType,this.ressourceId,this.id,e),this.logger.debug("Comment edited",{commentsType:this.commentsType,ressourceId:this.ressourceId,id:this.id,message:e}),this.$emit("update:message",e),this.editing=!1}catch(e){(0,m.x2)(t("comments","An error occurred while trying to edit the comment")),F.error(e)}finally{this.loading=!1}},onDeleteWithUndo(){this.deleted=!0;const e=setTimeout(this.onDelete,m.et);(0,m.yl)(t("comments","Comment deleted"),(()=>{clearTimeout(e),this.deleted=!1}))},async onDelete(){try{await async function(t,e,s){const n=["",t,e,s].join("/");await $.deleteFile(n)}(this.commentsType,this.ressourceId,this.id),this.logger.debug("Comment deleted",{commentsType:this.commentsType,ressourceId:this.ressourceId,id:this.id}),this.$emit("delete",this.id)}catch(e){(0,m.x2)(t("comments","An error occurred while trying to delete the comment")),F.error(e),this.deleted=!1}},async onNewComment(e){this.loading=!0;try{const t=await async function(t,e,s){const n=["",t,e].join("/"),o=await l.default.post(P()+n,{actorDisplayName:(0,r.ts)().displayName,actorId:(0,r.ts)().uid,actorType:"users",creationDateTime:(new Date).toUTCString(),message:s,objectType:"files",verb:"comment"}),a=n+"/"+parseInt(o.headers["content-location"].split("/").pop()),i=await $.stat(a,{details:!0}),c=i.data.props;return c.actorDisplayName=Z(c.actorDisplayName,2),c.message=Z(c.message,2),i.data}(this.commentsType,this.ressourceId,e);this.logger.debug("New comment posted",{commentsType:this.commentsType,ressourceId:this.ressourceId,newComment:t}),this.$emit("new",t),this.$emit("update:message",""),this.localMessage=""}catch(e){(0,m.x2)(t("comments","An error occurred while trying to create the comment")),F.error(e)}finally{this.loading=!1}}}},V={name:"Comment",components:{NcActionButton:x(),NcActions:k(),NcActionSeparator:N(),ArrowRight:S.default,NcAvatar:T(),NcButton:C(),Moment:q,NcRichContenteditable:M()},mixins:[B(),G],inheritAttrs:!1,props:{actorDisplayName:{type:String,required:!0},actorId:{type:String,required:!0},creationDateTime:{type:String,default:null},editor:{type:Boolean,default:!1},autoComplete:{ty
  3. //# sourceMappingURL=comments-comments-app.js.map?v=517d4fb8afa1864f29c0