Fix social page reload issue (#6395)
This commit is contained in:
parent
e3f2ea8c2c
commit
ff59b9e7c2
3 changed files with 15 additions and 9 deletions
|
|
@ -13,6 +13,10 @@ frappe.view_factories = [];
|
|||
frappe.route_options = null;
|
||||
|
||||
frappe.route = function() {
|
||||
|
||||
// Application is not yet initiated
|
||||
if (!frappe.app) return;
|
||||
|
||||
if(frappe.re_route[window.location.hash] !== undefined) {
|
||||
// after saving a doc, for example,
|
||||
// "New DocType 1" and the renamed "TestDocType", both exist in history
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<template>
|
||||
<div>
|
||||
<post :post="post" v-for="post in posts" :key="post.name"></post>
|
||||
<transition-group name="flip-list">
|
||||
<post :post="post" v-for="post in posts" :key="post.name"></post>
|
||||
</transition-group>
|
||||
<div v-if="!loading_posts && !posts.length" class="no-post-message text-muted">
|
||||
{{ __('No posts yet') }}
|
||||
</div>
|
||||
<div v-show="loading_posts" class="text-center padding">{{ __('Loading posts...') }}</div>
|
||||
<div v-show="loading_posts" class="text-center padding">{{ __('Fetching posts...') }}</div>
|
||||
<div
|
||||
v-show="posts.length && !more_posts_available"
|
||||
class="text-center padding">
|
||||
|
|
@ -54,8 +56,9 @@ export default {
|
|||
order_by: 'is_globally_pinned desc, creation desc',
|
||||
})
|
||||
},
|
||||
update_posts(load_old=false) {
|
||||
update_posts(load_old = false) {
|
||||
if (!this.post_list_filter) return
|
||||
this.loading_posts = true;
|
||||
|
||||
const filters = Object.assign({}, this.post_list_filter);
|
||||
|
||||
|
|
@ -68,14 +71,14 @@ export default {
|
|||
} else {
|
||||
this.posts = res;
|
||||
}
|
||||
}).finally(() => {
|
||||
this.loading_posts = false;
|
||||
});
|
||||
},
|
||||
handle_scroll: frappe.utils.debounce(function() {
|
||||
const screen_bottom = document.documentElement.scrollTop + window.innerHeight === document.documentElement.offsetHeight;
|
||||
if (screen_bottom && this.more_posts_available) {
|
||||
if (this.more_posts_available && !this.loading_posts) {
|
||||
this.loading_posts = true;
|
||||
if (!this.loading_posts) {
|
||||
this.update_posts(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -93,4 +96,7 @@ export default {
|
|||
vertical-align: middle;
|
||||
line-height: 200px;
|
||||
}
|
||||
.flip-list-move {
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ frappe.social.update_user_image = new frappe.ui.Dialog({
|
|||
],
|
||||
primary_action_label: __('Set Image'),
|
||||
primary_action: (values) => {
|
||||
// TODO: check for a better fix
|
||||
if (!frappe.session.user) {
|
||||
frappe.session.user = frappe.boot.user.name;
|
||||
}
|
||||
const user = frappe.session.user;
|
||||
frappe.db.set_value('User', user, 'user_image', values.image)
|
||||
.then((resp) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue