From 087dd4308336734b35758501ea259ee293494504 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Thu, 23 Mar 2017 14:48:24 +0530 Subject: [PATCH] [minor] fixes in activity page rendering, ignored emails from activity (#2887) --- frappe/desk/page/activity/activity.js | 14 ++++++++++---- frappe/desk/page/activity/activity.py | 20 ++++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/frappe/desk/page/activity/activity.js b/frappe/desk/page/activity/activity.js index 8611d74e3d..bf3ccfc08c 100644 --- a/frappe/desk/page/activity/activity.js +++ b/frappe/desk/page/activity/activity.js @@ -12,17 +12,23 @@ frappe.pages['activity'].on_page_load = function(wrapper) { }); me.page = wrapper.page; - me.page.set_title(__("Activity")); frappe.model.with_doctype("Communication", function() { - me.page.list = new frappe.ui.Listing({ + me.page.list = new frappe.ui.BaseList({ hide_refresh: true, page: me.page, method: 'frappe.desk.page.activity.activity.get_feed', parent: $("
").appendTo(me.page.main), - render_row: function(row, data) { - new frappe.activity.Feed(row, data); + render_view: function (values) { + var me = this; + wrapper = me.page.main.find(".result-list").get(0) + values.map(function (value) { + var row = $('
') + .data("data", value) + .appendTo($(wrapper)).get(0); + new frappe.activity.Feed(row, value); + }); }, show_filters: true, doctype: "Communication", diff --git a/frappe/desk/page/activity/activity.py b/frappe/desk/page/activity/activity.py index a4be06d7a7..94b0296b6f 100644 --- a/frappe/desk/page/activity/activity.py +++ b/frappe/desk/page/activity/activity.py @@ -7,7 +7,7 @@ from frappe.utils import cint from frappe.core.doctype.communication.feed import get_feed_match_conditions @frappe.whitelist() -def get_feed(limit_start, limit_page_length, show_likes=False): +def get_feed(start, page_length, show_likes=False): """get feed""" match_conditions = get_feed_match_conditions(frappe.session.user) @@ -17,18 +17,19 @@ def get_feed(limit_start, limit_page_length, show_likes=False): from `tabCommunication` where communication_type in ("Communication", "Comment") + and communication_medium != "Email" and (comment_type is null or comment_type != "Like" or (comment_type="Like" and (owner=%(user)s or reference_owner=%(user)s))) {match_conditions} {show_likes} order by creation desc - limit %(limit_start)s, %(limit_page_length)s""" + limit %(start)s, %(page_length)s""" .format(match_conditions="and {0}".format(match_conditions) if match_conditions else "", show_likes="and comment_type='Like'" if show_likes else ""), { "user": frappe.session.user, - "limit_start": cint(limit_start), - "limit_page_length": cint(limit_page_length) + "start": cint(start), + "page_length": cint(page_length) }, as_dict=True) if show_likes: @@ -39,22 +40,13 @@ def get_feed(limit_start, limit_page_length, show_likes=False): return result -@frappe.whitelist() -def get_months_activity(): - return frappe.db.sql("""select date(creation), count(name) - from `tabCommunication` - where - communication_type in ("Communication", "Comment") - and date(creation) > subdate(curdate(), interval 1 month) - group by date(creation) - order by creation asc""", as_list=1) - @frappe.whitelist() def get_heatmap_data(): return dict(frappe.db.sql("""select unix_timestamp(date(creation)), count(name) from `tabCommunication` where communication_type in ("Communication", "Comment") + and communication_medium != "Email" and date(creation) > subdate(curdate(), interval 1 year) group by date(creation) order by creation asc""")) \ No newline at end of file