Commit Graph

786 Commits

Author SHA1 Message Date
Deimos
3811ec3924 Eliminate RabbitMQ
This removes RabbitMQ as well as everything else attached to it:
Erlang; the Prometheus collector; the pg-amqp-bridge and all PostgreSQL
functions and triggers; and the amqpy Python package and the Tildes code
that used it.

Note that this commit does not actually uninstall or delete any of these
packages or services, so if you have a running instance that you want to
keep (instead of re-provisioning from scratch), you will need to
manually remove them if you want them completely gone.
2020-01-20 17:28:16 -07:00
Deimos
bcb5a3e079 Replace RabbitMQ uses with Redis streams
RabbitMQ was used to support asynchronous/background processing tasks,
such as determining word count for text topics and scraping the
destinations or relevant APIs for link topics. This commit replaces
RabbitMQ's role (as the message broker) with Redis streams.

This included building a new "PostgreSQL to Redis bridge" that takes
over the previous role of pg-amqp-bridge: listening for NOTIFY messages
on a particular PostgreSQL channel and translating them to messages in
appropriate Redis streams.

One particular change of note is that the names of message "sources"
were adjusted a little and standardized. For example, the routing key
for a message caused by a new comment was previously "comment.created",
but is now "comments.insert". Similarly, "comment.edited" became
"comments.update.markdown". The new naming scheme uses the table name,
proper name for the SQL operation, and column name instead of the
previous unpredictable terms.
2020-01-20 13:17:33 -07:00
Deimos
c0caec62c9 Upgrade Redis to 5.0.7 and update redis.conf 2020-01-20 12:55:31 -07:00
Deimos
9fe098cc6c Fix Black exclusion regex to only apply to folders
Noticed that this wasn't working correctly when Black was skipping over
a Python file with "sql" in its name.
2020-01-16 18:48:43 -07:00
Deimos
47657c988e Extend topic indexes for keyset pagination
The "keyset"-style pagination that Tildes uses for topic listings uses
WHERE and ORDER BY clauses that involve multiple columns to keep a
deterministic ordering even when the values in the main sort column are
equal. For example, when sorting by number of votes, you're actually
ordering by num_votes DESC, topic_id DESC. The previous single-column
indexes were a little inefficient for this and couldn't always be used
well.

This commit extends all of the relevant indexes to composite ones that
contain topic_id as well, and drops all of the original ones. This
should be more efficient, and should probably be done to indexes on the
comments table as well.
2020-01-15 14:10:10 -07:00
Deimos
3830f31c0e Improve performance of excluding ignored topics
This generates a significantly better execution plan for the query - I
think using one of the columns from the join condition helps the
query-planner do this properly.
2020-01-14 16:04:41 -07:00
Deimos
6f3e1ebbae Use <input type="search"> in search forms 2020-01-14 13:56:41 -07:00
Deimos
8412e44488 Add more SiteInfo entries for common sites 2020-01-14 11:00:30 -07:00
Deimos
35f3135742 Trim leading/trailing whitespace on topic links 2020-01-14 09:45:49 -07:00
Deimos
8318accb68 Improve alignment of topic actions dropdown
If the footer stretches to two lines (should only happen on mobile and
when there are new comments), this aligns the dropdown button more
towards the bottom of the topic, which looks better.
2020-01-14 09:30:59 -07:00
Deimos
64319eea0f Replace dropdown shadow with outset-style border
Shadows don't really fit with the site's overall style, and looked
especially weird in dark themes.
2020-01-13 19:27:11 -07:00
Deimos
0f020d4a2a Close dropdowns by clicking toggle button again 2020-01-13 18:19:09 -07:00
Deimos
ed2cdd2c4b Remove animation on dropdown
This also removes the attempt to close the dropdown if you the toggle
again while it's already open, since it seems like that isn't working
correctly anyway.
2020-01-13 17:34:01 -07:00
Deimos
c784c4e49d Add JS behavior to dropdowns (and fix OSX/Safari) 2020-01-13 16:44:53 -07:00
Deimos
9dd41562a4 Include ignored topics in Your Bookmarks page
If a user both bookmarks and ignores a topic, we should still show it in
the bookmarks page. They can unbookmark it if they don't want it in
there.
2020-01-13 16:15:14 -07:00
Deimos
983df2027d Add Actions dropdown to topics in listings
Currently, this dropdown contains Bookmark and Ignore.

