fix 9351: sync player that casts spells immediately (#12367)

This commit is contained in:
Matteo Pagliazzi
2020-07-05 00:01:02 +02:00
committed by GitHub
parent a388abc124
commit 45a22470fa
2 changed files with 11 additions and 8 deletions
+6 -2
View File
@@ -369,7 +369,6 @@ export default {
const isApiCall = url.indexOf('api/v4') !== -1;
const userV = response.data && response.data.userV;
const isCron = url.indexOf('/api/v4/cron') === 0 && method === 'post';
if (this.isUserLoaded && isApiCall && userV) {
const oldUserV = this.user._v;
@@ -381,9 +380,14 @@ export default {
// exclude chat seen requests because with real time chat they would be too many
const isChatSeen = url.indexOf('/chat/seen') !== -1 && method === 'post';
// exclude POST /api/v4/cron because the user is synced automatically after cron runs
const isCron = url.indexOf('/api/v4/cron') === 0 && method === 'post';
// exclude skills casting as they already return the synced user
const isCast = url.indexOf('/api/v4/user/class/cast') !== -1 && method === 'post';
// Something has changed on the user object that was not tracked here, sync the user
if (userV - oldUserV > 1 && !isCron && !isChatSeen && !isUserSync && !isTasksSync) {
if (
userV - oldUserV > 1 && !isCron && !isChatSeen && !isUserSync && !isTasksSync && !isCast
) {
Promise.all([
this.$store.dispatch('user:fetch', { forceLoad: true }),
this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true }),
+5 -6
View File
@@ -137,6 +137,11 @@ export default {
targetId,
pinType: spell.pinType,
});
if (apiResult.data.data.user) {
Object.assign(this.$store.state.user.data, apiResult.data.data.user);
}
let msg = '';
switch (type) {
@@ -166,12 +171,6 @@ export default {
break;
}
if (spell.pinType === 'card') {
const newUserGp = apiResult.data.data.user.stats.gp;
this.$store.state.user.data.stats.gp = newUserGp;
}
this.markdown(msg); // @TODO: mardown directive?
const questProgress = this.questProgress() - beforeQuestProgress;