Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Club announcements #1724

Merged
merged 42 commits into from
Oct 6, 2024
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7d0a636
feat(announcements): implement models/UI for club announcements
krishnans2006 Feb 11, 2024
ca4ddd4
feat(announcements): animate club announcements on dashboard
krishnans2006 Mar 12, 2024
94777f4
feat(announcements): filter club announcements by subscription status
krishnans2006 Mar 13, 2024
9353de5
refactor: update year on search, announcement request pages
alanzhu0 Mar 29, 2024
d50a7eb
refactor(announcements): reword guidelines and remove redundant code
alanzhu0 Mar 29, 2024
790c928
perf(announcements): add prefetch query in status view and tighten perms
alanzhu0 Mar 29, 2024
ff65c64
feat(announcements): continue adding functionality and permissions
alanzhu0 Mar 29, 2024
ae02f8d
style(announcements): dark theme fixes
krishnans2006 Apr 7, 2024
4246911
fix(announcements): handle some edge cases
krishnans2006 Apr 7, 2024
b6e91d7
style(announcements): improve club announcement form
krishnans2006 Apr 7, 2024
347047f
feat(eighth): add subscribe and unsubscribe buttons everywhere
krishnans2006 Apr 7, 2024
d548e8a
feat(eighth): add activity settings page for club announcements control
krishnans2006 Apr 8, 2024
6b3147d
fix: format and build sources
krishnans2006 Apr 8, 2024
b7c7712
fix(eighth): fix club announcements settings back button
alanzhu0 Apr 8, 2024
e2f9673
refactor(announcements): text changes
alanzhu0 May 1, 2024
d8a39b4
fix: format code, build sources, build docs
krishnans2006 Apr 8, 2024
07c6d70
fix: add club ann. text and remove hoco banner for ann. pages
shrysjain Sep 29, 2024
60872bb
fix: invalid button logic for dashboard
JasonGrace2282 Oct 2, 2024
112c042
fix: show banner for everyone
shrysjain Oct 2, 2024
66cf9ff
format: remove extraneous space
shrysjain Oct 2, 2024
e4420ba
feat: add club announcement archive
JasonGrace2282 Oct 2, 2024
51c00ac
chore: fix linting errors
JasonGrace2282 Oct 2, 2024
8d4abda
feat: implement "other club announcements" filter
JasonGrace2282 Oct 3, 2024
fa826b9
feat: search for club announcements
JasonGrace2282 Oct 4, 2024
6823c43
feat: force club sponsors to be subscribed
JasonGrace2282 Oct 5, 2024
5b0b822
fix: don't create normal announcement on club announcement edit
alanzhu0 Oct 5, 2024
226a2a0
feat: add show expired button
JasonGrace2282 Oct 5, 2024
c10a7b3
fix: show hidden announcements on club announcements view
alanzhu0 Oct 5, 2024
dfab287
refactor: announcement banner color change
alanzhu0 Oct 5, 2024
bc8fa41
fix: allow club sponsors to edit settings
shrysjain Oct 5, 2024
b5cce88
fix: unsubscribed button not showing
JasonGrace2282 Oct 5, 2024
7de2cb9
chore: fix pre-commit lints
JasonGrace2282 Oct 5, 2024
fbab690
fix: actually allow club announcements sponsors to modify
alanzhu0 Oct 5, 2024
51721c0
fix: allow club officers to expire announcements
alanzhu0 Oct 5, 2024
2f65a62
feat: add announcement edit history
alanzhu0 Oct 5, 2024
19d9c25
refactor: better errors and subscriber sticking
JasonGrace2282 Oct 5, 2024
df32926
feat: improve pagination
JasonGrace2282 Oct 5, 2024
f64049b
feat: send club announcements emails
alanzhu0 Oct 5, 2024
3efd6f6
fix: allow both sponsors and moderators to edit club settings
alanzhu0 Oct 5, 2024
81fb856
fix: get expiration date to show correctly on edit
alanzhu0 Oct 5, 2024
a2f35f3
chore: resolve some linting errors
JasonGrace2282 Oct 5, 2024
bd2828e
fix: prevent jitterclicking causing invalid results
JasonGrace2282 Oct 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(announcements): handle some edge cases
krishnans2006 authored and JasonGrace2282 committed Oct 2, 2024
commit 424691144bb65a9fa923faa068b6497cbcdaf33e
25 changes: 22 additions & 3 deletions intranet/apps/announcements/views.py
Original file line number Diff line number Diff line change
@@ -15,8 +15,13 @@
from ..groups.models import Group
from .forms import AnnouncementAdminForm, AnnouncementEditForm, AnnouncementForm, AnnouncementRequestForm, ClubAnnouncementForm
from .models import Announcement, AnnouncementRequest
from .notifications import (admin_request_announcement_email, announcement_approved_email, announcement_posted_email, announcement_posted_twitter,
request_announcement_email)
from .notifications import (
admin_request_announcement_email,
announcement_approved_email,
announcement_posted_email,
announcement_posted_twitter,
request_announcement_email,
)

logger = logging.getLogger(__name__)

@@ -129,7 +134,11 @@ def request_announcement_view(request):
@login_required
@deny_restricted
def add_club_announcement_view(request):
if not (request.user.is_announcements_admin or request.user.is_club_officer or request.user.is_club_sponsor):
is_announcements_admin = request.user.is_announcements_admin
is_club_sponsor = request.user.is_club_sponsor
is_club_officer = request.user.is_club_officer

if not (is_announcements_admin or is_club_sponsor or is_club_officer):
messages.error(request, "You do not have permission to post club announcements.")
return redirect("club_announcements")

@@ -150,6 +159,16 @@ def add_club_announcement_view(request):
messages.error(request, "Error adding club announcement")
else:
form = ClubAnnouncementForm(request.user)

if not form.fields["activity"].queryset.exists():
if is_announcements_admin:
messages.error(request, "No clubs have enabled this feature yet.")
elif is_club_sponsor:
messages.error(request, "Please enable club announcements for your club.")
else:
messages.error(request, "Please ask your club sponsor to enable posting announcements for your club.")
return redirect("club_announcements")

return render(request, "announcements/club-request.html", {"form": form, "action": "post"})


8 changes: 8 additions & 0 deletions intranet/static/js/dashboard/announcements.js
Original file line number Diff line number Diff line change
@@ -158,6 +158,10 @@ function announcementToggle() {
function filterClubAnnouncements() {
if ($(".subscribed-filter").hasClass("active")) {
$(".announcement").each(function () {
if ($(this).hasClass("exclude-subscribed-filer")) {
$(this).fadeIn();
return;
}
if ($(this).hasClass("subscribed")) {
$(this).fadeIn();
} else {
@@ -166,6 +170,10 @@ function filterClubAnnouncements() {
});
} else if ($(".unsubscribed-filter").hasClass("active")) {
$(".announcement").each(function () {
if ($(this).hasClass("exclude-subscribed-filer")) {
$(this).fadeIn();
return;
}
if ($(this).hasClass("subscribed")) {
$(this).hide();
} else {
2 changes: 1 addition & 1 deletion intranet/templates/dashboard/dashboard.html
Original file line number Diff line number Diff line change
@@ -252,7 +252,7 @@ <h3 class="club-announcements-header">
{% endwith %}
{% endif %}
{% empty %}
<div class="announcement">
<div class="announcement exclude-subscribed-filer">
{% if not request.user.is_restricted %}
There are no announcements to display at this time.
{% else %}