As part of this, Spectre.css's icons stylesheet is now included, for the
caret icon used on the dropdown button. This is excessive since it's the
only icon being used for now, but the whole thing only adds about 1.3kb
to the gzipped size of tildes.css.
2020-01-13 13:16:04 -07:00
Ivan Fonseca
75c0fa0471 Add simple functionality for ignoring topics
This adds a simple Ignore functionality for topics, with the only effect
being to exclude ignored topics from listing pages.

It also adds a "Your ignored topics" page (linked through the user menu)
that lists all of a user's ignored topics, so that they can access them
if needed (to be able to un-ignore).
2020-01-07 18:00:43 -07:00
Deimos
2a8a1d4ba0 Add more SiteInfo entries for common sites 2020-01-06 14:08:57 -07:00
Deimos
9fceb3dbfc Update pypi package versions (requirements.txt) 2020-01-06 13:55:04 -07:00
Deimos
0a52c0dc49 Block SEOkicks bot from crawling the site 2019-12-19 19:36:25 -07:00
Deimos
7e5aa833ae Add more SiteInfo entries for common sites 2019-12-18 18:28:45 -07:00
Deimos
fb7b0cb473 Update mypy to 0.760
An improvement to type inference for collection types was added, which
allowed me to eliminate one annotation.
2019-12-17 17:32:46 -07:00
Deimos
a47517e2b8 Move gunicorn server config out of INI files
gunicorn 20.0.0 included a change so that it will no longer read server
configuration out of Paster files. Because of this, the settings for it
in development.ini and production.ini were no longer being used. This
resulted in the auto-reloading no longer working in dev, and the number
of workers being reduced back down to 1 in production. The socket/PID
may have been impacted as well.

This commit moves the configuration into command-line args used to
launch gunicorn, and uses a pillar variable to handle the args different
between dev and prod.
2019-12-17 15:46:45 -07:00
Deimos
d2605215ca Upgrade Python version to 3.8
The "noqa" comments intended for getting the mccabe tool to ignore a
method's complexity needed to be moved as part of this, for some reason.
2019-12-16 20:09:27 -07:00
Deimos
5c1a4dde44 Update Prospector to 1.2.0
This required a few minor changes/fixes:

* Change the name of an ignored pylint check about logging interpolation
* Add check=True to all subprocess.run() calls - this probably always
  should have been used so the scripts will crash if a command fails
* Remove a couple of unnecessary list comprehensions
* Ignore some warnings caused by mypy @hybrid_property workaround
2019-12-16 19:19:07 -07:00
Deimos
037b7abc62 Update pypi package versions (requirements.txt) 2019-12-16 18:34:49 -07:00
Deimos
5c1cf3975d Update cmark-gfm to 0.29.0 2019-12-16 18:16:15 -07:00
yabai
eb7f2a75fd Markdown: Automatically link subreddit references 2019-12-12 17:02:04 -07:00
Deimos
59699427fd Add more SiteInfo entries for common sites 2019-12-12 14:56:03 -07:00
Deimos
39449dd776 Add SiteInfo entries for more common sites 2019-12-11 17:10:00 -07:00
Deimos
9f3f6687ce Adjust info shown for topics posted by scheduler
Previously, scheduled topics just had "Tildes" in place of the name of
the user that posted them, which wasn't very clear. This is a little
more explicit, and uses some different styling for that info on topics
when shown in listings.
2019-12-09 23:15:11 -07:00
Deimos
7d7ff4a2d5 Add SiteInfo entries for more recent sites 2019-12-09 17:32:30 -07:00
Deimos
110a930893 Un-pin and update Marshmallow and webargs
As expected, these updates ended up requiring quite a few changes. I was
initially going to update only Marshmallow, but the older version of
webargs couldn't work with an updated Marshmallow, so I ended up needing
to do both at the same time.

The main changes required were:

* Schemas don't need to be specified as "strict" any more, so that could
  be removed from constructors and Meta classes.
* .validate() now returns a dict of errors (if any) instead of raising a
  ValidationError if anything goes wrong. This meant that I either need
  to check the returned dict, or switch to .load() to still get raised
  errors.
* Marshmallow doesn't support loading from two different field names as
  easily (and changed the name of that to data_key), so all the routes
  using "group_path" needed to be changed to just "path".
