Commit Graph

955 Commits

Author SHA1 Message Date
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
Deimos
9228616c4a Fix duplication of "published" in metadata display 2019-11-30 14:08:56 -07:00
Deimos
ae32c9d600 Show content metadata on link topic comments pages
Very basic version - should probably exclude some of the fields (like
domain) and do some other changes in addition to this, but it's a
reasonable start.
2019-11-30 13:34:49 -07:00
Deimos
f3eca36c67 Add IP-based ratelimit to Stripe donation page
There's still someone trying to use the Tildes donation page to check
stolen credit cards occasionally. The new version of Checkout seems to
be blocking them all successfully, but I might as well not make it easy
on them.
2019-11-28 21:02:35 -07:00
Deimos
6bc388f3aa Add SiteInfo for WordPress (wordpress.com) 2019-11-28 16:57:12 -07:00
Deimos
e9096152c3 Refactor topic/comment queries to join voting data
Previously this was using a subquery, which appears to be less efficient
and is more confusing in some ways.
2019-11-27 13:08:09 -07:00
Deimos
2fe7418f7d Add warning to the top of Votes page 2019-11-26 22:07:41 -07:00
Deimos
40a9bf4084 Move bookmarks link near top of user page menu 2019-11-26 20:29:25 -07:00
ajbt200128
072f5da86d Add page listing topics/comments you've voted on 2019-11-26 19:19:31 -07:00
Deimos
fb429ce8b8 Add SiteInfo for Medium (medium.com) 2019-11-26 16:45:41 -07:00
Deimos
a08cf472fa Uncapitalize Ask subtypes when displaying
Changed my mind, I think this looks better:
"Ask (survey)" instead of "Ask (Survey)", etc.
2019-11-25 19:09:33 -07:00
Deimos
5a5f564d93 Add content types for Ask subtypes (e.g. Survey)
Adds content types for the three main Ask subtypes: Survey,
Recommendations, and Advice.
2019-11-25 18:59:06 -07:00
Deimos
f139c9d8aa Add SiteInfo for Vimeo (vimeo.com) 2019-11-25 18:23:26 -07:00
Deimos
35256fb3fc Add SiteInfo to start generalizing site handling
This moves some of the site-specific logic that was previously embedded
in Topic for YouTube and Twitter links into a more general class named
SiteInfo. This should be expanded more in the future, but will help for
defining site names, ways of displaying their content creators, ability
to define a content type on a per-site basis, and so on.
2019-11-25 18:12:45 -07:00
Deimos
19f1b55574 Use display: block for code blocks inside <pre>
Fixes some minor formatting issues that can come up with code blocks,
since they were previously being treated as inline-block. For example,
this caused list items containing a code block to have a mis-positioned
list item marker.
2019-11-22 15:16:19 -07:00
Deimos
4d4a7a7ee7 Reduce margin below vote count on your own comment 2019-11-21 18:53:28 -07:00
Deimos
8235b4492c Use normal foreground color for comment votes
After removing the bold from the vote count, it's quite difficult to
read if it's in smaller text *and* the secondary foreground color.
2019-11-21 14:27:28 -07:00
Deimos
7fd1c3e72e Close voting after 30 days, delete vote records
This makes it so that posts (both topics and comments) can no longer be
voted on after they're over 30 days old. An hourly cronjob makes this
"official" by updating a flag on the post indicating that voting is
closed. The daily clean_private_data script then deletes all individual
vote records for posts with closed voting, and the triggers on the
voting tables have been updated to not decrement the vote totals when
these deletions happen.

The net result of this is that Tildes only stores users' votes for a
maximum of 30 days, removing a lot of sensitive/private data that builds
up over the long term.
2019-11-20 21:05:47 -07:00
Deimos
8fa01837ce Add "extra bar" when donation goal over 100%
Creates an effect of some "extra bar" (in the same color as Exemplary
labels) expanding on the right end of the donation goal meter when it's
above 100%.
2019-11-18 18:01:15 -07:00
Deimos
f91f532a8e Add a percentage next to the donation goal meter 2019-11-18 16:36:29 -07:00
Deimos
5794b3f0f9 Improve wrapping of bottom row of topic data
On small screens, when the bottom row with a topic's comments, source,
and age starts wrapping, there was some weird behavior. This improves it
so that:

* The number(s) for comments won't wrap separately
* If the row gets taller due to wrapping, text will align to the bottom
2019-11-17 13:17:19 -07:00
Deimos
63ad5dc1b7 Prevent wrapping in "money" column of Financials 2019-11-17 11:33:59 -07:00
Deimos
1a92a6ff68 Update pypi package versions (requirements.txt) 2019-11-14 14:10:23 -07:00
Deimos
9c92f4e5fc Add thousands separator for word counts >= 10000 2019-11-13 11:34:25 -07:00
Deimos
1da4d95b2b Fix strange wrapping of colon after topic type
The way I was doing this before had the colon as part of the metadata,
which meant that it could wrap onto the next line in thin windows,
giving a result like:

Article
: 1500 words

This changes it so that it's added with CSS after the content type when
needed, so it won't wrap separately.
2019-11-13 11:34:25 -07:00
Deimos
af66a76054 Add better control of content metadata by type
Previously, the content metadata displayed next to a topic's content
type (like "Article: 1800 words") was fairly generic and could result in
strange data being displayed if a scraper fetched it for an
inappropriate type (for example, displaying word count for videos).

This creates an enum to hold all the different content metadata fields,
and moves some logic into that class to handle deciding which fields to
show for different types, and the formatting logic for values.
2019-11-13 11:34:25 -07:00
Deimos
d52fb4c7e4 Simplify custom Jinja filters/tests 2019-11-12 20:53:55 -07:00
Deimos
33124e2be9 Improve warnings when replying to old posts
Previously, the warning would only ever say "over a week old", even when
the topic/comment was much older than that. This adds a new function to
create a vague timedelta description for longer periods, and also
enables the Javascript to use it as well through adding the description
as a data attr on the reply button when a warning is needed, instead of
duplicating the logic in JS.
2019-11-12 18:41:51 -07:00
Deimos
6f00daba2f Forcibly wrap topic titles including long "words" 2019-11-11 12:28:25 -07:00
Deimos
d0a325e8b1 Install pyramid-ipython in production too 2019-11-07 14:49:55 -07:00
Deimos
e503d94678 Install ipython in production (for pshell) 2019-11-07 14:45:48 -07:00
Deimos
0393505a82 Add Financials page to show detailed info 2019-11-07 12:49:37 -07:00