Refresh friends loading indicator, refresh notifications fixes

This commit is contained in:
Natsumi
2021-07-17 08:24:12 +12:00
parent ca8f1e3e65
commit 16a1190e1d
2 changed files with 22 additions and 26 deletions
+21 -25
View File
@@ -1782,10 +1782,15 @@ speechSynthesis.getVoices();
} }
}); });
API.isRefreshFriendsLoading = false;
API.refreshFriends = async function () { API.refreshFriends = async function () {
this.isRefreshFriendsLoading = true;
var onlineFriends = await this.refreshOnlineFriends(); var onlineFriends = await this.refreshOnlineFriends();
var offlineFriends = await this.refreshOfflineFriends(); var offlineFriends = await this.refreshOfflineFriends();
return onlineFriends.concat(offlineFriends); var friends = onlineFriends.concat(offlineFriends);
this.isRefreshFriendsLoading = false;
return friends;
}; };
API.refreshOnlineFriends = async function () { API.refreshOnlineFriends = async function () {
@@ -2238,33 +2243,24 @@ speechSynthesis.getVoices();
} }
}; };
API.refreshNotifications = function () { API.refreshNotifications = async function () {
// NOTE : 캐시 때문에 after=~ 로는 갱신이 안됨. 그래서 첨부터 불러옴
if (this.isNotificationsLoading) {
return;
}
this.isNotificationsLoading = true; this.isNotificationsLoading = true;
this.expireNotifications(); this.expireNotifications();
this.expireNotifications(); var params = {
this.getNotifications({ n: 100 }).then(() => { n: 100,
this.deleteExpiredNotifcations(); offset: 0
this.isNotificationsLoading = false; };
var count = 50; //5000 max
for (var i = 0; i < count; i++) {
var args = await this.getNotifications(params);
$app.unseenNotifications = []; $app.unseenNotifications = [];
}); params.offset += 100;
// this.bulk({ if (args.json.length < 100) {
// fn: 'getNotifications', break;
// N: -1, }
// params: { }
// n: 50, this.deleteExpiredNotifcations();
// offset: 0 this.isNotificationsLoading = false;
// },
// done(ok) {
// if (ok) {
// this.deleteExpiredNotifcations();
// }
// this.isNotificationsLoading = false;
// }
// });
}; };
/* /*
+1 -1
View File
@@ -903,7 +903,7 @@ html
el-tooltip(placement="bottom" content="Direct access ID/URL" :disabled="hideTooltips") el-tooltip(placement="bottom" content="Direct access ID/URL" :disabled="hideTooltips")
el-button(type="default" @click="promptOmniDirectDialog()" size="mini" icon="el-icon-discover" circle) el-button(type="default" @click="promptOmniDirectDialog()" size="mini" icon="el-icon-discover" circle)
el-tooltip(placement="bottom" content="Refresh friends" :disabled="hideTooltips") el-tooltip(placement="bottom" content="Refresh friends" :disabled="hideTooltips")
el-button(type="default" @click="API.getCurrentUser(); API.refreshFriends()" size="mini" icon="el-icon-refresh" circle) el-button(type="default" @click="API.getCurrentUser(); API.refreshFriends()" :loading="API.isRefreshFriendsLoading" size="mini" icon="el-icon-refresh" circle style="margin-right:10px")
.x-friend-list(style="padding-bottom:10px") .x-friend-list(style="padding-bottom:10px")
.x-friend-group .x-friend-group
i.el-icon-arrow-right(:class="{ rotate: isFriendsGroupMe }") i.el-icon-arrow-right(:class="{ rotate: isFriendsGroupMe }")