Skip to content

Commit

Permalink
[fix] comment paging and count (#4459)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta committed Nov 10, 2017
1 parent e617dfb commit 92c62a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions frappe/desk/form/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def get_docinfo(doc=None, doctype=None, name=None):
frappe.response["docinfo"] = {
"attachments": get_attachments(doc.doctype, doc.name),
"communications": _get_communications(doc.doctype, doc.name),
'total_comments': len(json.loads(doc.get('_comments') or '[]')),
'versions': get_versions(doc),
"assignments": get_assignments(doc.doctype, doc.name),
"permissions": get_doc_permissions(doc),
Expand Down
4 changes: 4 additions & 0 deletions frappe/public/js/frappe/form/footer/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ frappe.ui.form.Timeline = Class.extend({
var communications = me.get_communications().concat(new_communications);
frappe.model.set_docinfo(me.frm.doc.doctype, me.frm.doc.name, "communications", communications);

if (new_communications.length < 20) {
me.more = false;
}

} else {
me.more = false;
}
Expand Down
4 changes: 2 additions & 2 deletions frappe/public/js/frappe/form/form_sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ frappe.ui.form.Sidebar = Class.extend({
},

refresh_comments: function() {
var comments = $.map(this.frm.timeline.get_communications(), function(c) {
$.map(this.frm.timeline.get_communications(), function(c) {
return (c.communication_type==="Communication" || (c.communication_type=="Comment" && c.comment_type==="Comment")) ? c : null;
});
this.comments.find(".n-comments").html(comments.length);
this.comments.find(".n-comments").html(this.frm.get_docinfo().total_comments);
},

make_tags: function() {
Expand Down

0 comments on commit 92c62a1

Please sign in to comment.