* Integrate chat from upstream
Substantially borrowed from upstream ref: 13a208ee88e55 (before they
started editing generated artefacts instead of source).
Integrated, including:
- Remove previously removed features: emoji, hats, and name colors
- Compensate for lack of unified root template
- Add React build process to Dockerfile and `bootstrap/init.sh`
- Preliminary integration of chat websocket workers
For testing, modify `supervisord.conf.dev` to put chat on port 80 and
the site service on some other port. Then visit: http://localhost/chat
Still to do:
- Access control for specific small-groups (and admins probably):
Set the values somewhere (site_settings.json? Redis?) and use for
authorization in `chat_is_allowed`.
- Proxying only /chat to the websocket workers
- Chat persistance across restarts: either Redis devops or to DB
* Add nginx server to do appropriate redirection.
* Add necessary columns to User.
* Wire up chat permissions.
* Reload chat on source change.
* Add a better structure for slash commands and add/remove functionality.
* Stop putting up previews of slash commands.
* We require more whitespace.
* Strip DMs out entirely, I currently do not want to deal with them.
* Change "Users Online" to just "Users".
* Clean up a little more DM detritus.
* Save chat history in database.
* Remove unnecessary hefty query to the DB.
* Clean up optimistic messages.
* Initial implementation of notification icon.
* Update readme a little bit.
* Fix notification highlight (mostly).
* Remove chat version number that will never be updated.
* Fix: Errors on logged-out users.
* Add function to nuke the chat state.
* Update DB.
* Add a dedicated deployable docker image.
* Fix: init_build.sh execute bit not set.
* Whoops, screwed up the abort() call.
* Relax chat rate limiter.
* Remove a somewhat silly comment.
* Remove an unnecessary g.db.add().
---------
Co-authored-by: TLSM <duolsm@outlook.com>
Change the notifications subpages to be distinct route handlers with
actual paths rather than query parameters. They already were a massive
conditional chain with almost no common logic.
Hard wrap some of the more egregious query lines. Use less duplicated
code for shadowban exclusion.
Only major functionality change which is somewhat related to #476 is
to sort subtrees by Comment.id DESC. Otherwise, upstream is
substantially the same as TheMotte. Given that upstream didn't
experience #476, I think the issue may have been resolved by prior
changes to filtering / comment visibility & moderation.
In the distant past, the codebase would check pushshift for keyword
mentions and generate notifications to admins about them. I can't
find where we removed it, but I don't think it was ever operative.
Since these notifications don't get generated, we don't need a
notifications page for them.
* remove holes
* don't import class that doesn't exist
* remove subs in template code
* remove subs_created
* fix sticky bug
* uh... i think this will fix it????
* fix stupid nearly ungrokkable nesting error
* ...
* ....
* ....
* *sigh*
* .............................i think i got it.
* Revert ".............................i think i got it."
This reverts commit 419a545875.
* Revert "*sigh*"
This reverts commit fcfc9d7995.
* Revert "...."
This reverts commit e200c8f6f0.
* Revert "...."
This reverts commit 681db8cb02.
* Revert "..."
This reverts commit c54372b9ff.
* Revert "fix stupid nearly ungrokkable nesting error"
This reverts commit e202fd774c.
* Revert "uh... i think this will fix it????"
This reverts commit e4d9366093.
* readd missing endif
* fix email templates.
* fix frontpage listing
* some minor fixes wrt saving
* fix some listing errors
* Remove more references to holes system
A couple of these came from the merge of #554. A few others were just
left in the templates and presumably hard to catch on the first
removal pass.
* remove unnecessary lazy
* Add migration
Tested. Very sensitive to order. I wound up borrowing the statement
order we used for deleting sub rows on upstream (manually, of course).
---------
Co-authored-by: TLSM <duolsm@outlook.com>
Originally motivated by fixing #263 (add a mod list), the root cause
of which was that we had a number of orphaned pages, one being the
admins list.
In the upstream, we moved links to a number of infrequently-accessed
pages to a secondary nav in the sidebar. This commit implements a
similar approach to provide links to the admin list and modlog. To
make the nav less visually unbalanced, Random Post/User were also
moved out of the header.
To provide mobile support, this secondary nav is presented in the
hamburger menu. This also provides a place to link /rules, which
otherwise has no link on mobile (that I can readily find).
Finally, the original intent of providing a mod list motivates some
style changes to admins.html to get rid of visible truescore, make
names appear consistently with names elsewhere, and ensure links to
leaderboard aren't accidentally leaked.
Using the new assetcache module, we replace (almost) all instances
of `?v=` cachebusting query parameters in Python and in Jinja templates.
The primary exceptions were: user site backgrounds, and some
infrequently changed graphics referenced literally from .js files.
Another JS load order bug, previously fixed upstream. bs_trigger() in
header.js must be run after DOM content is loaded to properly set the
events for tooltips to appear on hover. This commit uses standard
document ready event boilerplate to ensure this happens, regardless
of script load order.
The width of the account menu dropdown header is determined by the
length of one's username. Users with short names cause the dropdown
menu to partially clip off the right side of the page, which is
unsightly and impedes usage thereof. This commit enforces a minimum
width to prevent that.
Alternate approaches such as right-aligning the dropdown proved
unwieldy with CSS when fixing this same bug on the upstream.
I tried reproducing the issues from #110 but without luck. The
workflow looks a little like this:
- User changes their avatar.
- This triggers a POST request to the profile endpoint.
- User clicks "Log out" from the dropdown menu"
- This triggers the post_toast function in js that makes a POST to
/logout, which clears the user's session. Then, on receipt of the
response, the js calls `location.reload`, which replays the
browser's last action, which in our case is the earlier POST
request to the profile endpoint. This is why the browser asks
whether it's OK to resubmit the data _again_. Agreeing resubmits
the first POST request.
- After `location.reload`, since the user is no longer logged in,
they either get a 405 (from the profile edit page) or a 500 (from
the profile overview page).
This PR then changes the `/logout` endpoint from POST to GET, then
updates the header template to change the "Log out" anchor to simply
link to "/logout" instead of calling any js.
Reasoning behind it:
- logout doesn't modify server-side resources, so it's safe to make it a
GET request.
- Making it a GET prevents the browser from ever displaying the "data
resubmit" warning window.
- The "/logout" endpoint can now simply redirect to the homepage.
The .srd header banner currently has fixed text. However, there have
been many gayops which have made the news. journoid_banner.html is a
dynamic template which selects a random one to present.
Also, stylesheets and markup for the banner have been unslurred.