Skip to content

Commit

Permalink
Merge Version 3.5.1 (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxmeinhold committed Sep 2, 2020
2 parents 35fb475 + 5036bf4 commit 5e09efe
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 2 deletions.
5 changes: 5 additions & 0 deletions frontend/scss/components/badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ span {
background-color: #e83e8c;
}

&.badge-wm {
color: #fff;
background-color: #b19cd9;
}

&.badge-webmaster {
color: #fff;
background-color: #2196F3;
Expand Down
24 changes: 24 additions & 0 deletions migrations/versions/a243fac8a399_add_wiki_maintainers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Add Wiki Maintainers
Revision ID: a243fac8a399
Revises: 53768f0a4850
Create Date: 2020-09-02 15:20:48.285910
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a243fac8a399'
down_revision = '53768f0a4850'
branch_labels = None
depends_on = None


def upgrade():
op.add_column('signature_upper', sa.Column('w_m', sa.Boolean(), nullable=False, server_default='f'))


def downgrade():
op.drop_column('signature_upper', 'w_m')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "CSH Packet",
"name": "csh-packet",
"version": "3.5.0",
"version": "3.5.1",
"description": "A web app implementation of the CSH introductory packet.",
"bugs": {
"url": "https://github.com/ComputerScienceHouse/packet/issues",
Expand Down
2 changes: 2 additions & 0 deletions packet/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def get_roles(sig):
out['rtp'] = 'RTP'
if sig.three_da:
out['three_da'] = '3DA'
if sig.w_m:
out['wm'] = 'Wiki Maintainer'
if sig.webmaster:
out['webmaster'] = 'Webmaster'
if sig.c_m:
Expand Down
8 changes: 8 additions & 0 deletions packet/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ def ldap_get_constitutional_maintainers():
return [member.uid for member in _ldap_get_group_members('constitutional_maintainers')]


def ldap_get_wiki_maintainers():
"""
All wiki maintainers
:return: A list of CSHMember instances
"""
return [member.uid for member in _ldap_get_group_members('wiki_maintainers')]


def ldap_get_drink_admins():
"""
All drink admins
Expand Down
1 change: 1 addition & 0 deletions packet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class UpperSignature(db.Model):
three_da = Column(Boolean, default=False, nullable=False)
webmaster = Column(Boolean, default=False, nullable=False)
c_m = Column(Boolean, default=False, nullable=False)
w_m = Column(Boolean, default=False, nullable=False)
drink_admin = Column(Boolean, default=False, nullable=False)
updated = Column(DateTime, default=datetime.now, onupdate=datetime.now, nullable=False)

Expand Down
8 changes: 7 additions & 1 deletion packet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from packet.mail import send_start_packet_mail
from packet.models import Freshman, FreshSignature, Packet, UpperSignature, MiscSignature
from packet.ldap import ldap_get_member, ldap_is_intromember, ldap_is_evals, ldap_is_on_coop, \
ldap_get_active_members, ldap_get_active_rtps, ldap_get_3das, ldap_get_webmasters, \
ldap_get_active_members, ldap_get_active_rtps, ldap_get_3das, ldap_get_wiki_maintainers, ldap_get_webmasters, \
ldap_get_constitutional_maintainers, ldap_get_drink_admins, ldap_get_eboard_role
from packet.notifications import packets_starting_notification, packet_starting_notification

Expand Down Expand Up @@ -166,6 +166,7 @@ def create_new_packets(base_date: date, freshmen_list: dict):
three_da = ldap_get_3das()
webmaster = ldap_get_webmasters()
c_m = ldap_get_constitutional_maintainers()
w_m = ldap_get_wiki_maintainers()
drink = ldap_get_drink_admins()

# Packet starting notifications
Expand All @@ -186,6 +187,7 @@ def create_new_packets(base_date: date, freshmen_list: dict):
sig.three_da = member.uid in three_da
sig.webmaster = member.uid in webmaster
sig.c_m = member.uid in c_m
sig.w_m = member.uid in w_m
sig.drink_admin = member.uid in drink
db.session.add(sig)

Expand All @@ -205,6 +207,7 @@ def sync_with_ldap():
three_da = ldap_get_3das()
webmaster = ldap_get_webmasters()
c_m = ldap_get_constitutional_maintainers()
w_m = ldap_get_wiki_maintainers()
drink = ldap_get_drink_admins()

print('Applying updates to the DB...')
Expand All @@ -216,6 +219,7 @@ def sync_with_ldap():
sig.three_da = sig.member in three_da
sig.webmaster = sig.member in webmaster
sig.c_m = sig.member in c_m
sig.w_m = sig.member in w_m
sig.drink_admin = sig.member in drink

# Migrate UpperSignatures that are from accounts that are not active anymore
Expand All @@ -234,6 +238,7 @@ def sync_with_ldap():
sig.three_da = sig.member in three_da
sig.webmaster = sig.member in webmaster
sig.c_m = sig.member in c_m
sig.w_m = sig.member in w_m
sig.drink_admin = sig.member in drink
db.session.add(sig)

Expand All @@ -247,6 +252,7 @@ def sync_with_ldap():
sig.three_da = sig.member in three_da
sig.webmaster = sig.member in webmaster
sig.c_m = sig.member in c_m
sig.w_m = sig.member in w_m
sig.drink_admin = sig.member in drink
db.session.add(sig)

Expand Down

0 comments on commit 5e09efe

Please sign in to comment.