rDrama/files
TLSM 9e2ceb28b0 Fix four routes with auth_desired misimplemented.
PR #374 removed `@auth_required` from a number of routes and changed
those which used their `v` parameters to `v=None` and removed the `v`
parameter from those which didn't internally use it. 1841134b47

PR #392 re-added `@auth_desired` to those routes to ensure the
templates rendered with awareness of the current logged-in user
(matters for search, header bar, etc). 9f042c1aeb

However, 500 errors occurred on /random_post, /random_user, /id/<uid>,
and /u/<username>. Those were the four which had their `v` parameter
removed entirely. This has been re-added, which fixes the bug.

The way to understand auth_required vs auth_desired is that they are
nearly identical, with the sole difference than auth_required
checks if v is None and aborts with 401 if so. This means that
auth_desired routes must handle the v=None case. They are the same in
that they always try to give a `v` kwarg to the decorated function,
which was the root cause of those four routes erroring.

Recommended style: the vast majority of routes which return a rendered
template should be auth_desired, because the top-level templates often
draw extensively from `v` state even when the route handler does not.
When a route is either auth_desired or auth_required, it should have a
`v` parameter, which we typically give as the first positional
parameter.
2022-11-06 03:11:59 -06:00
..
assets Change hidden score placeholder from ? to empty string 2022-10-28 03:55:07 -05:00
classes Hide votes for posts and comments under 24 hours old 2022-10-27 21:50:08 -05:00
commands [#72] Add seed_db command 2022-06-09 01:33:58 -07:00
helpers Fix some deprecations and factor out a helper function (#387) 2022-10-27 22:15:48 -05:00
mail Split SITE_NAME into computer-readable SITE_ID and human-readable SITE_TITLE. 2022-07-31 18:53:18 -05:00
routes Fix four routes with auth_desired misimplemented. 2022-11-06 03:11:59 -06:00
templates caching: fix CSRF 2022-11-02 23:51:33 -05:00
tests remove .pyc files 2022-10-27 21:54:07 -05:00
__init__.py Initial e2e testing 2022-05-13 02:55:29 -05:00
__main__.py Fix some deprecations and factor out a helper function (#387) 2022-10-27 22:15:48 -05:00
cli.py [#72] Ensure seed_db command is actually imported when calling into flask 2022-06-09 01:34:46 -07:00