Skip to content

Mandate Constitution Upload#832

Open
Porcupine1 wants to merge 1 commit into
masterfrom
mandate-constitution-upload
Open

Mandate Constitution Upload#832
Porcupine1 wants to merge 1 commit into
masterfrom
mandate-constitution-upload

Conversation

@Porcupine1
Copy link
Copy Markdown
Member

@Porcupine1 Porcupine1 commented Aug 7, 2025

This PR mandates that clubs upload their constitutions. Uploading a constitution file can be done via resource tab, in which case the file name should at least contain constitution as a substring. The file upload section could potentially be used to upload files that aren't intended to be the constitution. One can also upload a constitution file via the ClubEditCard on /create/ .../renew/ .../edit/ routes where we assume the user definitely intends to upload a constitution.

On the resource tab, you'll see some warning text that is conditionally rendered for clubs that don't satisfy the constitution requirement.

NOTE: club mission word limit was implemented in an earlier commit not in this PR
Closes #825

@Porcupine1 Porcupine1 requested a review from julianweng August 7, 2025 04:59
@Porcupine1 Porcupine1 linked an issue Aug 7, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Member

@julianweng julianweng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work Thomas. Left some nits. On a higher level, do you think it could be more elegant to treat constitutions as a foreign key for the club model vs an attribute on a given file upload? It seems like a useful invariant that a club can have only at max one constitution, and there are likely performance benefits as well (it's also easy to prefetch_related or treat this similarly to club photo in terms of our business logic). In addition, especially if we move to this alternative, constitution uploads should be made visually distinct in the UI from normal, non-constitution file uploads and the experience shouldn't feel different from, say, the club photo requirement or field in club edit.

We could also potentially kill the file upload feature altogether in favor of this since I'm not sure if it has any purpose other than constitutions, but that's likely a question for later and we'd want to give clubs time to download their existing files and reupload them as constitutions.

Also, have not gotten a chance to test this locally, backend or frontend (travelling), so will trust that you have!

isEdit: boolean = false,
): boolean {
// if on edit page and club already has constitution, it's not required
if (isEdit && club.has_constitution) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this if branch implements separate behavior on isEdit=true

enableReinitialize
validate={(values) => {
const errors: { email?: string } = {}
validate={(values: any) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure there's no expected schema for values?


type FilesCardProps = {
club: Club
refreshTrigger?: number
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this prop ever being incremented on file upload? We may also want to explore more idiomatic ways of forcing refresh for this card vs. a meaningless number.

const formData = new FormData()
formData.append('file', data.file)

// if filename contains "constitution" then file must be constitution
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming that this is fallback logic for file uploads not done within our new upload constitution UI vs a check for files that are already being uploaded through the new UI meant for uploading constitutions.

<p className="has-text-weight-semibold">
Important: If you choose to upload your constitution from this
tab, please ensure the file name contains the word "constitution"
to automatically mark it as a constitution file.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to the above comment but I think this process is too confusing / ambiguous and if we can't avoid this, we should just have a single unambiguous place where uploading any valid word or pdf doc would idempotently update a club's constitution

Comment thread backend/clubs/models.py
def is_wharton(self):
return any(badge.label == "Wharton Council" for badge in self.badges.all())

@cached_property
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we invalidate this cache on file upload or is this implicit in the Django decorator?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce stricter constraints on certain fields

2 participants