right now, leaderboards are complex enough that they ought to be upgraded to at least a second class thing.
this commit provides an *okay* implementation of a per-request leaderboard
there are many things to be done, including caching, persistence, etc
i don't like this like 80 parameter __init__ but it's what i've got without overengineering it imo
this is potentially already overdoing it
* sign up follow id is now a thing (if not specified will just msg carp instead)
* notification thread id is also a constant now
* blackjackbtz id is a constant, used for i think special PM handling
* unperson shadowbanned users
if a shadowbanned user copes, does anyone hear them seethe?
* unperson shadowbanned users (by id)
* don't import that
* Add include_blocks.
We don't always want to request blocks from the db when we have a user set
* block shadowbanned users from hole mod tools
* don't allow awarding shadowbanned things
* fix conflict
* gracefully use get_account when specified and also add include_blocks flag to get_account as well
Touched a ton of files to finally standardize on having trailing
final newlines, as best practice recommends and so our devs stop
accidentally fighting each other over it.
This was performed automatically with the following:
git ls-files -z '*.py' | while IFS= read -rd '' f; \
do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
git ls-files -z '*.css' | while IFS= read -rd '' f; \
do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
Permabanning already prevents users from initiating new DMs, and we
complete this by preventing replying to existing DM chains.
New modmails may still be initiated, and existing modmails may still
be replied to.
- Search: posts by shadowed user.
- Search: shadowed users in search for users.
- Direct links to shadowed user posts display as removed.
- Other users' profile comments listings hide comments on shadowed
posts. Users can still see their own comments on shadowed posts.
Similar to ghosted comment logic.
* formatmaxxing brained formatting
* formatmaxxing brained formatting: EPISODE 2
* Start implementing a .json interface for all logged users reddit-like
PROs:
- easier to debugmaxx applications
- good faith actors can scrap the site more easly :gigachadglow:
CONs:
- bad faith actors can scrap the site more easly :gigachadglow:
- jannitors lose a little of their power of allowlisting applications (they do it for free though)
anyways. I make this commit a separate commit so that Snakes can esclude it from the PR if he doesn't like it (cringe)
* /<username>/comments route now returns appropriate [citation needed] HTTP codes when called in JSON mode so that stupid JSON clients can crashmaxx
* More error codes (sorry I don't know how to squash)
* json endpoint. see other commit. I don't know how to squash
The changes to helpers/get.py @ get_user(...) in a6b7fed2fc resulted
in `is_blocking` no longer being present on all User objects retrieved
via `get_user`. This triggered a latent identifier shadow where the
property method `User.is_blocking` on the User model caused checks for
blocks on objects retrieved via `get_user` to always return True.
Notably: when the get_user return value left `is_blocking` unset and
thus implied False, the following expression yielded True due to the
presence of the first-class function at the same identifier:
hasattr(user, 'is_blocking') and user.is_blocking
* poll rework
* forgot to do joinedload on comments
* Fix logic errors with voting, SQL syntax.
Kitchen sink commit from review of poll-rework changes:
1. Fix seed-db.sql syntax error.
2. Fix SQL patch file duplication of *submissions* tables rather
than one set of submissions and one for comments.
3. Start makeshift SQL patch folder, since this is a large change
that contributors may wish to apply to their local instances.
4. Fix checkbox (non-`exclusive`) polls being unable to be
unchecked. For consistency with `exclusive` polls, they should.
5. Fix changing the option of an `exclusive` poll when both
exclusive and non-exclusive options are present in one comment/
post causing the non-exclusive options to become unchecked.
(which, by my reading of SQLAlchemy `Query.one_or_none()`
really could break quite badly in some cases).
* link relationships with their counterparts
* small modification to poll unchecking
Co-authored-by: TLSM <duolsm@outlook.com>
The user routes upvoters, downvoters, upvoting, and downvoting
now exclude self-votes from the summary totals.
Also, the diff touches a number of other lines where the local
variable `id` was renamed to `uid` for semantic clarity.
The previous fix to shadowbanned users not being able to view their
own profile broke userpages for logged out users (and filled the log
up with 500s) due to sloppy logic around accessing v.id. This has
been remedied.
1. Missed the notif for unfollowing a non-fish'd user in fb52003404.
2. "Get Them Help" button showed username.
3. Gift coins/mbux showed username and allowed a message.
4. Global block list showed username.
5. User profile appeared to logged-out and non-jannies.
Assetcache: now supports js/userpage.js & js/userpage_v.js.
The three userpage*.html templates now implement it.
Revising gift messages 16587cdf7cf5:
- routes/users.py: Deduplicate code, more descriptive var name.
- templates/userpage.html: Move post-tax gift line below reasons
box. Ultimately just an aesthetic change.
Adds award to enable viewing profile visitors for non-mops and
non-patrons. This commit should encompass all frontend, backend, and
database changes necessary. Perhaps usable as a model for other
user upgrade flag awards.
After ea48c46b0f adds the leaderboard table for most blocked user,
it appeared that the user profile links did not appear correctly.
As such, it was necessary to join on the appropriate information.
This has been (mostly) resolved, excluding the removal of profile
picture because profile_url has logic in Python.
If someone knows SQLAlchemy better than I do, please redo this and
add the profile pictures back into the template. However, I got tired
of fighting with the ORM when I already knew the damn query.