5 lines
3.7 KiB
JavaScript
5 lines
3.7 KiB
JavaScript
"use strict";(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push([[58635,80223],{758635:(t,e,n)=>{n.d(e,{W:()=>u});var r=n(281110),i=n(744564),o=n(239734),f=n(2590);function u(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(o.Z.needsRefresh()){i.Z.dispatch({type:"LOAD_USER_AFFINITIES"});return r.Z.get({url:f.ANM.USER_AFFINITIES,retries:t?3:0,oldFormErrors:!0}).then((function(t){var e=t.body;i.Z.dispatch({type:"LOAD_USER_AFFINITIES_SUCCESS",affinities:e})}),(function(){i.Z.dispatch({type:"LOAD_USER_AFFINITIES_FAILURE"})}))}return Promise.resolve()}},239734:(t,e,n)=>{n.d(e,{Z:()=>b});var r=n(202351),i=n(744564),o=n(840922);function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n;return t}function c(t){c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)}
|
|
;return c(t)}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))));r.forEach((function(e){u(t,e,n[e])}))}return t}function a(t,e){return!e||"object"!==p(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function l(t,e){l=Object.setPrototypeOf||function(t,e){t.__proto__=e;return t};return l(t,e)}var p=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};function y(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})));return!0}catch(t){return!1}}()
|
|
;return function(){var n,r=c(t);if(e){var i=c(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return a(this,n)}}var d=864e5,h=!1,_=Object.freeze({userAffinities:[],affinityUserIds:new Set,lastFetched:0}),S=s({},_);function I(){S.affinityUserIds=new Set(S.userAffinities.map((function(t){return t.user_id})).filter((function(t){return!o.Z.isBlocked(t)})))}var A=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}});e&&l(t,e)}(n,t);var e=y(n);function n(){f(this,n);return e.apply(this,arguments)}var r=n.prototype;r.initialize=function(t){this.waitFor(o.Z);if(null!=t){S.userAffinities=t.userAffinities;S.affinityUserIds=new Set(t.affinityUserIds);S.lastFetched=t.lastFetched}this.syncWith([o.Z],I)};r.needsRefresh=function(){return Date.now()-S.lastFetched>d};r.getFetching=function(){
|
|
return h};r.getState=function(){return S};r.getUserAffinities=function(){return S.userAffinities};r.getUserAffinitiesUserIds=function(){return S.affinityUserIds};r.__getLocalVars=function(){return{USER_AFFINITY_TTL:d,fetching:h,DEFAULT_AFFINITY_STORE_STATE:_,state:S}};return n}(r.ZP.PersistedStore);A.displayName="UserAffinitiesStore";A.persistKey="UserAffinitiesStore";A.migrations=[function(t){return null}];const b=new A(i.Z,{LOAD_USER_AFFINITIES_SUCCESS:function(t){var e,n=t.affinities;S.userAffinities=null!==(e=n.user_affinities)&&void 0!==e?e:[];S.lastFetched=Date.now();I();h=!1},LOAD_USER_AFFINITIES:function(){h=!0},LOAD_USER_AFFINITIES_FAILURE:function(){h=!1},LOGOUT:function(){S=s({},_)}})}}]);
|
|
//# sourceMappingURL=792f4cb5a957b505a141.js.map
|