mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Make message links to deleted profiles display 404: (fixes 11020) (#12229)
* Make links to deleted profiles display 404
* Implement some requested changes
- remove comments
- remove 'await'
- rename error -> 404error
- remove catch block -> just check for 404
* Fix bug: Logged in user profile showing 404
- Initiallty logged in user will display fine
- This bug only appeared after you view a deleted users modal
* Remove 'user.active' attribute
- add change to data():
- user: undefined -> user: {}
* Shorten showMemberModal()
- Remove unused fetch profile data
- Remove unnecessary conditional
* Change user initial value to null
- Add userLoaded to data
This commit is contained in:
@@ -310,27 +310,7 @@ export default {
|
||||
return false;
|
||||
},
|
||||
async showMemberModal (memberId) {
|
||||
let profile = this.cachedProfileData[memberId];
|
||||
|
||||
if (!profile._id) {
|
||||
const result = await this.$store.dispatch('members:fetchMember', { memberId });
|
||||
if (result.response && result.response.status === 404) {
|
||||
this.$store.dispatch('snackbars:add', {
|
||||
title: 'Habitica',
|
||||
text: this.$t('messageDeletedUser'),
|
||||
type: 'error',
|
||||
timeout: false,
|
||||
});
|
||||
} else {
|
||||
this.cachedProfileData[memberId] = result.data.data;
|
||||
profile = result.data.data;
|
||||
}
|
||||
}
|
||||
|
||||
// Open the modal only if the data is available
|
||||
if (profile && !profile.rejected) {
|
||||
this.$router.push({ name: 'userProfile', params: { userId: profile._id } });
|
||||
}
|
||||
this.$router.push({ name: 'userProfile', params: { userId: memberId } });
|
||||
},
|
||||
itemWasMounted: debounce(function itemWasMounted () {
|
||||
if (this.handleScrollBack) {
|
||||
|
||||
Reference in New Issue
Block a user