6826-6826.js 12 KB

123
  1. /*! For license information please see 6826-6826.js.LICENSE.txt */
  2. "use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[6826],{85971:(e,n,a)=>{a.d(n,{Z:()=>m});var o=a(64024),s=a(15978),i=a(69302),r=a(35868),c=a(59953),d=a(25108);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.Z)(this.resourceType,this.resourceId,this.id,e),c.Z.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.x2)(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.et);(0,o.yl)(t("comments","Comment deleted"),(()=>{clearTimeout(e),this.deleted=!1}))},async onDelete(){try{await(0,i.Z)(this.resourceType,this.resourceId,this.id),c.Z.debug("Comment deleted",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id}),this.$emit("delete",this.id)}catch(e){(0,o.x2)(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,s.Z)(this.resourceType,this.resourceId,e);c.Z.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.x2)(t("comments","An error occurred while trying to create the comment")),d.error(e)}finally{this.loading=!1}}}}},69302:(t,e,n)=>{n.d(e,{Z:()=>o});var a=n(38728);async function o(t,e,n){const o=["",t,e,n].join("/");await a.Z.deleteFile(o)}},35868:(t,e,n)=>{n.d(e,{Z:()=>o});var a=n(38728);async function o(t,e,n,o){const s=["",t,e,n].join("/");return await a.Z.customRequest(s,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>${o}</oc:message>\n\t\t\t\t</d:prop>\n\t\t\t</d:set>\n\t\t\t</d:propertyupdate>`}))}},15978:(t,e,n)=>{n.d(e,{Z:()=>c});var a=n(77958),o=n(85581),s=n(67225),i=n(93664),r=n(38728);async function c(t,e,n){const c=["",t,e].join("/"),d=await i.Z.post((0,o.R)()+c,{actorDisplayName:(0,a.ts)().displayName,actorId:(0,a.ts)().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.Z.stat(m,{details:!0}),A=l.data.props;return A.actorDisplayName=(0,s.a)(A.actorDisplayName,2),A.message=(0,s.a)(A.message,2),l.data}},67225:(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,{a:()=>a})},94534:(t,e,n)=>{n.d(e,{Z:()=>r});var a=n(93664),o=n(77958),s=n(43554),i=n(79753);const r=(0,n(20144).aZ)({props:{resourceId:{type:Number,required:!0},resourceType:{type:String,default:"files"}},data:()=>({editorData:{actorDisplayName:(0,o.ts)().displayName,actorId:(0,o.ts)().uid,key:"editor"},userData:{}}),methods:{async autoComplete(t,e){const{data:n}=await a.Z.get((0,i.generateOcsUrl)("core/autocomplete/get"),{params:{search:t,itemType:"files",itemId:this.resourceId,sorter:"commenters|share-recipients",limit:(0,s.j)("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=>{this.userData[t.mentionId]={icon:"icon-user",id:t.mentionId,label:t.mentionDisplayName,source:"users",primary:(0,o.ts)()?.uid===t.mentionId}})),this.userData}}})},32049:(t,e,n)=>{n.d(e,{Z:()=>u});var a=n(77958),o=n(31352),s=n(43589),i=n(61057),r=n(81243),c=n(18519),d=n(54572),m=n(97947),l=n(30589),A=n(73567),p=n(85971);const u={name:"Comment",components:{ArrowRight:A.Z,NcActionButton:s.Z,NcActions:i.Z,NcActionSeparator:r.Z,NcAvatar:c.Z,NcButton:d.Z,NcDateTime:m.Z,NcRichContenteditable:()=>Promise.all([n.e(7874),n.e(6318)]).then(n.bind(n,46318))},mixins:[l.ZP,p.Z],inheritAttrs:!1,props:{actorDisplayName:{type:String,required:!0},actorId:{type:String,required:!0},creationDateTime:{type:String,default:null},editor:{type:Boolean,default:!1},autoComplete:{type:Function,required:!0},tag:{type:String,default:"div"}},data:()=>({expanded:!1,localMessage:"",submitted:!1}),computed:{isOwnComment(){return(0,a.ts)().uid===this.actorId},renderedContent(){return this.isEmptyMessage?"":this.renderContent(this.localMessage)},isEmptyMessage(){return!this.localMessage||""===this.localMessage.trim()},timestamp(){return Date.parse(this.creationDateTime)}},watch:{message(t){this.updateLocalMessage(t)}},beforeMount(){this.updateLocalMessage(this.message)},methods:{t:o.Iu,updateLocalMessage(t){this.localMessage=t.toString(),this.submitted=!1},onSubmit(){if(""!==this.localMessage.trim())return this.editor?(this.onNewComment(this.localMessage.trim()),void this.$nextTick((()=>{this.$refs.editor.$el.focus()}))):void this.onEditComment(this.localMessage.trim())},onExpand(){this.expanded=!0}}}},16775:(t,e,n)=>{n.d(e,{s:()=>a,x:()=>o});var a=function(){var t=this,e=t._self._c;return e(t.tag,{directives:[{name:"show",rawName:"v-show",value:!t.deleted,expression:"!deleted"}],tag:"component",staticClass:"comment",class:{"comment--loading":t.loading}},[e("div",{staticClass:"comment__side"},[e("NcAvatar",{staticClass:"comment__avatar",attrs:{"display-name":t.actorDisplayName,user:t.actorId,size:32}})],1),t._v(" "),e("div",{staticClass:"comment__body"},[e("div",{staticClass:"comment__header"},[e("span",{staticClass:"comment__author"},[t._v(t._s(t.actorDisplayName))]),t._v(" "),t.isOwnComment&&t.id&&!t.loading?e("NcActions",{staticClass:"comment__actions"},[t.editing?e("NcActionButton",{attrs:{icon:"icon-close"},on:{click:t.onEditCancel}},[t._v("\n\t\t\t\t\t"+t._s(t.t("comments","Cancel edit"))+"\n\t\t\t\t")]):[e("NcActionButton",{attrs:{"close-after-click":!0,icon:"icon-rename"},on:{click:t.onEdit}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("comments","Edit comment"))+"\n\t\t\t\t\t")]),t._v(" "),e("NcActionSeparator"),t._v(" "),e("NcActionButton",{attrs:{"close-after-click":!0,icon:"icon-delete"},on:{click:t.onDeleteWithUndo}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("comments","Delete comment"))+"\n\t\t\t\t\t")])]],2):t._e(),t._v(" "),t.id&&t.loading?e("div",{staticClass:"comment_loading icon-loading-small"}):t.creationDateTime?e("NcDateTime",{staticClass:"comment__timestamp",attrs:{timestamp:t.timestamp,"ignore-seconds":!0}}):t._e()],1),t._v(" "),t.editor||t.editing?e("form",{staticClass:"comment__editor",on:{submit:function(t){t.preventDefault()}}},[e("div",{staticClass:"comment__editor-group"},[e("NcRichContenteditable",{ref:"editor",attrs:{"auto-complete":t.autoComplete,contenteditable:!t.loading,label:t.editor?t.t("comments","New comment"):t.t("comments","Edit comment"),placeholder:t.t("comments","Write a comment …"),value:t.localMessage,"user-data":t.userData,"aria-describedby":"tab-comments__editor-description"},on:{"update:value":t.updateLocalMessage,submit:t.onSubmit}}),t._v(" "),e("div",{staticClass:"comment__submit"},[e("NcButton",{attrs:{type:"tertiary-no-background","native-type":"submit","aria-label":t.t("comments","Post comment"),disabled:t.isEmptyMessage},on:{click:t.onSubmit},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?e("span",{staticClass:"icon-loading-small"}):e("ArrowRight",{attrs:{size:20}})]},proxy:!0}],null,!1,2357784758)})],1)],1),t._v(" "),e("div",{staticClass:"comment__editor-description",attrs:{id:"tab-comments__editor-description"}},[t._v("\n\t\t\t\t"+t._s(t.t("comments","@ for mentions, : for emoji, / for smart picker"))+"\n\t\t\t")])]):e("div",{staticClass:"comment__message",class:{"comment__message--expanded":t.expanded},domProps:{innerHTML:t._s(t.renderedContent)},on:{click:t.onExpand}})])])},o=[]},8638:(t,e,n)=>{n.d(e,{Z:()=>r});var a=n(87537),o=n.n(a),s=n(23645),i=n.n(s)()(o());i.push([t.id,".comment[data-v-e4ab9720]{display:flex;gap:8px;padding:5px 10px}.comment__side[data-v-e4ab9720]{display:flex;align-items:flex-start;padding-top:6px}.comment__body[data-v-e4ab9720]{display:flex;flex-grow:1;flex-direction:column}.comment__header[data-v-e4ab9720]{display:flex;align-items:center;min-height:44px}.comment__actions[data-v-e4ab9720]{margin-left:10px !important}.comment__author[data-v-e4ab9720]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--color-text-maxcontrast)}.comment_loading[data-v-e4ab9720],.comment__timestamp[data-v-e4ab9720]{margin-left:auto;text-align:right;white-space:nowrap;color:var(--color-text-maxcontrast)}.comment__editor-group[data-v-e4ab9720]{position:relative}.comment__editor-description[data-v-e4ab9720]{color:var(--color-text-maxcontrast);padding-block:var(--default-grid-baseline)}.comment__submit[data-v-e4ab9720]{position:absolute !important;bottom:0;right:0}.comment__message[data-v-e4ab9720]{white-space:pre-wrap;word-break:break-word;max-height:70px;overflow:hidden;margin-top:-6px}.comment__message--expanded[data-v-e4ab9720]{max-height:none;overflow:visible}.rich-contenteditable__input[data-v-e4ab9720]{min-height:44px;margin:0;padding:10px}","",{version:3,sources:["webpack://./apps/comments/src/components/Comment.vue"],names:[],mappings:"AAKA,0BACC,YAAA,CACA,OAAA,CACA,gBAAA,CAEA,gCACC,YAAA,CACA,sBAAA,CACA,eAAA,CAGD,gCACC,YAAA,CACA,WAAA,CACA,qBAAA,CAGD,kCACC,YAAA,CACA,kBAAA,CACA,eAAA,CAGD,mCACC,2BAAA,CAGD,kCACC,eAAA,CACA,kBAAA,CACA,sBAAA,CACA,mCAAA,CAGD,uEAEC,gBAAA,CACA,gBAAA,CACA,kBAAA,CACA,mCAAA,CAGD,wCACC,iBAAA,CAGD,8CACC,mCAAA,CACA,0CAAA,CAGD,kCACC,4BAAA,CACA,QAAA,CACA,OAAA,CAGD,mCACC,oBAAA,CACA,qBAAA,CACA,eAAA,CACA,eAAA,CACA,eAAA,CACA,6CACC,eAAA,CACA,gBAAA,CAKH,8CACC,eAAA,CACA,QAAA,CACA,YA3EiB",sourcesContent:['\n@use "sass:math";\n\n$comment-padding: 10px;\n\n.comment {\n\tdisplay: flex;\n\tgap: 8px;\n\tpadding: 5px $comment-padding;\n\n\t&__side {\n\t\tdisplay: flex;\n\t\talign-items: flex-start;\n\t\tpadding-top: 6px;\n\t}\n\n\t&__body {\n\t\tdisplay: flex;\n\t\tflex-grow: 1;\n\t\tflex-direction: column;\n\t}\n\n\t&__header {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tmin-height: 44px;\n\t}\n\n\t&__actions {\n\t\tmargin-left: $comment-padding !important;\n\t}\n\n\t&__author {\n\t\toverflow: hidden;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n\n\t&_loading,\n\t&__timestamp {\n\t\tmargin-left: auto;\n\t\ttext-align: right;\n\t\twhite-space: nowrap;\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n\n\t&__editor-group {\n\t\tposition: relative;\n\t}\n\n\t&__editor-description {\n\t\tcolor: var(--color-text-maxcontrast);\n\t\tpadding-block: var(--default-grid-baseline);\n\t}\n\n\t&__submit {\n\t\tposition: absolute !important;\n\t\tbottom: 0;\n\t\tright: 0;\n\t}\n\n\t&__message {\n\t\twhite-space: pre-wrap;\n\t\tword-break: break-word;\n\t\tmax-height: 70px;\n\t\toverflow: hidden;\n\t\tmargin-top: -6px;\n\t\t&--expanded {\n\t\t\tmax-height: none;\n\t\t\toverflow: visible;\n\t\t}\n\t}\n}\n\n.rich-contenteditable__input {\n\tmin-height: 44px;\n\tmargin: 0;\n\tpadding: $comment-padding;\n}\n\n'],sourceRoot:""}]);const r=i},65855:(t,e,n)=>{var a=n(93379),o=n.n(a),s=n(7795),i=n.n(s),r=n(90569),c=n.n(r),d=n(3565),m=n.n(d),l=n(19216),A=n.n(l),p=n(44589),u=n.n(p),C=n(8638),g={};g.styleTagTransform=u(),g.setAttributes=m(),g.insert=c().bind(null,"head"),g.domAPI=i(),g.insertStyleElement=A(),o()(C.Z,g),C.Z&&C.Z.locals&&C.Z.locals},49251:(t,e,n)=>{n.d(e,{Z:()=>s});var a=n(16775),o=n(70762);n(43722);const s=(0,n(51900).Z)(o.Z,a.s,a.x,!1,null,"e4ab9720",null).exports},70762:(t,e,n)=>{n.d(e,{Z:()=>a});const a=n(32049).Z},43722:(t,e,n)=>{n(65855)}}]);
  3. //# sourceMappingURL=6826-6826.js.map?v=69587a24c35e347a6006