This isn't working very well in a lot of cases, shouldn't be used until
I've got some workarounds for a lot of the issues that I'm finding.
This reverts commit 369f273f8e.
As part of scraping a link, Embedly will often remove tracking vars from
the query, follow redirects, and so on. This will start using the url
returned back from an Embedly result to replace the one that was
originally submitted when it was different (though the original one will
still be kept in the original_url column).
Uses the "published" time from the Embedly data to display the date that
a link was published if it was more than 3 days before the link topic
was submitted.
Not really a big deal, but deleted topics are getting sent back through
this consumer when the clean_private_data script erases their data,
since that changes the markdown and puts them into the topic.edited
queue. There shouldn't be any reason to process deleted topics and
re-add "blank" metadata (0 word count, no excerpt), so we can just skip
them.
By default, sqlalchemy will set the JSON value of null (the string
"null") in JSONB columns if you set them to None. I want it to set the
actual column to NULL, so they need to be defined with the none_as_null
argument set to True like this.
This is being done to be able to support some other collapsing behavior
starting to come in (for example, as an effect from comment tags).
However, it's starting to get pretty ugly at this point. I should
probably try to implement a wrapper class for Comments that are inside a
CommentTree so that I can move methods like this into that class instead
of needing them to be staticmethods on the CommentTree class itself.
This adds a consumer (in prod only) that uses Embedly's Extract API to
scrape the links from all new link topics and stores some of the data in
the topic's content_metadata column.
Previously, any topic processed by this consumer would have its
content_metadata completely replaced. This won't work once other
consumers or processes start being able to set that data, since we don't
know that this one will always run first.
This commit updates the method the consumer uses so that it will keep
any data that's already in the topic's content_metadata column if
necessary. It would probably be good to generalize this method out
somehow so that it can be used in other places more easily.
Previously, user topic tag filters weren't also filtering out any
"descendant" tags when they were hierarchical. For example, setting a
filter on "ask" wouldn't also filter out "ask.survey". This fixes that
behavior, though it's a bit awkward and maybe could be done better
somehow.
This re-enables the comment tagging functionality, giving the permission
to all users who are over a week old. However, as of this commit, the
tags have no functional effect at all, and are only visible to admins.
This should really be done on the database end, but this is a simple fix
for the sorting being wrong (due to last_reply_time not being set for
single-message conversations).
This follows the REUSE practices to add license and copyright info to
all source files: https://reuse.software/practices/2.0/
In addition, LICENSE.md was switched to a plaintext LICENSE file, to
support the tag-value header as recommended.
Note that files that are closer to configuration than code did not have
headers added. This includes all Salt files, Alembic files, and Python
files such as most __init__.py files that only import other files, since
those are similar to header files which are not considered
copyrightable.
Just some small adjustments to how @extend is used here, so that some of
the styles that apply to "fully collapsed" chains don't get brought over
to the "individually collapsed" comments when they're not wanted.
The % syntax is SASS's recommendation for "@extend-only selectors".
These disables no longer seem to be necessary, due to switching to
Prospector. Some may be related to newer versions of astroid, pylint, or
other reasons.
Pylama is no longer maintained, and has been gradually getting slower
and slower, as well as being incompatible with Python 3.7 and newer
versions of astroid and pylint. This replaces it with Prospector, which
is being maintained by the same group as pylint and some other code
quality tools.
For users that have the "mark new comments" feature enabled, this will
collapse old comments when they re-visit a topic that has new ones. It
involves adding a new "individual collapse" style that only collapses a
single comment and doesn't also hide all of its replies.
New comments and their direct parents will stay uncollapsed, and all
other comments in a path up to the root will be individually collapsed.
Any branches with no expanded comments will be fully collapsed. We
should probably add an indicator for how many comments are in a
collapsed chain so that we can distinguish between individually
collapsed ones and larger collapsed chains.