Skip to content

Commit

Permalink
fix(announcements): allow sponsors to modify announcements
Browse files Browse the repository at this point in the history
  • Loading branch information
alanzhu0 committed Oct 7, 2024
1 parent c7839a6 commit 5ff2d9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions intranet/apps/announcements/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ...utils.date import get_date_range_this_year, is_current_year
from ...utils.deletion import set_historical_user
from ...utils.html import nullify_links
from ..eighth.models import EighthActivity
from ..eighth.models import EighthActivity, EighthSponsor


class AnnouncementManager(Manager):
Expand Down Expand Up @@ -158,7 +158,12 @@ def can_modify(self, user):
return (
user.is_announcements_admin
or self.is_club_announcement
and (user in self.activity.officers.all() or user in self.activity.sponsors.all() or user in self.activity.club_sponsors.all())
and (
user in self.activity.officers.all()
or user in self.activity.club_sponsors.all()
or EighthSponsor.objects.filter(user=user).exists()
and user.sponsor_obj in self.activity.sponsors.all()
)
)

# False, not None. This can be None if no AnnouncementRequest exists for this Announcement,
Expand Down
2 changes: 1 addition & 1 deletion intranet/apps/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def dashboard_view(request, show_widgets=True, show_expired=False, show_hidden_c
dashboard_title = dashboard_header = "Club Announcements"
view_announcements_url = "club_announcements"
else:
dashboard_title = dashboard_header = "Announcements"
dashboard_title = dashboard_header = "Dashboard"

num_senior_destinations = len(Senior.objects.filled())

Expand Down

0 comments on commit 5ff2d9e

Please sign in to comment.