Commit graph

109 commits

Author SHA1 Message Date
Ben Rog-Wilhelm
b4efd75753 Merge branch 'frost' into pr-eager-content 2022-12-17 17:17:32 -06:00
justcool393
0c632d73b7
Rework error system a bit to remove a bunch of duplicated code (#434) 2022-12-01 20:58:27 -06:00
TLSM
5aaef144cf
Deduplicate post/comment sorting & time filtering.
Ported in from upstream with adjustments for TheMotte, most notably
universal default to 'new' and fixes to 'hot'. Lumped into this PR
because eager comment loading uses it.
2022-11-28 14:33:24 -05:00
TLSM
4d22d9bce2
Eager load get_posts for submission_listings.
Ported in logic from upstream to use SQLAlchemy eager loading instead
of repeated queries when building a submission_listing. Adjusted
loaded relationships to include only those used on TheMotte.

Using test data from seed_db, before and after:

GET /
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |   83   |   0    |   0    |   0    |   83   |     72     |
|----------|--------|--------|--------|--------|--------|------------|
Total queries: 83 in 0.031s

GET /
|----------|--------|--------|--------|--------|--------|------------|
| Database | SELECT | INSERT | UPDATE | DELETE | Totals | Duplicates |
|----------|--------|--------|--------|--------|--------|------------|
| default  |   14   |   0    |   0    |   0    |   14   |     0      |
|----------|--------|--------|--------|--------|--------|------------|
Total queries: 14 in 0.00718s
2022-11-28 12:55:31 -05:00
TLSM
3f360bb457 Remove special cases for unused awards.
Removes the following awards / fields on User:
 - flairlock
 - progressivestack
 - bird
 - longpost (pizzashill)
 - marseyawarded
 - rehab
 - deflector
 - mute
 - unmutable
 - eye (All-Seeing Eye)
 - alt (Alt-Seeing Eye)

Primarily motivated by starting to remove some un-Mottelike cruft
from core commenting/posting routes. Cleared out other inapplicable
awards while in the process.
2022-11-09 20:37:04 -06:00
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
electricwhisk
9f042c1aeb
Stay logged in on certain routes (#392)
This commit adds the @auth_desired decorator to
routes that previous had the @auth_required decorator,
but had it removed in #374. This should cause
the user to remain logged in on these routes.
2022-10-27 22:16:22 -05:00
FatherInire
b46ada9f72
Fix some deprecations and factor out a helper function (#387) 2022-10-27 22:15:48 -05:00
DinoInNameOnly
d354b0713d Allow search and other pages for logged out users 2022-10-14 06:26:08 -05:00
iro84657
b7da8b575a Add trailing LF to text files 2022-05-10 21:05:51 -04:00
Ben Rog-Wilhelm
1ee9c1bfa7
Convert text file line endings to LF. 2022-05-09 07:20:47 -05:00
Aevann1
9f5e77139e fds 2022-04-18 20:45:18 +02:00
Aevann1
c572f25192 gf 2022-03-21 23:46:10 +02:00
Aevann1
9085bf1e2b bad PR 2022-03-05 22:53:39 +02:00
Aevann1
1b32b28595 search 2022-03-05 20:43:44 +02:00
Aevann1
36afb28fe7 fart 2022-03-05 00:46:20 +02:00
Aevann1
b1f996f0b6 regex 2022-02-27 23:57:44 +02:00
Aevann1
d7dbefb26e fixed king 2022-02-26 23:03:38 +02:00
Aevann1
e324257dce fd 2022-02-24 10:28:13 +02:00
Aevann1
1f3eb88f58 f 2022-02-16 00:54:17 +02:00
Aevann1
7eb78a3bd1 xvc 2022-02-10 01:29:34 +02:00
Aevann1
d1b12da8e4 vxc 2022-02-10 01:12:17 +02:00
Aevann1
683be1485c bv 2022-02-10 01:08:55 +02:00
Aevann1
d12ff06f4f SDF 2022-02-06 12:54:05 +02:00
Aevann1
6a46428d05 sfd 2022-02-04 11:15:59 +02:00
Aevann1
e2771a7f14 dsf 2022-02-04 06:10:31 +02:00
Aevann1
88c282fbe7 vxc 2022-01-28 22:13:18 +02:00
Aevann1
6e50997f43 vc 2022-01-28 03:32:16 +02:00
Aevann1
d488a75272 vc 2022-01-28 01:29:39 +02:00
Aevann1
cbb25d3f14 cxz 2022-01-28 01:29:24 +02:00
Aevann1
09fe6f5a07 vvvvvvvvvvvvvvv 2022-01-27 19:04:02 +02:00
Aevann1
47d19b5b4e vvv 2022-01-17 13:06:12 +02:00
Aevann1
207507fc8e b 2022-01-14 14:04:35 +02:00
Aevann1
609bbfafc6 closing2 2022-01-11 23:54:41 +02:00
Aevann1
af6b74f614 bb 2022-01-11 22:21:50 +02:00
Aevann1
4679b3b328 bb 2022-01-11 00:43:00 +02:00
Aevann1
20cf78883d fds 2022-01-04 15:13:02 +02:00
Aevann1
d497c856a6 fsd 2022-01-02 15:22:12 +02:00
Aevann1
6ab05c3bea fds 2022-01-02 02:15:55 +02:00
Aevann1
1c71ebff45 fds 2021-12-29 10:09:43 +02:00
Aevann1
fb0f83390e fds 2021-12-29 09:08:10 +02:00
Aevann1
d29014a3a6 fsfs 2021-12-20 02:27:25 +02:00
Aevann1
df05507e55 fggd 2021-12-19 23:41:57 +02:00
Aevann1
cb87196eee sfdsdf 2021-12-19 15:01:28 +02:00
Aevann1
6b593c5490 fdsfsd 2021-12-15 01:38:07 +02:00
Aevann1
2466a4a782 sdfsfd 2021-12-14 20:35:56 +02:00
Aevann1
4b1640ca3a fdsfds 2021-12-06 18:26:56 +02:00
Aevann1
571beef7a5 dfdf 2021-12-01 01:21:29 +02:00
Aevann1
81b9a86be2 fdfsd 2021-11-30 18:37:28 +02:00
Aevann1
872b1b11eb fdsfd 2021-11-30 16:23:34 +02:00