diff --git a/html/src/app.js b/html/src/app.js index 328942cc..f15c6a6f 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -413,9 +413,6 @@ speechSynthesis.getVoices(); } throw new Error('401: Missing Credentials'); } - if ((status === 403) && (data.error.message === '403 You can\'t see another user\'s favorites') ) { - throw new Error('403: User\'s avatar list isn\'t public'); - } if (data.error === Object(data.error)) { this.$throw( data.error.status_code || status, @@ -5286,11 +5283,17 @@ speechSynthesis.getVoices(); } }; + $app.data.updateFriendInProgress = new Set(); + $app.methods.updateFriend = async function (id, state, origin) { var ctx = this.friends.get(id); if (typeof ctx === 'undefined') { return; } + if (this.updateFriendInProgress.has(id)) { + return; + } + this.updateFriendInProgress.add(id); var ref = API.cachedUsers.get(id); var isVIP = API.cachedFavoritesByObjectId.has(id); if (typeof state === 'undefined' || @@ -5364,10 +5367,13 @@ speechSynthesis.getVoices(); ref.location !== 'private') { API.getUser({ userId: id + }).catch((err) => { + this.updateFriendInProgress.remove(id); }); } } else { if (ctx.state === 'online' && state === 'active') { + this.updateFriendInProgress.delete(id); await new Promise(resolve => setTimeout(resolve, 50000)); if (this.APILastOnline.has(id)) { var date = this.APILastOnline.get(id); @@ -5391,9 +5397,16 @@ speechSynthesis.getVoices(); removeFromArray(this.friendsGroup3_, ctx); removeFromArray(this.friendsGroupD_, ctx); } - var { location, $location_at } = ref; + var location = ''; + var $location_at = ''; + if ((typeof ref !== 'undefined') && + (typeof ref.location !== 'undefined')) { + var { location, $location_at } = ref; + } var args = await API.getUser({ userId: id + }).catch((err) => { + this.updateFriendInProgress.remove(id); }); if ((typeof args !== 'undefined') && (typeof args.ref !== 'undefined')) { @@ -5458,6 +5471,7 @@ speechSynthesis.getVoices(); this.friendsGroupD_.unshift(ctx); } } + this.updateFriendInProgress.delete(id); }; // ascending