Skip to content

feat: inline/attachment settings#478

Merged
vEnhance merged 48 commits into
vEnhance:mainfrom
norzmaxxer:patch-5
Apr 12, 2026
Merged

feat: inline/attachment settings#478
vEnhance merged 48 commits into
vEnhance:mainfrom
norzmaxxer:patch-5

Conversation

@norzmaxxer
Copy link
Copy Markdown
Contributor

I don't know how to pass the settings values into the PDF opener.

If you're an OTIS student, include your OTIS-WEB username or student ID number
(whichever you prefer) so I can grant you the spades bounty as well.
2840

@vEnhance
Copy link
Copy Markdown
Owner

vEnhance commented Apr 6, 2026

I don't know how to pass the settings values into the PDF opener.

might be pretty annoying which is why i was not super excited about this feature request

you need to take the correct logged in user, get the UserProfile object and read the settings

it might be easier to make the signature get_from_google_storage(filename: str, user: User) instead

@norzmaxxer
Copy link
Copy Markdown
Contributor Author

Oops, I didn't see that comment.

@norzmaxxer norzmaxxer marked this pull request as ready for review April 12, 2026 02:31
@vEnhance
Copy link
Copy Markdown
Owner

can you make it pass CI

@vEnhance
Copy link
Copy Markdown
Owner

if you delete the migration script the whole project won't work (and it also isn't the formatting issue anyway)

@vEnhance
Copy link
Copy Markdown
Owner

BTW, I'm sorry I'm being a bit deliberately unhelpful, in that I could probably just run the formatter myself and make it pass CI. However, the fact you didn't do this means that you never got a clone of the repository working to begin with, which means that the code has never been run, and that's the real issue here. Generally when you contribute code to an upstream project you should have at least run it yourself to make sure it works.

(Properly speaking maintainers will ask for unit tests most of the time, but the part you're touching happens to be the one that touches the file system so I'm a bit more willing to overlook it.)

@vEnhance
Copy link
Copy Markdown
Owner

also, i think the code would be cleaner as

get_from_google_storage(exam.pdfname, user)

so you don't have to keep repeating the line profile, _ = UserProfile.objects.get_or_create(user=request.) every time you call the function. (As a general rule of thumb if you're a beginner you will make better design decisions if you never allow yourself to copy-paste code.)

@norzmaxxer
Copy link
Copy Markdown
Contributor Author

The checker says

  otisweb/templates/socialaccount/base.html: Broken symlink

@vEnhance
Copy link
Copy Markdown
Owner

YAY I HATE UV

nah, uv is great. maybe what you mean to say that you hate pre-commit checks (like ruff, prettier, etc.), however i think that's just skiss

otisweb/templates/socialaccount/base.html: Broken symlink

yeah, because you overwrite the symlink with random content (look at the git diff). you should undo all the changes to that file since i don't think you even meant to touch it.

@norzmaxxer
Copy link
Copy Markdown
Contributor Author

I don't know how it got changed. It was modified after running make fmt.

@norzmaxxer
Copy link
Copy Markdown
Contributor Author

Great! Now watch my code crash in prod.

@vEnhance
Copy link
Copy Markdown
Owner

there are a lot of assert's added (i guess for type safety) so in fact i'm just going to refactor the whole thing to take the entire request and do the assertion within the util function

@vEnhance vEnhance merged commit ed90304 into vEnhance:main Apr 12, 2026
6 checks passed
@vEnhance
Copy link
Copy Markdown
Owner

oh oops i didn't mean to merge my unpushed main stuff in. aiya. ok whatever it's fine.

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.

2 participants