* 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>
Fixes#612. Ports in an existing working fix from upstream with
the change to bs_trigger. Also a stylistic improvement on the
preceding line I noticed while porting it.
bs_trigger is what attaches the event listeners for the Boostrap
popovers. It wasn't being called on the new elements, so they get no
user card. It is now, so it does. Calling it on the comment form
element doesn't work here because, unlike in an earlier stage of the
codebase (which I think the fork occured during the transition of)
put replies into a dedicated element rather than replacing the reply
form.
* 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>
changed in it
the comments.html template (along with submission.html) has numerous
undesirable properties which i will describe now. unless you are very
familiar with the codebase, it can be extremely difficult to grok.
this is pretty insane as there is nothing fundamentally complex about
the goal of comments.html: return a component that shows a username
and info, reports if any, comment content, and actions a user can
take.
this behemeoth was initially 886 lines in the old version of this
codebase, and this is with awards and a lot of other cruft removed.
anyway, the maintainability of this file is about on par with some
legacy application that keels over and dies if you sneeze vaguely
in its direction.
the nicest thing i can say about it is that it isn't currently
crashing.
anyway some of the problems include:
* large, splittable components, are not split into separate files.
this makes it incredibly difficult to find or make changes across
the template and makes it nearly impossible to find or change a
specific thing.
this is most easily exemplified in the modals, which should by all
accounts be separate templates, just inlined into comments.html.
* the nesting is oftentimes incorrect.
inexplicably, probably out of laziness from when the code was first
written, things will end up fully left aligned, while multiple layers
deep into a nesting context.
if an if statement or an endif is changed, it is *incredibly*
difficult to figure out where the error was. you can't trust the
nesting.
* multiple repeated checks for things that are always true.
this is probably a symptom of the above two problems but it's very
noticeable once you fix the nesting. for example there is a block
near the very top of the actions bar which checks for
parent_submission which effectively checks "is this in a post" (this
commit won't complain about parent_submission checks but i do have
opinions on those).
all of the action buttons further down the chain also check for
parent_submission, or even check inconsistently (by using if c.post)
within this context this is a completely unnecessary check in this
context.
while it is potentially useful (and in fact because #251 requires we
dismantle the assumption a little bit) to have these checks now, the
fact that they were initially added shows that when the code was all
initial written, there was little care into thinking about comment
state.
* mobile actions are duplicated and duplicated inline.
i actually do find it probably pretty hard to support this normally
given the codebase's DOM so whatever, duplicate the things, *but* if
we're going to do that, inlining it into the middle of an incredibly
long template is really difficult to comprehend as a design decision.
...anyway yeah this PR intends to fix these problems and enable work
to be done on #251. this is a "perfect is the enemy of good" commit.
it doesn't change much fundamental and is not intended to erase the
sins of the original file, but at least make it maintainable.
this also fixes a minor bug with #473 where the GIF modal was left
in by accident.
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.
The last places coins were visible to non-admins were in user popovers
and, potentially, via direct access of /@<username>/coins. These have
been removed.
Additionally, there are a number of routes which, despite being removed
from the UI, were still operative and usable. These are disabled
pending possible(?) future uses of coins.
Due to use of Submission.{choices, options, bet_options} in realbody,
generating submission_listings resulted in extremely high volume of
SELECT queries.
In local testing with 6 posts, one of which had a poll with 2 options,
the removal of these calls reduced quantity of queries on the homepage
from 84 to 22.
Given that it was previously decided to remove the polls feature after
a regression while adding comment filtering, the remaining dead code
paths for polls were also removed.
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.
Fixes issue #178. Root cause was attempting to document.getElementById
of both modal and toggle input before both were loaded into the DOM.
In the upstream, Cloudflare's Rocket Loader is used, which papers over
many cases of inattention to loading order.
This change disables multimedia embedding:
- In comments and comments replies.
- In new submissions.
- In comment & submission preview
And it's all toggle-able via an envvar, except for the JS bits,
but I linked those to the github issue, so should be easy to find
in the future.
The way it works is:
- removes markdown image/video syntax,
eg. `` into ``
- changes link text into anchors, eg.
`https://example.org/someimage.jpg` into
`[https://example.org/someimage.jpg](https://example.org/someimage.jpg)`
- removes html img/video/audio tags, eg.
`<img href="https://example.org/someimage.jpg" />` into ``
- when embedding gifs via the giphy modal in "new submission", it will
insert only an anchor to the gif
- when attaching an image, it will upload the image, then add only an
anchor to the post/comment body
I tested this manually, but not sure if I got all the test cases. What I
checked was:
- create comment w/ image/video/audio media using markdown -> success
- create comment reply w/ image/video/audio media using markdown ->
success
- create comment w/ link to img/imgur/youtube/audio -> success
- create comment w/ attachment -> success
- create comment reply w/ attachment -> success
- create comment w/ img/video tag -> success
- create comment reply w/ image/video tag -> success
- create post submission w/ image/video/media using markdown -> success
- create post submission w/ link to img/imgur/youtube/audio -> success
- create post submission w/ attachment -> success
- create post submission w/ giphy gif -> success
Also, updated the formatting page.
Co-authored-by: Ben Rog-Wilhelm <zorba-github@pavlovian.net>