1017 Commits

Author SHA1 Message Date
Deimos
c06016536c Fix user topic tag filters ignoring descendants
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.
2018-09-07 19:58:23 -06:00
Deimos
62133026a9 Minor tweaks to (admin) display of comment tags
Just some minor adjustments now that I'm actually seeing these in
practice.
2018-09-07 17:08:39 -06:00
Deimos
765f0aef42 Re-enable comment tags, visible to only admins
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.
2018-09-07 14:24:47 -06:00
Deimos
d5e9953594 Prevent user and group links from wrapping
This is awkward when it happens - a user or group name shouldn't be
broken up across lines.
2018-09-06 16:34:41 -06:00
Deimos
d6120c4685 Fix sorting of message lists
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).
2018-09-05 17:30:07 -06:00
Jesse Braham
ee89e58f7b Display the 2FA key in addition to a QR code
Since not all users are able to scan QR codes (ie. those using cli-based
totp applications), allow for manual entry of the 2fa secret key.
2018-09-05 12:42:37 -06:00
Deimos
9ab8ad56b4 Add license and copyright info to all source files
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.
2018-09-04 19:22:11 -06:00
Deimos
35e890d458 topic_listing.jinja2: remove unused variable 2018-09-04 11:45:31 -06:00
Deimos
3b01f1a47b Move search form to macro, remove button border 2018-09-03 23:08:04 -06:00
Deimos
81f53d3f4a Rename INI val stripe_api_key to ini_keys.stripe
This will be a bit more organized when I start adding in some other API
keys.
2018-09-03 18:33:51 -06:00
Deimos
2501b5561e Skip comment tree sorting if tree is empty 2018-09-03 17:30:08 -06:00
Deimos
5334baa8ff Refactor collapsed comments' @extend usage
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".
2018-09-03 17:18:54 -06:00
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