[minor] fixes in activity page rendering, ignored emails from activity (#2887)
This commit is contained in:
parent
20bb54592b
commit
087dd43083
2 changed files with 16 additions and 18 deletions
|
|
@ -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: $("<div></div>").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 = $('<div class="list-row">')
|
||||
.data("data", value)
|
||||
.appendTo($(wrapper)).get(0);
|
||||
new frappe.activity.Feed(row, value);
|
||||
});
|
||||
},
|
||||
show_filters: true,
|
||||
doctype: "Communication",
|
||||
|
|
|
|||
|
|
@ -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"""))
|
||||
Loading…
Add table
Reference in a new issue