nextcloud/dist/files-settings-personal.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2 lines
9.7 KiB
JavaScript
Raw Permalink Normal View History

(()=>{"use strict";var e,r,n,s={27515:(e,r,n)=>{var s=n(21777),i=n(53334),a=n(85471),o=n(65043),l=n(85168),c=n(63814),d=n(17334),u=n.n(d),p=n(74095),f=n(67607);const h=(0,n(35947).YK)().setApp("files").detectUser().build(),m=(0,l.a1)(t("files","Choose a file or folder to transfer")).setMultiSelect(!1).setType(1).allowDirectories().build(),g={name:"TransferOwnershipDialogue",components:{NcSelect:f.default,NcButton:p.A},data:()=>({directory:void 0,directoryPickerError:void 0,submitError:void 0,loadingUsers:!1,selectedUser:null,userSuggestions:{},config:{minSearchStringLength:parseInt(OC.config["sharing.minSearchStringLength"],10)||0}}),computed:{canSubmit(){return!!this.directory&&!!this.selectedUser},formatedUserSuggestions(){return Object.keys(this.userSuggestions).map(e=>{const t=this.userSuggestions[e];return{user:t.uid,displayName:t.displayName,icon:"icon-user",subname:t.shareWithDisplayNameUnique}})},submitButtonText(){if(!this.canSubmit)return t("files","Transfer");const e=this.readableDirectory.split("/");return t("files","Transfer {path} to {userid}",{path:e[e.length-1],userid:this.selectedUser.displayName})},readableDirectory(){return this.directory?this.directory.substring(1):""}},created(){this.findUserDebounced=u()(this.findUser,300),this.findUser("")},methods:{start(){this.directoryPickerError=void 0,m.pick().then(e=>""===e?"/":e).then(e=>{if(h.debug(`path ${e} selected for transferring ownership`),!e.startsWith("/"))throw new Error(t("files","Invalid path selected"));this.directory=e}).catch(e=>{h.error(`Selecting object for transfer aborted: ${e.message||"Unknown error"}`,{error:e}),this.directoryPickerError=e.message||t("files","Unknown error"),(0,l.Qg)(this.directoryPickerError)})},async findUser(e){if(this.query=e.trim(),!(e.length<this.config.minSearchStringLength)){this.loadingUsers=!0;try{const t=await o.Ay.get((0,c.KT)("apps/files_sharing/api/v1/sharees"),{params:{format:"json",itemType:"file",search:e,perPage:20,lookup:!1}});this.userSuggestions={},t.data.ocs.data.exact.users.concat(t.data.ocs.data.users).forEach(e=>{a.Ay.set(this.userSuggestions,e.value.shareWith,{uid:e.value.shareWith,displayName:e.label,shareWithDisplayNameUnique:e.shareWithDisplayNameUnique})})}catch(e){h.error("could not fetch users",{error:e})}finally{this.loadingUsers=!1}}},submit(){this.canSubmit||h.warn("ignoring form submit"),this.submitError=void 0;const e={path:this.directory,recipient:this.selectedUser.user};h.debug("submit transfer ownership form",e);const r=(0,c.KT)("apps/files/api/v1/transferownership");o.Ay.post(r,e).then(e=>e.data).then(e=>{h.info("Transfer ownership request sent",{data:e}),this.directory=void 0,this.selectedUser=null,(0,l.Te)(t("files","Ownership transfer request sent"))}).catch(e=>{h.error("Could not send ownership transfer request",{error:e}),this.submitError=403===e?.response?.status?t("files","Cannot transfer ownership of a file or folder you do not own"):e.message||t("files","Unknown error"),(0,l.Qg)(this.submitError)})}}};var b=n(85072),v=n.n(b),A=n(97825),y=n.n(A),w=n(77659),C=n.n(w),_=n(55056),x=n.n(_),S=n(10540),k=n.n(S),U=n(41113),T=n.n(U),E=n(69683),O={};O.styleTagTransform=T(),O.setAttributes=x(),O.insert=C().bind(null,"head"),O.domAPI=y(),O.insertStyleElement=k(),v()(E.A,O),E.A&&E.A.locals&&E.A.locals;var D=n(14486);const N={name:"PersonalSettings",components:{TransferOwnershipDialogue:(0,D.A)(g,function(){var e=this,t=e._self._c;return t("div",[t("h3",[e._v(e._s(e.t("files","Transfer ownership of a file or folder"))+" ")]),e._v(" "),t("form",{on:{submit:function(t){return t.preventDefault(),e.submit.apply(null,arguments)}}},[t("p",{staticClass:"transfer-select-row"},[t("span",[e._v(e._s(e.readableDirectory))]),e._v(" "),void 0===e.directory?t("NcButton",{staticClass:"transfer-select-row__choose_button",on:{click:function(t){return t.preventDefault(),e.start.apply(null,arguments)}}},[e._v("\n\t\t\t\t"+e._s(e.t("files","Choose file or folder to transfer"))+"\n\t\t\t")]):t("NcButton",{on:{click:function(t){return t.preventDefault(),e.start.apply(null,arguments)}}},[e._v("\n\t\t\t\t"+e.
//# sourceMappingURL=files-settings-personal.js.map?v=473da7bb4649a4baef80