fix: Ignore permissions for tags (#9100)

fix: Ignore permissions for tags

Co-authored-by: Himanshu <himanshuwarekar@yahoo.com>
This commit is contained in:
Suraj Shetty 2019-12-23 09:51:47 +05:30 committed by GitHub
commit da2c9454b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View file

@ -267,18 +267,14 @@ def get_sidebar_stats(stats, doctype, filters=[]):
data = frappe._dict(frappe.local.form_dict)
filters = json.loads(data["filters"])
if not frappe.cache().hget("Tags", doctype):
tags = set([tag.tag for tag in frappe.get_list("Tag Link", filters={"document_type": doctype}, fields=["tag"])])
frappe.cache().hset("Tags", doctype, tags)
for tag in list(frappe.cache().hget("Tags", doctype)):
for tag in frappe.get_all("Tag Link", filters={"document_type": doctype}, fields=["tag"]):
tag_filters = []
tag_filters.extend(filters)
tag_filters.extend([['Tag Link', 'tag', '=', tag]])
tag_filters.extend([['Tag Link', 'tag', '=', tag.tag]])
count = frappe.get_all(doctype, filters=tag_filters, fields=["count(*)"])
if count[0].get("count(*)") > 0:
_user_tags.append([tag, count[0].get("count(*)")])
_user_tags.append([tag.tag, count[0].get("count(*)")])
return {"stats": {"_user_tags": _user_tags}}

View file

@ -207,7 +207,7 @@ frappe.views.BaseList = class BaseList {
show_or_hide_sidebar() {
let show_sidebar = JSON.parse(localStorage.show_sidebar || 'true');
$(document.body).toggleClass('no-sidebar', !show_sidebar);
$(document.body).toggleClass('no-list-sidebar', !show_sidebar);
}
setup_main_section() {

View file

@ -50,6 +50,19 @@
}
}
body.no-list-sidebar {
[data-page-route^="List/"] {
@media (min-width: @screen-md) {
.layout-side-section {
display: none;
}
.layout-main-section-wrapper {
width: 100% !important;
}
}
}
}
.filter-list {
position: relative;