From 6cf836ade84e0ea42f02a5e31092a8b5e1bd354d Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Fri, 15 Jul 2022 04:21:11 +0000 Subject: [PATCH] Remake Twitter handle saving with Vue Signed-off-by: Christopher Ng --- apps/settings/js/federationsettingsview.js | 3 +- .../lib/Settings/Personal/PersonalInfo.php | 4 +- .../PersonalInfo/TwitterSection.vue | 50 +++++++++++++++++++ apps/settings/src/main-personal-info.js | 3 ++ .../settings/personal/personal.info.php | 43 +--------------- dist/settings-vue-settings-personal-info.js | 4 +- ...settings-vue-settings-personal-info.js.map | 2 +- 7 files changed, 60 insertions(+), 49 deletions(-) create mode 100644 apps/settings/src/components/PersonalInfo/TwitterSection.vue diff --git a/apps/settings/js/federationsettingsview.js b/apps/settings/js/federationsettingsview.js index e05cc9f20f4e8..f5c7af8637a5a 100644 --- a/apps/settings/js/federationsettingsview.js +++ b/apps/settings/js/federationsettingsview.js @@ -129,7 +129,8 @@ if ( field === 'avatar' || field === 'email' || - field === 'displayname' + field === 'displayname' || + field === 'twitter' ) { return; } diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index c60f39025e809..df1608e01d92e 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -154,9 +154,6 @@ public function getForm(): TemplateResponse { 'website' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getValue(), 'websiteScope' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getScope(), 'websiteVerification' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getVerified(), - 'twitter' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getValue(), - 'twitterScope' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getScope(), - 'twitterVerification' => $account->getProperty(IAccountManager::PROPERTY_TWITTER)->getVerified(), 'groups' => $this->getGroups($user), 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), @@ -165,6 +162,7 @@ public function getForm(): TemplateResponse { $personalInfoParameters = [ 'userId' => $uid, 'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME), + 'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER), 'emailMap' => $this->getEmailMap($account), 'languageMap' => $this->getLanguageMap($user), 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), diff --git a/apps/settings/src/components/PersonalInfo/TwitterSection.vue b/apps/settings/src/components/PersonalInfo/TwitterSection.vue new file mode 100644 index 0000000000000..d7f0cdb23ff9f --- /dev/null +++ b/apps/settings/src/components/PersonalInfo/TwitterSection.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/apps/settings/src/main-personal-info.js b/apps/settings/src/main-personal-info.js index b133604a6acf9..1ebaae0fc8ea9 100644 --- a/apps/settings/src/main-personal-info.js +++ b/apps/settings/src/main-personal-info.js @@ -28,6 +28,7 @@ import '@nextcloud/dialogs/styles/toast.scss' import DisplayNameSection from './components/PersonalInfo/DisplayNameSection.vue' import EmailSection from './components/PersonalInfo/EmailSection/EmailSection.vue' +import TwitterSection from './components/PersonalInfo/TwitterSection.vue' import LanguageSection from './components/PersonalInfo/LanguageSection/LanguageSection.vue' import ProfileSection from './components/PersonalInfo/ProfileSection/ProfileSection.vue' import OrganisationSection from './components/PersonalInfo/OrganisationSection.vue' @@ -48,10 +49,12 @@ Vue.mixin({ const DisplayNameView = Vue.extend(DisplayNameSection) const EmailView = Vue.extend(EmailSection) +const TwitterView = Vue.extend(TwitterSection) const LanguageView = Vue.extend(LanguageSection) new DisplayNameView().$mount('#vue-displayname-section') new EmailView().$mount('#vue-email-section') +new TwitterView().$mount('#vue-twitter-section') new LanguageView().$mount('#vue-language-section') if (profileEnabledGlobally) { diff --git a/apps/settings/templates/settings/personal/personal.info.php b/apps/settings/templates/settings/personal/personal.info.php index 98009cc52be9d..973c98521f5ce 100644 --- a/apps/settings/templates/settings/personal/personal.info.php +++ b/apps/settings/templates/settings/personal/personal.info.php @@ -196,48 +196,7 @@
-
-

- - - - - - -

- -
- > - -
- - - - - -
+
diff --git a/dist/settings-vue-settings-personal-info.js b/dist/settings-vue-settings-personal-info.js index 45b05e7d93379..749eac519f5f7 100644 --- a/dist/settings-vue-settings-personal-info.js +++ b/dist/settings-vue-settings-personal-info.js @@ -1,3 +1,3 @@ /*! For license information please see settings-vue-settings-personal-info.js.LICENSE.txt */ -!function(){"use strict";var n,e={97045:function(n,e,r){var a,i,o,s,l=r(20144),c=r(22200),d=r(16453),u=r(9944),p=(r(73317),r(74854)),A=r(20296),f=r.n(A),m=r(26932),v=r(44254),g=r(13669),b=r(4820),h=r(79753),C=r(10128),y=r.n(C);function x(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}var E=Object.freeze({ADDRESS:"address",AVATAR:"avatar",BIOGRAPHY:"biography",DISPLAYNAME:"displayname",EMAIL_COLLECTION:"additional_mail",EMAIL:"email",HEADLINE:"headline",NOTIFICATION_EMAIL:"notify_email",ORGANISATION:"organisation",PHONE:"phone",PROFILE_ENABLED:"profile_enabled",ROLE:"role",TWITTER:"twitter",WEBSITE:"website"}),w=Object.freeze({ADDRESS:(0,u.translate)("settings","Address"),AVATAR:(0,u.translate)("settings","Avatar"),BIOGRAPHY:(0,u.translate)("settings","About"),DISPLAYNAME:(0,u.translate)("settings","Full name"),EMAIL_COLLECTION:(0,u.translate)("settings","Additional email"),EMAIL:(0,u.translate)("settings","Email"),HEADLINE:(0,u.translate)("settings","Headline"),ORGANISATION:(0,u.translate)("settings","Organisation"),PHONE:(0,u.translate)("settings","Phone number"),PROFILE_ENABLED:(0,u.translate)("settings","Profile"),ROLE:(0,u.translate)("settings","Role"),TWITTER:(0,u.translate)("settings","Twitter"),WEBSITE:(0,u.translate)("settings","Website")}),I=Object.freeze((x(a={},E.ADDRESS,w.ADDRESS),x(a,E.AVATAR,w.AVATAR),x(a,E.BIOGRAPHY,w.BIOGRAPHY),x(a,E.DISPLAYNAME,w.DISPLAYNAME),x(a,E.EMAIL_COLLECTION,w.EMAIL_COLLECTION),x(a,E.EMAIL,w.EMAIL),x(a,E.HEADLINE,w.HEADLINE),x(a,E.ORGANISATION,w.ORGANISATION),x(a,E.PHONE,w.PHONE),x(a,E.PROFILE_ENABLED,w.PROFILE_ENABLED),x(a,E.ROLE,w.ROLE),x(a,E.TWITTER,w.TWITTER),x(a,E.WEBSITE,w.WEBSITE),a)),O=Object.freeze({PROFILE_VISIBILITY:(0,u.translate)("settings","Profile visibility")}),P=Object.freeze((x(i={},w.ADDRESS,E.ADDRESS),x(i,w.AVATAR,E.AVATAR),x(i,w.BIOGRAPHY,E.BIOGRAPHY),x(i,w.DISPLAYNAME,E.DISPLAYNAME),x(i,w.EMAIL_COLLECTION,E.EMAIL_COLLECTION),x(i,w.EMAIL,E.EMAIL),x(i,w.HEADLINE,E.HEADLINE),x(i,w.ORGANISATION,E.ORGANISATION),x(i,w.PHONE,E.PHONE),x(i,w.PROFILE_ENABLED,E.PROFILE_ENABLED),x(i,w.ROLE,E.ROLE),x(i,w.TWITTER,E.TWITTER),x(i,w.WEBSITE,E.WEBSITE),i)),S=Object.freeze({LANGUAGE:"language"}),_=Object.freeze({LANGUAGE:(0,u.translate)("settings","Language")}),k=Object.freeze({PRIVATE:"v2-private",LOCAL:"v2-local",FEDERATED:"v2-federated",PUBLISHED:"v2-published"}),R=Object.freeze((x(o={},w.ADDRESS,[k.LOCAL,k.PRIVATE]),x(o,w.AVATAR,[k.LOCAL,k.PRIVATE]),x(o,w.BIOGRAPHY,[k.LOCAL,k.PRIVATE]),x(o,w.DISPLAYNAME,[k.LOCAL]),x(o,w.EMAIL_COLLECTION,[k.LOCAL]),x(o,w.EMAIL,[k.LOCAL]),x(o,w.HEADLINE,[k.LOCAL,k.PRIVATE]),x(o,w.ORGANISATION,[k.LOCAL,k.PRIVATE]),x(o,w.PHONE,[k.LOCAL,k.PRIVATE]),x(o,w.PROFILE_ENABLED,[k.LOCAL,k.PRIVATE]),x(o,w.ROLE,[k.LOCAL,k.PRIVATE]),x(o,w.TWITTER,[k.LOCAL,k.PRIVATE]),x(o,w.WEBSITE,[k.LOCAL,k.PRIVATE]),o)),L=Object.freeze([w.BIOGRAPHY,w.HEADLINE,w.ORGANISATION,w.ROLE]),B="Scope",D=Object.freeze((x(s={},k.PRIVATE,{name:k.PRIVATE,displayName:(0,u.translate)("settings","Private"),tooltip:(0,u.translate)("settings","Only visible to people matched via phone number integration through Talk on mobile"),tooltipDisabled:(0,u.translate)("settings","Not available as this property is required for core functionality including file sharing and calendar invitations"),iconClass:"icon-phone"}),x(s,k.LOCAL,{name:k.LOCAL,displayName:(0,u.translate)("settings","Local"),tooltip:(0,u.translate)("settings","Only visible to people on this instance and guests"),iconClass:"icon-password"}),x(s,k.FEDERATED,{name:k.FEDERATED,displayName:(0,u.translate)("settings","Federated"),tooltip:(0,u.translate)("settings","Only synchronize to trusted servers"),tooltipDisabled:(0,u.translate)("settings","Not available as publishing user specific data to the lookup server is not allowed, contact your system administrator if you have any questions"),iconClass:"icon-contacts-dark"}),x(s,k.PUBLISHED,{name:k.PUBLISHED,displayName:(0,u.translate)("settings","Published"),tooltip:(0,u.translate)("settings","Synchronize to trusted servers and the global and public address book"),tooltipDisabled:(0,u.translate)("settings","Not available as publishing user specific data to the lookup server is not allowed, contact your system administrator if you have any questions"),iconClass:"icon-link"}),s)),j=k.LOCAL,T=Object.freeze({NOT_VERIFIED:0,VERIFICATION_IN_PROGRESS:1,VERIFIED:2}),N=/^(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){255,})(?!(?:(?:\x22?\x5C[\x00-\x7E]\x22?)|(?:\x22?[^\x5C\x22]\x22?)){65,}@)(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22))(?:\.(?:(?:[\x21\x23-\x27\x2A\x2B\x2D\x2F-\x39\x3D\x3F\x5E-\x7E]+)|(?:\x22(?:[\x01-\x08\x0B\x0C\x0E-\x1F\x21\x23-\x5B\x5D-\x7F]|(?:\x5C[\x00-\x7F]))*\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\]))$/i;function Z(n,t,e,r,a,i,o){try{var s=n[i](o),l=s.value}catch(n){return void e(n)}s.done?t(l):Promise.resolve(l).then(r,a)}function U(n){return function(){var t=this,e=arguments;return new Promise((function(r,a){var i=n.apply(t,e);function o(n){Z(i,r,a,o,s,"next",n)}function s(n){Z(i,r,a,o,s,"throw",n)}o(void 0)}))}}var F=function(){var n=U(regeneratorRuntime.mark((function n(t,e){var r,a,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return"boolean"==typeof e&&(e=e?"1":"0"),r=(0,c.getCurrentUser)().uid,a=(0,h.generateOcsUrl)("cloud/users/{userId}",{userId:r}),n.next=5,y()();case 5:return n.next=7,b.default.put(a,{key:t,value:e});case 7:return i=n.sent,n.abrupt("return",i.data);case 9:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}(),M=function(){var n=U(regeneratorRuntime.mark((function n(t,e){var r,a,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=(0,c.getCurrentUser)().uid,a=(0,h.generateOcsUrl)("cloud/users/{userId}",{userId:r}),n.next=4,y()();case 4:return n.next=6,b.default.put(a,{key:"".concat(t).concat(B),value:e});case 6:return i=n.sent,n.abrupt("return",i.data);case 8:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}(),V=(0,r(17499).IY)().setApp("settings").detectUser().build();function H(n,t,e,r,a,i,o){try{var s=n[i](o),l=s.value}catch(n){return void e(n)}s.done?t(l):Promise.resolve(l).then(r,a)}function $(n){return function(){var t=this,e=arguments;return new Promise((function(r,a){var i=n.apply(t,e);function o(n){H(i,r,a,o,s,"next",n)}function s(n){H(i,r,a,o,s,"throw",n)}o(void 0)}))}}var q={name:"AccountPropertyInput",components:{AlertOctagon:g.Z,Check:v.default},props:{name:{type:String,required:!0},value:{type:String,required:!0},scope:{type:String,required:!0},readable:{type:String,required:!0},multiLineInput:{type:Boolean,default:!1},placeholder:{type:String,required:!0},emptyStringValid:{type:Boolean,default:!0},onSave:{type:Function,default:null}},data:function(){return{initialValue:this.value,localScope:this.scope,showCheckmarkIcon:!1,showErrorIcon:!1}},methods:{onPropertyChange:function(n){this.$emit("update:value",n.target.value),this.debouncePropertyChange(n.target.value.trim())},debouncePropertyChange:f()(function(){var n=$(regeneratorRuntime.mark((function n(t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.emptyStringValid){n.next=6;break}if(""===t){n.next=4;break}return n.next=4,this.updateProperty(t);case 4:n.next=8;break;case 6:return n.next=8,this.updateProperty(t);case 8:case"end":return n.stop()}}),n,this)})));return function(t){return n.apply(this,arguments)}}(),500),updateProperty:function(n){var e=this;return $(regeneratorRuntime.mark((function r(){var a,i,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,F(e.name,n);case 3:o=r.sent,e.handleResponse({value:n,status:null===(a=o.ocs)||void 0===a||null===(i=a.meta)||void 0===i?void 0:i.status}),r.next=10;break;case 7:r.prev=7,r.t0=r.catch(0),e.handleResponse({errorMessage:t("settings","Unable to update {property}",{property:e.readable.toLocaleLowerCase()}),error:r.t0});case 10:case"end":return r.stop()}}),r,null,[[0,7]])})))()},handleResponse:function(n){var t=this,e=n.value,r=n.status,a=n.errorMessage,i=n.error;"ok"===r?(this.initialValue=e,this.onSave&&this.onSave(e),this.showCheckmarkIcon=!0,setTimeout((function(){t.showCheckmarkIcon=!1}),2e3)):((0,m.x2)(a),V.error(a,i),this.showErrorIcon=!0,setTimeout((function(){t.showErrorIcon=!1}),2e3))},onScopeChange:function(n){this.$emit("update:scope",n)}}},G=q,z=r(93379),W=r.n(z),Y=r(7795),K=r.n(Y),Q=r(90569),J=r.n(Q),X=r(3565),nn=r.n(X),tn=r(19216),en=r.n(tn),rn=r(44589),an=r.n(rn),on=r(13079),sn={};sn.styleTagTransform=an(),sn.setAttributes=nn(),sn.insert=J().bind(null,"head"),sn.domAPI=K(),sn.insertStyleElement=en(),W()(on.Z,sn),on.Z&&on.Z.locals&&on.Z.locals;var ln=r(51900),cn=(0,ln.Z)(G,(function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("div",{staticClass:"property"},[n.multiLineInput?e("textarea",{attrs:{id:n.name,placeholder:n.placeholder,rows:"8",autocapitalize:"none",autocomplete:"off",autocorrect:"off"},domProps:{value:n.value},on:{input:n.onPropertyChange}}):e("input",{attrs:{id:n.name,type:"text",placeholder:n.placeholder,autocapitalize:"none",autocomplete:"on",autocorrect:"off"},domProps:{value:n.value},on:{input:n.onPropertyChange}}),n._v(" "),e("div",{staticClass:"property__actions-container"},[e("transition",{attrs:{name:"fade"}},[n.showCheckmarkIcon?e("Check",{attrs:{size:20}}):n.showErrorIcon?e("AlertOctagon",{attrs:{size:20}}):n._e()],1)],1)])}),[],!1,null,"58149dd0",null).exports,dn=r(1412),un=r.n(dn),pn=r(31209),An=r(79440),fn=r.n(An),mn=r(56286),vn=r.n(mn),gn={name:"FederationControlAction",components:{ActionButton:vn()},props:{activeScope:{type:String,required:!0},displayName:{type:String,required:!0},handleScopeChange:{type:Function,default:function(){}},iconClass:{type:String,required:!0},isSupportedScope:{type:Boolean,required:!0},name:{type:String,required:!0},tooltipDisabled:{type:String,default:""},tooltip:{type:String,required:!0}},methods:{updateScope:function(){this.handleScopeChange(this.name)}}},bn=r(12461),hn={};hn.styleTagTransform=an(),hn.setAttributes=nn(),hn.insert=J().bind(null,"head"),hn.domAPI=K(),hn.insertStyleElement=en(),W()(bn.Z,hn),bn.Z&&bn.Z.locals&&bn.Z.locals;var Cn=(0,ln.Z)(gn,(function(){var n=this,t=n.$createElement;return(n._self._c||t)("ActionButton",{staticClass:"federation-actions__btn",class:{"federation-actions__btn--active":n.activeScope===n.name},attrs:{"aria-label":n.isSupportedScope?n.tooltip:n.tooltipDisabled,"close-after-click":!0,disabled:!n.isSupportedScope,icon:n.iconClass,title:n.displayName},on:{click:function(t){return t.stopPropagation(),t.preventDefault(),n.updateScope.apply(null,arguments)}}},[n._v("\n\t"+n._s(n.isSupportedScope?n.tooltip:n.tooltipDisabled)+"\n")])}),[],!1,null,"d2e8b360",null),yn=Cn.exports;function xn(n,t,e,r,a,i,o){try{var s=n[i](o),l=s.value}catch(n){return void e(n)}s.done?t(l):Promise.resolve(l).then(r,a)}function En(n){return function(){var t=this,e=arguments;return new Promise((function(r,a){var i=n.apply(t,e);function o(n){xn(i,r,a,o,s,"next",n)}function s(n){xn(i,r,a,o,s,"throw",n)}o(void 0)}))}}function wn(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);en.length)&&(t=n.length);for(var e=0,r=new Array(t);en.length)&&(t=n.length);for(var e=0,r=new Array(t);e=i)&&Object.keys(a.O).every((function(n){return a.O[n](e[l])}))?e.splice(l--,1):(s=!1,i0&&n[d-1][2]>i;d--)n[d]=n[d-1];n[d]=[e,r,i]},a.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(t,{a:t}),t},a.d=function(n,t){for(var e in t)a.o(t,e)&&!a.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),a.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},a.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},a.nmd=function(n){return n.paths=[],n.children||(n.children=[]),n},a.j=4418,function(){a.b=document.baseURI||self.location.href;var n={4418:0};a.O.j=function(t){return 0===n[t]};var t=function(t,e){var r,i,o=e[0],s=e[1],l=e[2],c=0;if(o.some((function(t){return 0!==n[t]}))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(l)var d=l(a)}for(t&&t(e);cn.length)&&(t=n.length);for(var e=0,r=new Array(t);en.length)&&(t=n.length);for(var e=0,r=new Array(t);en.length)&&(t=n.length);for(var e=0,r=new Array(t);e=i)&&Object.keys(a.O).every((function(n){return a.O[n](e[l])}))?e.splice(l--,1):(s=!1,i0&&n[u-1][2]>i;u--)n[u]=n[u-1];n[u]=[e,r,i]},a.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(t,{a:t}),t},a.d=function(n,t){for(var e in t)a.o(t,e)&&!a.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),a.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},a.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},a.nmd=function(n){return n.paths=[],n.children||(n.children=[]),n},a.j=4418,function(){a.b=document.baseURI||self.location.href;var n={4418:0};a.O.j=function(t){return 0===n[t]};var t=function(t,e){var r,i,o=e[0],s=e[1],l=e[2],c=0;if(o.some((function(t){return 0!==n[t]}))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(l)var u=l(a)}for(t&&t(e);c 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","/**\n * @copyright 2021, Christopher Ng \n *\n * @author Christopher Ng \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\n/*\n * SYNC to be kept in sync with `lib/public/Accounts/IAccountManager.php`\n */\n\nimport { translate as t } from '@nextcloud/l10n'\n\n/** Enum of account properties */\nexport const ACCOUNT_PROPERTY_ENUM = Object.freeze({\n\tADDRESS: 'address',\n\tAVATAR: 'avatar',\n\tBIOGRAPHY: 'biography',\n\tDISPLAYNAME: 'displayname',\n\tEMAIL_COLLECTION: 'additional_mail',\n\tEMAIL: 'email',\n\tHEADLINE: 'headline',\n\tNOTIFICATION_EMAIL: 'notify_email',\n\tORGANISATION: 'organisation',\n\tPHONE: 'phone',\n\tPROFILE_ENABLED: 'profile_enabled',\n\tROLE: 'role',\n\tTWITTER: 'twitter',\n\tWEBSITE: 'website',\n})\n\n/** Enum of account properties to human readable account property names */\nexport const ACCOUNT_PROPERTY_READABLE_ENUM = Object.freeze({\n\tADDRESS: t('settings', 'Address'),\n\tAVATAR: t('settings', 'Avatar'),\n\tBIOGRAPHY: t('settings', 'About'),\n\tDISPLAYNAME: t('settings', 'Full name'),\n\tEMAIL_COLLECTION: t('settings', 'Additional email'),\n\tEMAIL: t('settings', 'Email'),\n\tHEADLINE: t('settings', 'Headline'),\n\tORGANISATION: t('settings', 'Organisation'),\n\tPHONE: t('settings', 'Phone number'),\n\tPROFILE_ENABLED: t('settings', 'Profile'),\n\tROLE: t('settings', 'Role'),\n\tTWITTER: t('settings', 'Twitter'),\n\tWEBSITE: t('settings', 'Website'),\n})\n\nexport const NAME_READABLE_ENUM = Object.freeze({\n\t[ACCOUNT_PROPERTY_ENUM.ADDRESS]: ACCOUNT_PROPERTY_READABLE_ENUM.ADDRESS,\n\t[ACCOUNT_PROPERTY_ENUM.AVATAR]: ACCOUNT_PROPERTY_READABLE_ENUM.AVATAR,\n\t[ACCOUNT_PROPERTY_ENUM.BIOGRAPHY]: ACCOUNT_PROPERTY_READABLE_ENUM.BIOGRAPHY,\n\t[ACCOUNT_PROPERTY_ENUM.DISPLAYNAME]: ACCOUNT_PROPERTY_READABLE_ENUM.DISPLAYNAME,\n\t[ACCOUNT_PROPERTY_ENUM.EMAIL_COLLECTION]: ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL_COLLECTION,\n\t[ACCOUNT_PROPERTY_ENUM.EMAIL]: ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL,\n\t[ACCOUNT_PROPERTY_ENUM.HEADLINE]: ACCOUNT_PROPERTY_READABLE_ENUM.HEADLINE,\n\t[ACCOUNT_PROPERTY_ENUM.ORGANISATION]: ACCOUNT_PROPERTY_READABLE_ENUM.ORGANISATION,\n\t[ACCOUNT_PROPERTY_ENUM.PHONE]: ACCOUNT_PROPERTY_READABLE_ENUM.PHONE,\n\t[ACCOUNT_PROPERTY_ENUM.PROFILE_ENABLED]: ACCOUNT_PROPERTY_READABLE_ENUM.PROFILE_ENABLED,\n\t[ACCOUNT_PROPERTY_ENUM.ROLE]: ACCOUNT_PROPERTY_READABLE_ENUM.ROLE,\n\t[ACCOUNT_PROPERTY_ENUM.TWITTER]: ACCOUNT_PROPERTY_READABLE_ENUM.TWITTER,\n\t[ACCOUNT_PROPERTY_ENUM.WEBSITE]: ACCOUNT_PROPERTY_READABLE_ENUM.WEBSITE,\n})\n\n/** Enum of profile specific sections to human readable names */\nexport const PROFILE_READABLE_ENUM = Object.freeze({\n\tPROFILE_VISIBILITY: t('settings', 'Profile visibility'),\n})\n\n/** Enum of readable account properties to account property keys used by the server */\nexport const PROPERTY_READABLE_KEYS_ENUM = Object.freeze({\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.ADDRESS]: ACCOUNT_PROPERTY_ENUM.ADDRESS,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.AVATAR]: ACCOUNT_PROPERTY_ENUM.AVATAR,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.BIOGRAPHY]: ACCOUNT_PROPERTY_ENUM.BIOGRAPHY,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.DISPLAYNAME]: ACCOUNT_PROPERTY_ENUM.DISPLAYNAME,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL_COLLECTION]: ACCOUNT_PROPERTY_ENUM.EMAIL_COLLECTION,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL]: ACCOUNT_PROPERTY_ENUM.EMAIL,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.HEADLINE]: ACCOUNT_PROPERTY_ENUM.HEADLINE,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.ORGANISATION]: ACCOUNT_PROPERTY_ENUM.ORGANISATION,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.PHONE]: ACCOUNT_PROPERTY_ENUM.PHONE,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.PROFILE_ENABLED]: ACCOUNT_PROPERTY_ENUM.PROFILE_ENABLED,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.ROLE]: ACCOUNT_PROPERTY_ENUM.ROLE,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.TWITTER]: ACCOUNT_PROPERTY_ENUM.TWITTER,\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.WEBSITE]: ACCOUNT_PROPERTY_ENUM.WEBSITE,\n})\n\n/**\n * Enum of account setting properties\n *\n * Account setting properties unlike account properties do not support scopes*\n */\nexport const ACCOUNT_SETTING_PROPERTY_ENUM = Object.freeze({\n\tLANGUAGE: 'language',\n})\n\n/** Enum of account setting properties to human readable setting properties */\nexport const ACCOUNT_SETTING_PROPERTY_READABLE_ENUM = Object.freeze({\n\tLANGUAGE: t('settings', 'Language'),\n})\n\n/** Enum of scopes */\nexport const SCOPE_ENUM = Object.freeze({\n\tPRIVATE: 'v2-private',\n\tLOCAL: 'v2-local',\n\tFEDERATED: 'v2-federated',\n\tPUBLISHED: 'v2-published',\n})\n\n/** Enum of readable account properties to supported scopes */\nexport const PROPERTY_READABLE_SUPPORTED_SCOPES_ENUM = Object.freeze({\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.ADDRESS]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.AVATAR]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.BIOGRAPHY]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.DISPLAYNAME]: [SCOPE_ENUM.LOCAL],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL_COLLECTION]: [SCOPE_ENUM.LOCAL],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.EMAIL]: [SCOPE_ENUM.LOCAL],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.HEADLINE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.ORGANISATION]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.PHONE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.PROFILE_ENABLED]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.ROLE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.TWITTER]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n\t[ACCOUNT_PROPERTY_READABLE_ENUM.WEBSITE]: [SCOPE_ENUM.LOCAL, SCOPE_ENUM.PRIVATE],\n})\n\n/** List of readable account properties which aren't published to the lookup server */\nexport const UNPUBLISHED_READABLE_PROPERTIES = Object.freeze([\n\tACCOUNT_PROPERTY_READABLE_ENUM.BIOGRAPHY,\n\tACCOUNT_PROPERTY_READABLE_ENUM.HEADLINE,\n\tACCOUNT_PROPERTY_READABLE_ENUM.ORGANISATION,\n\tACCOUNT_PROPERTY_READABLE_ENUM.ROLE,\n])\n\n/** Scope suffix */\nexport const SCOPE_SUFFIX = 'Scope'\n\n/**\n * Enum of scope names to properties\n *\n * Used for federation control*\n */\nexport const SCOPE_PROPERTY_ENUM = Object.freeze({\n\t[SCOPE_ENUM.PRIVATE]: {\n\t\tname: SCOPE_ENUM.PRIVATE,\n\t\tdisplayName: t('settings', 'Private'),\n\t\ttooltip: t('settings', 'Only visible to people matched via phone number integration through Talk on mobile'),\n\t\ttooltipDisabled: t('settings', 'Not available as this property is required for core functionality including file sharing and calendar invitations'),\n\t\ticonClass: 'icon-phone',\n\t},\n\t[SCOPE_ENUM.LOCAL]: {\n\t\tname: SCOPE_ENUM.LOCAL,\n\t\tdisplayName: t('settings', 'Local'),\n\t\ttooltip: t('settings', 'Only visible to people on this instance and guests'),\n\t\t// tooltipDisabled is not required here as this scope is supported by all account properties\n\t\ticonClass: 'icon-password',\n\t},\n\t[SCOPE_ENUM.FEDERATED]: {\n\t\tname: SCOPE_ENUM.FEDERATED,\n\t\tdisplayName: t('settings', 'Federated'),\n\t\ttooltip: t('settings', 'Only synchronize to trusted servers'),\n\t\ttooltipDisabled: t('settings', 'Not available as publishing user specific data to the lookup server is not allowed, contact your system administrator if you have any questions'),\n\t\ticonClass: 'icon-contacts-dark',\n\t},\n\t[SCOPE_ENUM.PUBLISHED]: {\n\t\tname: SCOPE_ENUM.PUBLISHED,\n\t\tdisplayName: t('settings', 'Published'),\n\t\ttooltip: t('settings', 'Synchronize to trusted servers and the global and public address book'),\n\t\ttooltipDisabled: t('settings', 'Not available as publishing user specific data to the lookup server is not allowed, contact your system administrator if you have any questions'),\n\t\ticonClass: 'icon-link',\n\t},\n})\n\n/** Default additional email scope */\nexport const DEFAULT_ADDITIONAL_EMAIL_SCOPE = SCOPE_ENUM.LOCAL\n\n/** Enum of verification constants, according to IAccountManager */\nexport const VERIFICATION_ENUM = Object.freeze({\n\tNOT_VERIFIED: 0,\n\tVERIFICATION_IN_PROGRESS: 1,\n\tVERIFIED: 2,\n})\n\n/**\n * Email validation regex\n *\n * Sourced from https://github.com/mpyw/FILTER_VALIDATE_EMAIL.js/blob/71e62ca48841d2246a1b531e7e84f5a01f15e615/src/regexp/ascii.ts*\n */\n// eslint-disable-next-line no-control-regex\nexport const VALIDATE_EMAIL_REGEX = /^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/i\n","/**\n * @copyright 2021, Christopher Ng \n *\n * @author Christopher Ng \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport axios from '@nextcloud/axios'\nimport { getCurrentUser } from '@nextcloud/auth'\nimport { generateOcsUrl } from '@nextcloud/router'\nimport confirmPassword from '@nextcloud/password-confirmation'\n\nimport { SCOPE_SUFFIX } from '../../constants/AccountPropertyConstants'\n\n/**\n * Save the primary account property value for the user\n *\n * @param {string} accountProperty the account property\n * @param {string|boolean} value the primary value\n * @return {object}\n */\nexport const savePrimaryAccountProperty = async (accountProperty, value) => {\n\t// TODO allow boolean values on backend route handler\n\t// Convert boolean to string for compatibility\n\tif (typeof value === 'boolean') {\n\t\tvalue = value ? '1' : '0'\n\t}\n\n\tconst userId = getCurrentUser().uid\n\tconst url = generateOcsUrl('cloud/users/{userId}', { userId })\n\n\tawait confirmPassword()\n\n\tconst res = await axios.put(url, {\n\t\tkey: accountProperty,\n\t\tvalue,\n\t})\n\n\treturn res.data\n}\n\n/**\n * Save the federation scope of the primary account property for the user\n *\n * @param {string} accountProperty the account property\n * @param {string} scope the federation scope\n * @return {object}\n */\nexport const savePrimaryAccountPropertyScope = async (accountProperty, scope) => {\n\tconst userId = getCurrentUser().uid\n\tconst url = generateOcsUrl('cloud/users/{userId}', { userId })\n\n\tawait confirmPassword()\n\n\tconst res = await axios.put(url, {\n\t\tkey: `${accountProperty}${SCOPE_SUFFIX}`,\n\t\tvalue: scope,\n\t})\n\n\treturn res.data\n}\n","/**\n * @copyright 2020 Christoph Wurst \n *\n * @author Roeland Jago Douma \n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n *\n */\n\nimport { getLoggerBuilder } from '@nextcloud/logger'\n\nexport default getLoggerBuilder()\n\t.setApp('settings')\n\t.detectUser()\n\t.build()\n","\n\n