add ability to hide list/edits/collections from personal section but keep around in case they are shared or linked from elsewhere, but cluster the personal section

This commit is contained in:
j 2023-07-07 11:46:09 +05:30
commit 034b448846
7 changed files with 159 additions and 6 deletions

View file

@ -412,6 +412,11 @@ def findEdits(request, data):
is_featured = any(filter(is_featured_condition, data.get('query', {}).get('conditions', [])))
is_personal = request.user.is_authenticated and any(
(x['key'] == 'user' and x['value'] == request.user.username and x['operator'] == '==')
for x in data.get('query', {}).get('conditions', [])
)
if is_section_request:
qs = query['qs']
if not is_featured and not request.user.is_anonymous:
@ -420,6 +425,9 @@ def findEdits(request, data):
else:
qs = _order_query(query['qs'], query['sort'])
if is_personal and request.user.profile.ui['hidden']['edits']:
qs = qs.exclude(name__in=request.user.profile.ui['hidden']['edits'])
response = json_response()
if 'keys' in data:
qs = qs[query['range'][0]:query['range'][1]]