Skip to content

Commit

Permalink
fix: stabilize shared with dialog (frappe#19186)
Browse files Browse the repository at this point in the history
(cherry picked from commit 19588b2)

Co-authored-by: phot0n <ritwikpuri5678@gmail.com>
  • Loading branch information
mergify[bot] and phot0n committed Dec 8, 2022
1 parent 0f44bbd commit c013d11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions frappe/public/js/frappe/form/sidebar/share.js
Expand Up @@ -17,9 +17,12 @@ frappe.ui.form.Share = class Share {
this.parent.find(".share-doc-btn").hide();
}

this.parent.find(".share-doc-btn").on("click", () => {
this.frm.share_doc();
});
this.parent
.find(".share-doc-btn")
.off("click")
.on("click", () => {
this.frm.share_doc();
});

this.shares.empty();

Expand All @@ -41,6 +44,8 @@ frappe.ui.form.Share = class Share {
this.dialog = d;
this.dirty = false;

$(d.body).html('<p class="text-muted">' + __("Loading...") + "</p>");

frappe.call({
method: "frappe.share.get_users",
args: {
Expand All @@ -52,8 +57,6 @@ frappe.ui.form.Share = class Share {
},
});

$(d.body).html('<p class="text-muted">' + __("Loading...") + "</p>");

d.onhide = function () {
// reload comments
if (me.dirty) me.frm.sidebar.reload_docinfo();
Expand Down Expand Up @@ -188,7 +191,6 @@ frappe.ui.form.Share = class Share {
}

me.dirty = true;
me.render_shared();
me.frm.shared.refresh();
},
});
Expand Down
2 changes: 1 addition & 1 deletion frappe/share.py
Expand Up @@ -82,7 +82,7 @@ def remove(doctype, name, user, flags=None):
@frappe.whitelist()
def set_permission(doctype, name, user, permission_to, value=1, everyone=0):
"""Expose function without flags to the client-side"""
set_docshare_permission(doctype, name, user, permission_to, value=value, everyone=everyone)
return set_docshare_permission(doctype, name, user, permission_to, value=value, everyone=everyone)


def set_docshare_permission(doctype, name, user, permission_to, value=1, everyone=0, flags=None):
Expand Down

0 comments on commit c013d11

Please sign in to comment.