Commit Graph

105 Commits

Author SHA1 Message Date
Deimos 576ef86caf Add count to collapsed groups of multiple comments 2018-09-03 17:00:58 -06:00
Deimos 651fb2f752 Un-bold OP marker in collapsed comments 2018-09-03 13:30:30 -06:00
Chad Birch d5fe63791a Clean up unnecessary linting disables
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.
2018-08-30 02:05:35 -06:00
Chad Birch d170962204 Replace Pylama with Prospector
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.
2018-08-29 19:28:27 -06:00
Chad Birch d1a73f4a12 Check comment permission before displaying excerpt 2018-08-28 23:36:00 -06:00
Chad Birch 14149aaf2c Add a setting to disable collapsing old comments 2018-08-28 21:17:03 -06:00
Chad Birch 4069c33e58 Collapse old comments when re-visiting a topic
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.
2018-08-28 18:31:36 -06:00
Chad Birch 9e57129ddd Display excerpt on collapsed comments
Similar to the excerpts stored and displayed for text topics, this
stores excerpts for comments and displays them when the comment is
collapsed.
2018-08-28 13:15:17 -06:00
Chad Birch 3933f6cd76 Update pypi package versions (requirements.txt) 2018-08-27 17:32:41 -06:00
Chad Birch 7500e564c7 Drop removed_time column on comments
The log_comments table can take over tracking this.
2018-08-27 15:21:54 -06:00
Chad Birch fad78feb3f Adjust frontend-ish code for setting default theme 2018-08-27 00:12:09 -06:00
Celeo 9fbfab2c96 Add account-default theme setting 2018-08-27 00:11:59 -06:00
Bauke a56bb64b31 Add margin-right to search input 2018-08-26 15:44:33 -06:00
Chad Birch 0b4e41bd6c Mypy: enable no_implicit_optional check 2018-08-25 23:15:23 -06:00
Chad Birch 51e8949b84 Add admin tool for removing comments 2018-08-25 22:52:41 -06:00
Chad Birch b4402d32e9 Log comment post events 2018-08-25 22:12:40 -06:00
Deimos 75e0c50e6e Add log_comments table (and LogComment class) 2018-08-22 23:02:52 -06:00
Deimos 826b60e445 Drop removed_time column on topics
This column wasn't being used, and the TopicLog can handle it.
2018-08-22 18:30:09 -06:00
Deimos e87ba0d2a9 Add admin tool for removing topics 2018-08-22 18:24:52 -06:00
Deimos e278dd9cfb User pages: include removed posts for admins 2018-08-22 15:46:34 -06:00
Deimos c6362c49ab Show "comment removed" warning to non-admins 2018-08-22 13:46:41 -06:00
Deimos fa87039fe2 Fix comments being hidden if all deleted/removed 2018-08-22 13:45:22 -06:00
Deimos 96be185dab Add warning about ReBloom license change 2018-08-22 13:22:14 -06:00
Deimos 7186cfc525 Tweak "group not found" HTML/CSS 2018-08-22 10:37:07 -06:00
Celeo 2d57599b68 Add an error page for non-existent groups
Uses the pg_trgm extension (trigrams) to look up groups with similar
names to the one that the user tried to visit and offers them as
suggestions.
2018-08-22 10:37:05 -06:00
Celeo be6fc19c16 Convert all-caps titles to title case 2018-08-21 17:38:49 -06:00
Deimos 0760f6441d Fix comments header styles applying to comments
Previous way was a bad way of doing the styles and some of the rules
were leaking through into the comments themselves. This should be more
specific.
2018-08-21 13:42:31 -06:00
Deimos 5170d283f7 Adjust styles for comment collapse buttons
Just a few minor style adjustments to simplify the styles and fix some
bad wrapping behavior with the new bulk-collapse/expand buttons.
2018-08-21 12:49:58 -06:00
Jeff Kayser 595af8f9ae Add buttons for bulk collapse/expand of comments
Adds two buttons: one for collapsing all child comments (non-top-level
ones) and one for uncollapsing all comments.
2018-08-21 12:49:52 -06:00
Deimos 59799c95db Add extremely basic search
Quite a few aspects of this are very hackish (especially as related to
the templates and things that needed to be done to allow
topic_listing.jinja2 to be inherited from for this new one), but it's a
lot better than nothing.
2018-08-20 18:59:06 -06:00
Deimos 54476a447d Change url methods to treat routes individually
Previously these methods for generating "base" and "normal" urls weren't
treating each route individually and just had a single list of query
vars that would be kept for all routes. This approach is a lot more
flexible and allows separating out only the variables relevant for a
particular route.
2018-08-20 16:54:47 -06:00
Deimos d5c2d18ae7 Add rate limits for posting topics and comments
These limits were determined by looking at site activity so far, and
generally shouldn't have any impact on normal site usage.

