Skip to content

Commit

Permalink
fix(buddy-system): picture permissions, displayed interests
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeejoee committed Nov 10, 2023
1 parent 8e0d5b1 commit e756656
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ <h2 class="card-title flex flex-row justify-between">
</div>
<div class="chat-bubble">{{ br.note }}</div>
<div class="chat-bubble border-0 bg-transparent pl-0 pt-0 mt-2 text-base-content">
{% for interest in br.issuer.profile.get_interests_display %}
<span class="mr-2 badge badge-outline">{{ interest }}</span>
{% endfor %}
{% for interest in br.get_interests_display %}<span class="mr-2 badge badge-outline">{{ interest }}</span>{% endfor %}
</div>
</div>

Expand Down
22 changes: 13 additions & 9 deletions fiesta/apps/buddy_system/views/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,24 @@ class IssuerPictureServeView(
NamespacedFilesServeView,
):
def has_permission(self, request: HttpRequest, name: str) -> bool:
# is the file in requests, for whose is the related section responsible?
# picture is from requests placed on my section
related_requests = request.membership.section.buddy_system_requests.filter(
issuer__profile__picture=name,
)

# does have the section enabled picture displaying?
return (related_requests.exists() and self.configuration and self.configuration.display_issuer_picture) or (
related_requests.filter(
state=BuddyRequest.State.MATCHED,
)
.filter(
Q(match__matcher=request.user) | Q(issuer=request.user),
return (
# does have the section enabled picture displaying?
(related_requests.exists() and self.configuration and self.configuration.display_issuer_picture)
# or are we in a matched request?
or (
related_requests.filter(
state=BuddyRequest.State.MATCHED,
)
.filter(match__matcher=request.user)
.exists()
)
.exists()
# or am I the issuer?
or (related_requests.filter(issuer=request.user).exists())
)


Expand Down

0 comments on commit e756656

Please sign in to comment.