mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Changed private message" button to use <a href> to open Private Messa… (#12010)
* Changed private message" button to use <a href> to open Private Message page in same tab. Changed private message" button to use <a href> to open Private Message page in same tab with normal mouse click, and open in a new tab with right mouse click mouse context menu. * Use router-link and navigation guard as requested. Change from <a href to router-link in profile.vue and use navigation guard to obtain selected user data from server instead of doing so in mount method as requested. * Added habitica::dismiss-modal to hide members modal * Suggestion from lint * Use replace in router-link to as per suggestion * Suggestion by lint * Remove sendMessage function in profile.vue as suggested in PR review
This commit is contained in:
@@ -608,6 +608,23 @@ export default {
|
||||
MAX_MESSAGE_LENGTH: MAX_MESSAGE_LENGTH.toString(),
|
||||
};
|
||||
},
|
||||
beforeRouteEnter (to, from, next) {
|
||||
next(vm => {
|
||||
const data = vm.$store.state.privateMessageOptions;
|
||||
|
||||
if ((!data || (data && !data.userIdToMessage)) && vm.$route.query && vm.$route.query.uuid) {
|
||||
vm.$store.dispatch('user:userLookup', { uuid: vm.$route.query.uuid }).then(res => {
|
||||
if (res && res.data && res.data.data) {
|
||||
vm.$store.dispatch('user:newPrivateMessageTo', {
|
||||
member: res.data.data,
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.hasPrivateMessageOptionsOnPageLoad = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
async mounted () {
|
||||
// notification click to refresh
|
||||
this.$root.$on(EVENTS.PM_REFRESH, async () => {
|
||||
@@ -625,8 +642,11 @@ export default {
|
||||
|
||||
await this.reload();
|
||||
|
||||
const data = this.$store.state.privateMessageOptions;
|
||||
// close members modal if the Private Messages page is opened in an existing tab
|
||||
this.$root.$emit('habitica::dismiss-modal', 'profile');
|
||||
this.$root.$emit('habitica::dismiss-modal', 'members-modal');
|
||||
|
||||
const data = this.$store.state.privateMessageOptions;
|
||||
if (data && data.userIdToMessage) {
|
||||
this.initiatedConversation = {
|
||||
uuid: data.userIdToMessage,
|
||||
|
||||
Reference in New Issue
Block a user