This also adds a new request method - apply_rate_limit, which can be
used to check the rate limit and immediately raise an error if it's
exceeded, instead of needing to check and handle the result separately.
2018-08-18 15:14:01 -06:00
Jedi Burrell 98cfa08a60 Fix OK button location for sorting with JS off 2018-08-17 21:19:34 -06:00
Deimos e4b8bb9724 Restrict accidental-ordered-list fix to post start
Previously this was also trying to catch ones at the beginning of new
paragraphs, but that seems to mostly just be causing unexpected issues
when people create ordered lists with a blank line between items. This
can probably be done properly in the future, but just restricting it to
the start of posts is probably better for now.
2018-08-17 12:41:31 -06:00
Deimos 1d8b74ca3c Add auth principals for some topic tools
Allows (manually) granting permissions to allow users to re-tag topics,
move them between groups, and edit their titles.

This should probably be generalized in the near future, but this will do
the trick for now.
2018-08-16 21:44:15 -06:00
Deimos 6a8290aa36 Switch to a general "permissions" column on users
Previously there was a specific is_admin boolean column. This commit
changes to have a general permissions column which is stored in JSON,
and currently should either be a single string or list of strings. These
strings are used as the user's principals for the authorization system.
So now, setting a user as admin would involve adding the string "admin"
to their permissions column, instead of just setting is_admin to True.

As part of this change, I also moved the MutableDict associations onto
specific columns, instead of being attached to JSONB by default (since
this new column won't always be a dict).
2018-08-16 19:15:44 -06:00
Deimos 9775acd9bf Make some follow-up adjustments to 2FA
Nothing too significant in here, just a few adjustments and other
follow-ups that I wanted to do:

* Make backup code usage a bit more lenient - allow uppercase, and
  doesn't need exact spacing as originally displayed.
* Display the backup codes a little more nicely.
* Change the message on the settings page based on whether 2FA is
  enabled or not.
* Use webargs instead of request.params.get
2018-08-16 13:22:41 -06:00
Oden a588431fee Add two-factor authentication
Adds optional two-factor authentication support using TOTP, and
including backup codes in case of a lost 2FA device.
2018-08-15 21:21:37 -06:00
Deimos 2afcb216ea Skip <code> tags when linkifying groups/users 2018-08-13 17:23:49 -06:00
Deimos 134848b9bd Add margin-bottom to <table>
Adding a table to a post wouldn't have any margin below it, so the next
paragraph would be right up against the bottom.
2018-08-13 17:16:07 -06:00
Deimos 1a2b5a8593 Add Black format check to git hooks 2018-08-13 14:33:31 -06:00
Deimos 4d8998d8f9 Re-wrap comments with new max line-length
Black won't re-wrap comments because it has no way to determine when
that's a "safe" thing to do (that might break deliberate line-breaks).
So this is a quick pass through to re-wrap most multi-line comments and
docstrings to the new max line-length of 88.
2018-08-13 14:33:31 -06:00
Deimos 09cf3c47f4 Apply Black code formatter
This commit contains only changes that were made automatically by Black
(except for some minor fixes to string un-wrapping and two
format-disabling blocks in the user and group schemas). Some manual
cleanup/adjustments will probably need to be made in a follow-up commit,
but this one contains the result of running Black on the codebase
without significant further manual tweaking.
2018-08-13 00:24:12 -06:00
Deimos 7961a51b87 Update pylama config for Black style changes
Just a couple minor tweaks needed so that pylama won't edit on some of
the style changes that Black is going to make.
2018-08-12 23:59:26 -06:00
Deimos 320e45d8cf Install Black code-formatter for Python 2018-08-12 18:12:33 -06:00
Deimos 8c6a537665 Move Boussole to its own venv
Boussole (which watches the SCSS files for changes and compiles them)
has just been running in the same venv as the main app until now, but
it's holding back the version of the click package. There's no real
reason that it needs to be in the app venv, so this moves it to its own
one, which also eliminates quite a few other packages that were only
being installed because of Boussole.
2018-08-12 18:00:38 -06:00
Deimos eb712f25f2 Update pypi package versions (requirements.txt) 2018-08-12 14:28:02 -06:00
James Southern 73b73c2591 Prepend REST verbs to all view methods
Example: `def vote_comment` becomes `def put_vote_comment`
2018-08-12 14:13:05 -06:00
Deimos 9746203b55 Add redis.sessions.cookie_max_age to dev INI file
I don't think there was any particular reason this wasn't included, and
makes the behavior closer to what it is in production.
2018-08-10 16:14:49 -06:00
Deimos e3842e88c4 Enable cmark-gfm extensions (table, strikethrough)
An example was recently added to the github cmark repo to show how to
set up the extensions from Python, so this is heavily based on that
code:
https://github.com/github/cmark/blob/master/wrappers/wrapper_ext.py

This should also fix a memory leak, since I wasn't manually freeing the
returned buffer (as the library recommends that you do).
2018-08-10 01:01:58 -06:00