mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
2 lines
No EOL
7 KiB
JavaScript
2 lines
No EOL
7 KiB
JavaScript
"use strict";(globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[]).push([[8124],{38124(t,e,n){n.d(e,{default:()=>H});var s=n(85471),o=n(85168),r=n(53334),i=n(57579),a=n(74095),c=n(42507),l=n(57578);const m={name:"MessageReplyTextOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var u=n(14486);const d=(0,u.A)(m,function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon message-reply-text-outline-icon",attrs:{"aria-hidden":t.title?null:"true","aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M9 11H18V13H9V11M18 7H6V9H18V7M22 4V22L18 18H4C2.9 18 2 17.11 2 16V4C2 2.9 2.9 2 4 2H20C21.1 2 22 2.89 22 4M20 4H4V16H18.83L20 17.17V4Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])},[],!1,null,null,null).exports;var p=n(83239),h=n(65463),C=n(96689),A=n(31538),g=n(35906),_=n(35550);const f={name:"Comments",components:{Comment:h.A,NcEmptyContent:c.A,NcButton:a.A,IconRefresh:p.A,IconMessageReplyTextOutline:d,IconAlertCircleOutline:l.A},directives:{elementVisibility:i.Zx},mixins:[A.A],data:()=>({error:"",loading:!1,done:!1,offset:0,comments:[],cancelRequest:()=>{},Comment:h.A,userData:{}}),computed:{hasComments(){return this.comments.length>0},isFirstLoading(){return this.loading&&0===this.offset}},watch:{resourceId(){this.currentResourceId=this.resourceId}},methods:{t:r.Tl,async onVisibilityChange(t){if(t)try{await function(t,e,n){const s=["",t,e].join("/"),o=n.toUTCString();return _.A.customRequest(s,{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:readMarker>${o}</oc:readMarker>\n\t\t\t\t</d:prop>\n\t\t\t</d:set>\n\t\t\t</d:propertyupdate>`})}(this.resourceType,this.currentResourceId,new Date)}catch(t){(0,o.Qg)(t.message||(0,r.Tl)("comments","Failed to mark comments as read"))}},async update(t){this.currentResourceId=t,this.resetState(),await this.getComments()},onScrollBottomReached(){this.error||this.done||this.loading||this.getComments()},async getComments(){this.cancelRequest("cancel");try{this.loading=!0,this.error="";const{request:t,abort:e}=function(t){const e=new AbortController,n=e.signal;return{request:async function(e,s){return await t(e,{signal:n,...s})},abort:()=>e.abort()}}(g.v);this.cancelRequest=e;const{data:n}=await t({resourceType:this.resourceType,resourceId:this.currentResourceId},{offset:this.offset})||{data:[]};this.logger.debug(`Processed ${n.length} comments`,{comments:n}),n.length<g.e&&(this.done=!0);for(const t of n)t.props.actorId=t.props.actorId.toString();this.comments=[...this.comments,...n],this.offset+=g.e}catch(t){if("cancel"===t.message)return;this.error=(0,r.Tl)("comments","Unable to load the comments list"),C.A.error("Error loading the comments list",{error:t})}finally{this.loading=!1}},onNewComment(t){this.comments.unshift(t)},onDelete(t){const e=this.comments.findIndex(e=>e.props.id===t);e>-1?this.comments.splice(e,1):C.A.error("Could not find the deleted comment in the list",{id:t})},resetState(){this.error="",this.loading=!1,this.done=!1,this.offset=0,this.comments=[]}}};var y=n(85072),v=n.n(y),x=n(97825),b=n.n(x),I=n(77659),w=n.n(I),R=n(55056),k=n.n(R),T=n(10540),V=n.n(T),S=n(41113),M=n.n(S),N=n(94262),D={};D.styleTagTransform=M(),D.setAttributes=k(),D.insert=w().bind(null,"head"),D.domAPI=b(),D.insertStyleElement=V(),v()(N.A,D),N.A&&N.A.locals&&N.A.locals;const B=(0,u.A)(f,function(){var t=this,e=t._self._c;return e("div",{directives:[{name:"element-visibility",rawName:"v-element-visibility",value:t.onVisibilityChange,expression:"onVisibilityChange"}],staticClass:"comments",class:{"icon-loading":t.isFirstLoading}},[e("Comment",t._b({staticClass:"comments__writer",attrs:{"auto-complete":t.autoComplete,"resource-type":t.resourceType,editor:!0,"user-data":t.userData,"resource-id":t.currentResourceId},on:{new:t.onNewComment}},"Comment",t.editorData,!1)),t._v(" "),t.isFirstLoading?t._e():[!t.hasComments&&t.done?e("NcEmptyContent",{staticClass:"comments__empty",attrs:{name:t.t("comments","No comments yet, start the conversation!")},scopedSlots:t._u([{key:"icon",fn:function(){return[e("IconMessageReplyTextOutline")]},proxy:!0}],null,!1,326612300)}):e("ul",t._l(t.comments,function(n){return e("Comment",t._b({key:n.props.id,staticClass:"comments__list",attrs:{tag:"li","auto-complete":t.autoComplete,"resource-type":t.resourceType,message:n.props.message,"resource-id":t.currentResourceId,"user-data":t.genMentionsData(n.props.mentions)},on:{"update:message":function(e){return t.$set(n.props,"message",e)},delete:t.onDelete}},"Comment",n.props,!1))}),1),t._v(" "),t.loading&&!t.isFirstLoading?e("div",{staticClass:"comments__info icon-loading"}):t.hasComments&&t.done?e("div",{staticClass:"comments__info"},[t._v("\n\t\t\t"+t._s(t.t("comments","No more messages"))+"\n\t\t")]):t.error?[e("NcEmptyContent",{staticClass:"comments__error",attrs:{name:t.error},scopedSlots:t._u([{key:"icon",fn:function(){return[e("IconAlertCircleOutline")]},proxy:!0}],null,!1,3663249556)}),t._v(" "),e("NcButton",{staticClass:"comments__retry",on:{click:t.getComments},scopedSlots:t._u([{key:"icon",fn:function(){return[e("IconRefresh")]},proxy:!0}],null,!1,2997625269)},[t._v("\n\t\t\t\t"+t._s(t.t("comments","Retry"))+"\n\t\t\t")])]:t._e()]],2)},[],!1,null,"6c8c157a",null).exports,E=(0,s.pM)({__name:"FilesSidebarTab",props:{node:null,active:{type:Boolean},folder:null,view:null},setup(t){const e=t,n=(0,s.EW)(()=>e.node?.fileid);return{__sfc:!0,props:e,resourceId:n,Comments:B}}}),H=(0,u.A)(E,function(){var t=this,e=t._self._c,n=t._self._setupProxy;return void 0!==n.resourceId?e(n.Comments,{key:n.resourceId,attrs:{"resource-id":n.resourceId,"resource-type":"files"}}):t._e()},[],!1,null,null,null).exports},94262(t,e,n){n.d(e,{A:()=>a});var s=n(71354),o=n.n(s),r=n(76314),i=n.n(r)()(o());i.push([t.id,".comments[data-v-6c8c157a]{min-height:100%;display:flex;flex-direction:column}.comments__empty[data-v-6c8c157a],.comments__error[data-v-6c8c157a]{flex:1 0}.comments__retry[data-v-6c8c157a]{margin:0 auto}.comments__info[data-v-6c8c157a]{height:60px;color:var(--color-text-maxcontrast);text-align:center;line-height:60px}","",{version:3,sources:["webpack://./apps/comments/src/views/Comments.vue"],names:[],mappings:"AACA,2BACC,eAAA,CACA,YAAA,CACA,qBAAA,CAEA,oEAEC,QAAA,CAGD,kCACC,aAAA,CAGD,iCACC,WAAA,CACA,mCAAA,CACA,iBAAA,CACA,gBAAA",sourcesContent:["\n.comments {\n\tmin-height: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t&__empty,\n\t&__error {\n\t\tflex: 1 0;\n\t}\n\n\t&__retry {\n\t\tmargin: 0 auto;\n\t}\n\n\t&__info {\n\t\theight: 60px;\n\t\tcolor: var(--color-text-maxcontrast);\n\t\ttext-align: center;\n\t\tline-height: 60px;\n\t}\n}\n"],sourceRoot:""}]);const a=i}}]);
|
|
//# sourceMappingURL=8124-8124.js.map?v=7273b44251b9ce503f49
|