mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-30 12:00:36 +00:00
group view fixes
- fix form details not appearing in group member search view - fix query term appearing in main search box when searching for new members - direct request user back to the group rather than the user when adding a user to a group
This commit is contained in:
parent
afd00cc67a
commit
91534aff82
1 changed files with 6 additions and 5 deletions
|
@ -94,7 +94,7 @@ class FindUsers(View):
|
||||||
|
|
||||||
def get(self, request, group_id):
|
def get(self, request, group_id):
|
||||||
"""basic profile info"""
|
"""basic profile info"""
|
||||||
query = request.GET.get("query")
|
user_query = request.GET.get("user_query")
|
||||||
group = get_object_or_404(models.Group, id=group_id)
|
group = get_object_or_404(models.Group, id=group_id)
|
||||||
|
|
||||||
if not group:
|
if not group:
|
||||||
|
@ -110,8 +110,8 @@ class FindUsers(View):
|
||||||
) # don't suggest users who are already members
|
) # don't suggest users who are already members
|
||||||
.annotate(
|
.annotate(
|
||||||
similarity=Greatest(
|
similarity=Greatest(
|
||||||
TrigramSimilarity("username", query),
|
TrigramSimilarity("username", user_query),
|
||||||
TrigramSimilarity("localname", query),
|
TrigramSimilarity("localname", user_query),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.filter(similarity__gt=0.5, local=True)
|
.filter(similarity__gt=0.5, local=True)
|
||||||
|
@ -127,7 +127,8 @@ class FindUsers(View):
|
||||||
data = {
|
data = {
|
||||||
"suggested_users": user_results,
|
"suggested_users": user_results,
|
||||||
"group": group,
|
"group": group,
|
||||||
"query": query,
|
"group_form": forms.GroupForm(instance=group),
|
||||||
|
"user_query": user_query,
|
||||||
"requestor_is_manager": request.user == group.user,
|
"requestor_is_manager": request.user == group.user,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "groups/find_users.html", data)
|
return TemplateResponse(request, "groups/find_users.html", data)
|
||||||
|
@ -222,7 +223,7 @@ def remove_member(request):
|
||||||
notification_type=notification_type,
|
notification_type=notification_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect(user.local_path)
|
return redirect(group.local_path)
|
||||||
|
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
|
|
Loading…
Reference in a new issue