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/files-personal-settings.js

3 lines
10 KiB
JavaScript

/*! For license information please see files-personal-settings.js.license?v=484661b0b4c7e2676a57 */
(()=>{"use strict";var e,r,n,s={71070:(e,r,n)=>{var s=n(85471),i=n(92457),a=n(26287),o=n(17334),l=n.n(o),c=n(63814),d=n(85168),u=n(67607),p=n(9518);const f=(0,n(53529).YK)().setApp("files").detectUser().build(),h=(0,d.a1)(t("files","Choose a file or folder to transfer")).setMultiSelect(!1).setType(1).allowDirectories().build(),g={name:"TransferOwnershipDialogue",components:{NcSelect:u.A,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"}}))},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=l()(this.findUser,300),this.findUser("")},methods:{start(){this.directoryPickerError=void 0,h.pick().then((e=>""===e?"/":e)).then((e=>{if(f.debug("path ".concat(e," selected for transferring ownership")),!e.startsWith("/"))throw new Error(t("files","Invalid path selected"));this.directory=e})).catch((e=>{f.error("Selecting object for transfer aborted: ".concat(e.message||"Unknown error"),{error:e}),this.directoryPickerError=e.message||t("files","Unknown error"),(0,d.Qg)(this.directoryPickerError)}))},async findUser(e){if(this.query=e.trim(),!(e.length<this.config.minSearchStringLength)){this.loadingUsers=!0;try{const t=await a.A.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=>{s.Ay.set(this.userSuggestions,e.value.shareWith,{uid:e.value.shareWith,displayName:e.label})}))}catch(e){f.error("could not fetch users",{error:e})}finally{this.loadingUsers=!1}}},submit(){this.canSubmit||f.warn("ignoring form submit"),this.submitError=void 0;const e={path:this.directory,recipient:this.selectedUser.user};f.debug("submit transfer ownership form",e);const r=(0,c.KT)("apps/files/api/v1/transferownership");a.A.post(r,e).then((e=>e.data)).then((e=>{f.info("Transfer ownership request sent",{data:e}),this.directory=void 0,this.selectedUser=null,(0,d.Te)(t("files","Ownership transfer request sent"))})).catch((e=>{var r;f.error("Could not send ownership transfer request",{error:e}),403===(null==e||null===(r=e.response)||void 0===r?void 0:r.status)?this.submitError=t("files","Cannot transfer ownership of a file or folder you do not own"):this.submitError=e.message||t("files","Unknown error"),(0,d.Qg)(this.submitError)}))}}};var m=n(85072),b=n.n(m),v=n(97825),A=n.n(v),w=n(77659),y=n.n(w),C=n(55056),_=n.n(C),x=n(10540),S=n.n(x),k=n(41113),T=n.n(k),U=n(33444),E={};E.styleTagTransform=T(),E.setAttributes=_(),E.insert=y().bind(null,"head"),E.domAPI=A(),E.insertStyleElement=S(),b()(U.A,E),U.A&&U.A.locals&&U.A.locals;var O=n(14486);const D={name:"PersonalSettings",components:{TransferOwnershipDialogue:(0,O.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._s(e.t("files","C
//# sourceMappingURL=files-personal-settings.js.map?v=484661b0b4c7e2676a57