files-personal-settings.js 16 KB

123
  1. /*! For license information please see files-personal-settings.js.LICENSE.txt */
  2. !function(){"use strict";var e,r={76703:function(e,r,n){var o=n(20144),i=n(77958),a=n(48033),s=n(20296),c=n.n(s),u=n(79753),l=n(3255),f=n(36456),h=n.n(f),d=n(10861),p=n.n(d),v=(0,n(17499).IY)().setApp("files").detectUser().build();function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function y(){y=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype),s=new O(o||[]);return n(a,"_invoke",{value:C(t,r,s)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function h(){}function d(){}function p(){}var v={};c(v,i,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(k([])));w&&w!==e&&r.call(w,i)&&(v=w);var b=p.prototype=h.prototype=Object.create(v);function x(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function o(n,i,a,s){var c=l(t[n],t,i);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==g(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,s)}),(function(t){o("throw",t,a,s)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,s)}))}s(c.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function C(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return d.prototype=p,n(b,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:d,configurable:!0}),d.displayName=c(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},x(A.prototype),c(A.prototype,a,(function(){return this})),t.AsyncIterator=A,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new A(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(b),c(b,s,"Generator"),c(b,i,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function m(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}var w=(0,l.fn)(t("files","Choose a file or folder to transfer")).setMultiSelect(!1).setModal(!0).setType(1).allowDirectories().build(),b={name:"TransferOwnershipDialogue",components:{NcSelect:h(),NcButton:p()},data:function(){return{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:function(){return!!this.directory&&!!this.selectedUser},formatedUserSuggestions:function(){var t=this;return Object.keys(this.userSuggestions).map((function(e){var r=t.userSuggestions[e];return{user:r.uid,displayName:r.displayName,icon:"icon-user"}}))},submitButtonText:function(){if(!this.canSubmit)return t("files","Transfer");var e=this.readableDirectory.split("/");return t("files","Transfer {path} to {userid}",{path:e[e.length-1],userid:this.selectedUser.displayName})},readableDirectory:function(){return this.directory?this.directory.substring(1):""}},created:function(){this.findUserDebounced=c()(this.findUser,300),this.findUser("")},methods:{start:function(){var e=this;this.directoryPickerError=void 0,w.pick().then((function(t){return""===t?"/":t})).then((function(r){if(v.debug("path ".concat(r," selected for transferring ownership")),!r.startsWith("/"))throw new Error(t("files","Invalid path selected"));e.directory=r})).catch((function(r){v.error("Selecting object for transfer aborted: ".concat(r.message||"Unknown error"),{error:r}),e.directoryPickerError=r.message||t("files","Unknown error")}))},findUser:function(t){var e,r=this;return(e=y().mark((function e(){var n;return y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.query=t.trim(),!(t.length<r.config.minSearchStringLength)){e.next=3;break}return e.abrupt("return");case 3:return r.loadingUsers=!0,e.prev=4,e.next=7,a.Z.get((0,u.generateOcsUrl)("apps/files_sharing/api/v1/sharees"),{params:{format:"json",itemType:"file",search:t,perPage:20,lookup:!1}});case 7:n=e.sent,r.userSuggestions={},n.data.ocs.data.exact.users.concat(n.data.ocs.data.users).forEach((function(t){o.default.set(r.userSuggestions,t.value.shareWith,{uid:t.value.shareWith,displayName:t.label})})),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),v.error("could not fetch users",{error:e.t0});case 15:return e.prev=15,r.loadingUsers=!1,e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[4,12,15,18]])})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(t){m(i,n,o,a,s,"next",t)}function s(t){m(i,n,o,a,s,"throw",t)}a(void 0)}))})()},submit:function(){var e=this;this.canSubmit||v.warn("ignoring form submit"),this.submitError=void 0;var r={path:this.directory,recipient:this.selectedUser.user};v.debug("submit transfer ownership form",r);var n=(0,u.generateOcsUrl)("apps/files/api/v1/transferownership");a.Z.post(n,r).then((function(t){return t.data})).then((function(r){v.info("Transfer ownership request sent",{data:r}),e.directory=void 0,e.selectedUser=null,(0,l.s$)(t("files","Ownership transfer request sent"))})).catch((function(r){var n;v.error("Could not send ownership transfer request",{error:r}),403===(null==r||null===(n=r.response)||void 0===n?void 0:n.status)?e.submitError=t("files","Cannot transfer ownership of a file or folder you do not own"):e.submitError=r.message||t("files","Unknown error")}))}}},x=b,A=n(93379),C=n.n(A),_=n(7795),S=n.n(_),E=n(90569),O=n.n(E),k=n(3565),L=n.n(k),U=n(19216),j=n.n(U),T=n(44589),P=n.n(T),N=n(10247),D={};D.styleTagTransform=P(),D.setAttributes=L(),D.insert=O().bind(null,"head"),D.domAPI=S(),D.insertStyleElement=j(),C()(N.Z,D),N.Z&&N.Z.locals&&N.Z.locals;var B=n(51900),I=(0,B.Z)(x,(function(){var t=this,e=t._self._c;return e("div",[e("h3",[t._v(t._s(t.t("files","Transfer ownership of a file or folder"))+" ")]),t._v(" "),e("form",{on:{submit:function(e){return e.preventDefault(),t.submit.apply(null,arguments)}}},[e("p",{staticClass:"transfer-select-row"},[e("span",[t._v(t._s(t.readableDirectory))]),t._v(" "),void 0===t.directory?e("NcButton",{on:{click:function(e){return e.preventDefault(),t.start.apply(null,arguments)}}},[t._v("\n\t\t\t\t"+t._s(t.t("files","Choose file or folder to transfer"))+"\n\t\t\t")]):e("NcButton",{on:{click:function(e){return e.preventDefault(),t.start.apply(null,arguments)}}},[t._v("\n\t\t\t\t"+t._s(t.t("files","Change"))+"\n\t\t\t")]),t._v(" "),e("span",{staticClass:"error"},[t._v(t._s(t.directoryPickerError))])],1),t._v(" "),e("p",{staticClass:"new-owner-row"},[e("label",{attrs:{for:"targetUser"}},[e("span",[t._v(t._s(t.t("files","New owner")))])]),t._v(" "),e("NcSelect",{staticClass:"middle-align",attrs:{"input-id":"targetUser",options:t.formatedUserSuggestions,multiple:!1,loading:t.loadingUsers,label:"displayName","user-select":!0},on:{search:t.findUserDebounced},model:{value:t.selectedUser,callback:function(e){t.selectedUser=e},expression:"selectedUser"}})],1),t._v(" "),e("p",[e("input",{staticClass:"primary",attrs:{type:"submit",disabled:!t.canSubmit},domProps:{value:t.submitButtonText}}),t._v(" "),e("span",{staticClass:"error"},[t._v(t._s(t.submitError))])])])])}),[],!1,null,"0410c550",null),G={name:"PersonalSettings",components:{TransferOwnershipDialogue:I.exports}},Z=(0,B.Z)(G,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"section",attrs:{id:"files-personal-settings"}},[e("h2",[t._v(t._s(t.t("files","Files")))]),t._v(" "),e("TransferOwnershipDialogue")],1)}),[],!1,null,null,null).exports;n.nc=btoa((0,i.IH)()),o.default.prototype.t=t,window.TESTING||(new(o.default.extend(Z))).$mount("#files-personal-settings")},10247:function(t,e,r){var n=r(87537),o=r.n(n),i=r(23645),a=r.n(i)()(o());a.push([t.id,".middle-align[data-v-0410c550]{vertical-align:middle}p[data-v-0410c550]{margin-top:12px;margin-bottom:12px}.new-owner-row[data-v-0410c550]{display:flex}.new-owner-row label[data-v-0410c550]{display:flex;align-items:center}.new-owner-row label span[data-v-0410c550]{margin-right:8px}.new-owner-row .multiselect[data-v-0410c550]{flex-grow:1;max-width:280px}.transfer-select-row span[data-v-0410c550]{margin-right:8px}","",{version:3,sources:["webpack://./apps/files/src/components/TransferOwnershipDialogue.vue"],names:[],mappings:"AACA,+BACC,qBAAA,CAED,mBACC,eAAA,CACA,kBAAA,CAED,gCACC,YAAA,CAEA,sCACC,YAAA,CACA,kBAAA,CAEA,2CACC,gBAAA,CAIF,6CACC,WAAA,CACA,eAAA,CAID,2CACC,gBAAA",sourcesContent:["\n.middle-align {\n\tvertical-align: middle;\n}\np {\n\tmargin-top: 12px;\n\tmargin-bottom: 12px;\n}\n.new-owner-row {\n\tdisplay: flex;\n\n\tlabel {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\n\t\tspan {\n\t\t\tmargin-right: 8px;\n\t\t}\n\t}\n\n\t.multiselect {\n\t\tflex-grow: 1;\n\t\tmax-width: 280px;\n\t}\n}\n.transfer-select-row {\n\tspan {\n\t\tmargin-right: 8px;\n\t}\n}\n"],sourceRoot:""}]),e.Z=a}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={id:t,loaded:!1,exports:{}};return r[t].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=function(t,r,n,i){if(!r){var a=1/0;for(l=0;l<e.length;l++){r=e[l][0],n=e[l][1],i=e[l][2];for(var s=!0,c=0;c<r.length;c++)(!1&i||a>=i)&&Object.keys(o.O).every((function(t){return o.O[t](r[c])}))?r.splice(c--,1):(s=!1,i<a&&(a=i));if(s){e.splice(l--,1);var u=n();void 0!==u&&(t=u)}}return t}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[r,n,i]},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},o.j=1623,function(){o.b=document.baseURI||self.location.href;var t={1623:0};o.O.j=function(e){return 0===t[e]};var e=function(e,r){var n,i,a=r[0],s=r[1],c=r[2],u=0;if(a.some((function(e){return 0!==t[e]}))){for(n in s)o.o(s,n)&&(o.m[n]=s[n]);if(c)var l=c(o)}for(e&&e(r);u<a.length;u++)i=a[u],o.o(t,i)&&t[i]&&t[i][0](),t[i]=0;return o.O(l)},r=self.webpackChunknextcloud=self.webpackChunknextcloud||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))}(),o.nc=void 0;var i=o.O(void 0,[7874],(function(){return o(76703)}));i=o.O(i)}();
  3. //# sourceMappingURL=files-personal-settings.js.map?v=9569d3b9869cde1f3758