Remove legacy Jinja2 view functions#920
Open
Marvinrose wants to merge 1 commit intofedora-infra:swatantryafrom
Open
Remove legacy Jinja2 view functions#920Marvinrose wants to merge 1 commit intofedora-infra:swatantryafrom
Marvinrose wants to merge 1 commit intofedora-infra:swatantryafrom
Conversation
gridhead
requested changes
Apr 2, 2026
Member
gridhead
left a comment
There was a problem hiding this comment.
@Marvinrose, apart from addressing the changes that I have suggested to you, please sign your commit activities and specify the AI tooling used in making this pull request happen.
Comment on lines
+96
to
+133
|
|
||
|
|
||
| @bp.route("/invitations/<claim_id>/claim") | ||
| def invitation_claim(claim_id): | ||
| """Action that awards a person a badge after scanning a qrcode.""" | ||
| claim = g.tahrirdb.get_invitation(claim_id) | ||
| if claim.expires_on < datetime.now(): | ||
| return abort(410, "That invitation is expired.") | ||
|
|
||
| email = g.oidc_user.email | ||
| if not email: | ||
| return redirect(f"{url_for('oidc_auth.login')}?next={request.url}") | ||
|
|
||
| if g.tahrirdb.assertion_exists(claim.badge_id, g.oidc_user.person.email): | ||
| flash(f"You already have {claim.badge_id} badge") | ||
| else: | ||
| g.tahrirdb.add_assertion( | ||
| claim.badge_id, g.oidc_user.person.email, datetime.now(timezone.utc) | ||
| ) | ||
| flash(f"You have earned {claim.badge_id} badge. Your rank will be updated shortly.") | ||
|
|
||
| return redirect(url_for("tahrir.home")) | ||
|
|
||
|
|
||
| @bp.route("/invitations/<claim_id>/qrcode") | ||
| def invitation_qrcode(claim_id): | ||
| """Returns a raw dummy qrcode through to the user.""" | ||
| claim = g.tahrirdb.get_invitation(claim_id) | ||
| if claim.expires_on < datetime.now(): | ||
| return abort(410, "That invitation is expired.") | ||
|
|
||
| target = url_for("tahrir.invitation_claim", claim_id=claim_id, _external=True) | ||
| img = qrcode_module.make(target) | ||
| bytestream = BytesIO() | ||
| img.save(bytestream) | ||
| return bytestream.getvalue(), { | ||
| "content-type": "image/png", | ||
| } |
| "date": objc.created_on.timestamp(), | ||
| } | ||
| rslt.append({"id": item, **base, **data["badges"][item]}) | ||
| else: |
Member
There was a problem hiding this comment.
Why was the else clause removed here?
| "about.html", | ||
| content=load_docs("about"), | ||
| ) | ||
| from . import blueprint as bp # noqa: F401 |
Member
There was a problem hiding this comment.
Are you sure there is not a better way of handling this?
| @@ -237,21 +48,3 @@ def add_tag(request): | |||
| g.tahrirdb.session.flush() | |||
Member
There was a problem hiding this comment.
The add_tag bug seems like it is going to come back and bite later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #904
Remove legacy view functions that render Jinja2 templates
Directory: tahrir/views/
Views that render legacy templates: index, about, user, diff, badge, badge_full, leaderboard, report, explore, explore_badges, admin, builder, thingiview, assertion_widget, tags