* Some of the Field methods and some decorated schema ones like
  @pre_load receive new arguments and needed to be updated to handle
  them and/or pass them on.
* webargs will no longer send a keyword argument for any fields that
  aren't specified and don't have a default value when using
  @use_kwargs. Because of this, I added missing= values for most
  optional fields, but still required some special treatment for the
  order query variable in a couple of topic listing views.

And finally, there is some strange behavior in webargs by default when a
form doesn't send any data for a field (due to the input not being
included or similar). When it doesn't find the field in form data, it
tries to fall back to checking for JSON data, but then crashes because
the request doesn't have any JSON data attached. I had to specify only
to look in the form data in a few places to fix this, but I've also
registered an issue against webargs related to it:
https://github.com/marshmallow-code/webargs/issues/444
2019-12-08 12:53:24 -07:00
Deimos
4b92096fa2 Update pypi package versions (requirements.txt) 2019-12-06 20:38:37 -07:00
Deimos
c1ae7d222c Add link domain as mouseover to link source
This will allow people to mouseover a site name/icon if they want to
check which domain its from. Mousing over the title and checking the
link in the status bar would generally accomplish the same thing, but I
think this might feel a bit more intuitive.
2019-12-06 14:39:39 -07:00
Deimos
fccd738ce5 Add SiteInfo entries for more common sites
No particular method here, just adding a bunch of recent sites that are
relatively common to see submitted.
2019-12-06 14:16:42 -07:00
Deimos
cac004b01e Add SiteInfo entries for most common domains
This is about 50 of the most common domains submitted to Tildes.
2019-12-05 19:39:35 -07:00
Deimos
2dc5460abd Change SiteInfo default content type to article 2019-12-05 19:17:08 -07:00
Deimos
611a2928e4 Change comment voting to not replace comment
This switches comment voting to use the "toggle buttons" that most other
actions are using (e.g. Bookmark). This makes it so that only the vote
button is replaced, instead of the entire comment's contents. This is
mostly significant when the comment contains a <details> block, because
previously voting/unvoting while one of those was expanded would cause
it to collapse when the comment was replaced.

As another side-effect of this, voting will now always appear to
increase the count by 1, and unvoting will always appear to decrease it
by 1. Previously it would re-query the comment, which could result in
larger jumps in the vote count if other people were voting at the same
time. That confused some people, so this will probably be better.
2019-12-04 20:50:29 -07:00
Deimos
282df2bf02 Block SemrushBot in nginx (it ignores robots.txt) 2019-12-04 18:27:20 -07:00
Deimos
63f6ea6069 Allow admins to edit topics by the "generic user"
This will allow admins to edit topics posted automatically by the
scheduling system.
2019-12-04 12:39:02 -07:00
Deimos
d021b38392 Block serpstatbot from crawling the site 2019-12-03 19:27:16 -07:00
Timo
275276da00 Ignore user mentions if the @ is escaped 2019-12-02 11:38:25 -07:00
Deimos
a9fe491ad2 Hide Title in link info if topic title is similar 2019-12-01 19:02:56 -07:00
Deimos
ef9a362297 Force text wrap in topic link info if needed 2019-12-01 16:37:26 -07:00
Deimos
cd5e17636b Hide Description from link info on topic pages
Will probably want to un-hide this or adjust it somehow in the future,
but so far it just seems to be a mess most of the time.
2019-12-01 13:10:28 -07:00
Deimos
480f9025d0 Increase line-height of topic tags
Descenders on some letters (g, p, etc.) were getting cut off in some
situations before, this should fix it.
2019-12-01 12:47:24 -07:00
Deimos
005684a8db Fix hardcoded month on Financials page 2019-12-01 12:26:14 -07:00
Deimos
a56d4a02d1 Update pypi package versions (requirements.txt)
Required a minor change to how mypy is handling enums now. I'm not a big
fan of the result and think it's somewhat incorrect, but the type
annotations in that file are a disaster anyway.
2019-11-30 19:55:24 -07:00
Deimos
5c52a81ec0 Exclude domain from link info, handle blank info
There's no need to show the domain separately on the comments page since
it's being displayed in the link itself just above. This also adds
handling for when there's no info to show, so we won't get the header
and an empty list in those cases.
2019-11-30 15:01:38 -07:00