Commit Graph
100 Commits
Author SHA1 Message Date
ThibGandEugen Rochko d63c3c0cef Improve streaming server security (#10818)
* Check OAuth token scopes in the streaming API

* Use Sec-WebSocket-Protocol instead of query string to pass WebSocket token

Inspired by https://github.com/kubevirt/kubevirt/issues/1242
2019-05-24 15:21:42 +02:00
ThibGandEugen Rochko 9a5561a5b8 Fix possible race condition when processing statuses (#10815) 2019-05-23 20:00:39 +02:00
ThibGandEugen Rochko 89d600bedb Move signature verification stoplight to the requests themselves (#10813)
* Move signature verification stoplight to the requests themselves

This avoids blocking messages from known keys for 5 minutes when only one fails…

* Put the stoplight on the actual client IP, not a potential reverse proxy
2019-05-23 15:22:39 +02:00
ThibGandEugen Rochko 9efcca3c54 Retry ActivityPub inbox delivery on HTTP 401 and 408 errors (#10812)
HTTP 401 responses returned by Mastodon's inbox controller may
be temporary if, for instance, the requesting user's actor/key json
could not be retrieved in a timely fashion. This changes allow retries
instead of dropping the message entirely.

Also added HTTP 408 as that error is by nature temporary.
2019-05-23 15:00:30 +02:00
ThibGandEugen Rochko ae18386558 Fix “invited by” not showing up for invited accounts in admin interface (#10791) 2019-05-19 21:40:36 +02:00
ThibGandEugen Rochko 4edf5213dc Add post-deployment migration script to delete public-boosts-of-private-toots (#10783) 2019-05-19 13:49:31 +02:00
ThibGandEugen Rochko a1519a8ef5 Prevent from publicly boosting one's own private toots (#10775) 2019-05-18 00:28:51 +02:00
ThibGandEugen Rochko c1c8c7b2c8 Minor performance improvements and cleanup in formatter (#10765) 2019-05-15 06:54:06 +02:00
ThibGandEugen Rochko 14f6ce2885 Record account suspend/silence time and keep track of domain blocks (#10660)
* Record account suspend/silence time and keep track of domain blocks

* Also unblock users who were suspended/silenced before dates were recorded

* Add tests

* Keep track of suspending date for users suspended through the CLI

* Show accurate number of accounts that would be affected by unsuspending an instance

* Change migration to set silenced_at and suspended_at

* Revert "Also unblock users who were suspended/silenced before dates were recorded"

This reverts commit a015c65d2d1e28c7b7cfab8b3f8cd5fb48b8b71c.

* Switch from using suspended and silenced to suspended_at and silenced_at

* Add post-deployment migration script to remove `suspended` and `silenced` columns

* Use Account#silence! and Account#suspend! instead of updating the underlying property

* Add silenced_at and suspended_at migration to post-migration

* Change account fabricator to translate suspended and silenced attributes

* Minor fixes

* Make unblocking domains always retroactive
2019-05-14 19:05:02 +02:00
ThibGandEugen Rochko dd118449c2 Fix incorrect reference to raw_content (it is raw_text instead) (#10753) 2019-05-11 23:56:07 +02:00
ThibGandEugen Rochko 6d44f2441b Add toot source to delete result to ease Delete & Redraft (#10669)
* Return Status with raw text in raw_content when deleting a status

* Use raw content if available on delete & redraft

* Rename raw_content to text; do not serialize formatted content when source is requested
2019-05-11 06:46:43 +02:00
ThibGandEugen Rochko 6dc9baad2a Change icon and label depending on whether media is marked as sensitive (#10748)
* Change icon and label depending on whether media is marked as sensitive

* WiP use a checkbox
2019-05-10 17:59:57 +02:00
ThibGandEugen Rochko f2be71c293 Add emoji suggestions to CW and poll option fields (#10555)
* Refactor selectComposeSuggestion so that different paths can be updated

* Add suggestions in CW field

* Add emoji suggestion to poll options

* Attempt to fix CSS

* Hide suggestions by default

They will be enabled if the input has focus
2019-05-09 22:10:27 +02:00
ThibGandEugen Rochko 62f5235b6f Prevent silenced local users from notifying remote users not following them (#10575)
* Prevent silenced local users from notifying remote users not following them

This is an attempt to extend the local restrictions of silenced users to the
federation.

* Add tests

* Add tests for making sure private status don't get sent over OStatus
2019-05-09 22:05:43 +02:00
ThibGandEugen Rochko 26fc21c188 Add some caching for HTML versions of statuses pages (#10701) 2019-05-09 22:03:44 +02:00
ThibGandEugen Rochko b2f5b1045f Add description on hover in media gallery (#10713) 2019-05-06 05:33:56 +02:00
ThibGandEugen Rochko 7aa749ab46 Fix transition: all (#10699) 2019-05-04 17:39:53 +02:00
ThibGandEugen Rochko 4f73cde4e1 Minor account media gallery fixes (#10695)
* Make the cursor icon consistant across media types in account media gallery

* Fix the video player modal causing scroll position to reset
2019-05-04 17:36:43 +02:00
ThibGandEugen Rochko b85f216cbc Do not retry processing ActivityPub jobs raising validation errors (#10614)
* Do not retry processing ActivityPub jobs raising validation errors

Jobs yielding validation errors most probably won't ever be accepted,
so it makes sense not to clutter the queues with retries.

* Lower RecordInvalid error reporting to debug log level

* Remove trailing whitespace
2019-05-03 23:45:37 +02:00
ThibGandEugen Rochko 91634947f8 Explicitly disable storage of REST API results (#10655)
Fixes #10652
2019-05-03 20:39:19 +02:00
ThibGandEugen Rochko 011b032300 Provide a link to existing domain block when trying to block an already-blocked domain (#10663)
* When trying to block an already-blocked domain, provide a link to the block

* Fix styling for links in flash messages

* Allow blocks to be upgraded but not downgraded
2019-05-03 20:36:36 +02:00
ThibGandEugen Rochko 5121d9c12f When selecting a toot via keyboard, ensure it is scrolled into view (#10593) 2019-05-03 06:20:35 +02:00
ThibGandEugen Rochko 21a73c52a7 Check that an invite link is valid before bypassing approval mode (#10657)
* Check that an invite link is valid before bypassing approval mode

Fixes #10656

* Add tests

* Only consider valid invite links in registration controller

* fixup
2019-05-02 04:30:12 +02:00
ThibGandEugen Rochko c4f2433300 Disallow robots from indexing /interact/ (#10666)
This does not provide any new information and may just triple the number
of crawled pages
2019-05-02 00:10:19 +02:00
ThibGandYamagishi Kazutoshi 0db269f3dc Minor fixes to the French translation (#10662) 2019-05-01 22:19:55 +09:00
ThibGandEugen Rochko 852ccea676 Fix upload progressbar when image resizing is involved (#10632) 2019-04-25 02:48:54 +02:00
ThibGandEugen Rochko b1a0322a06 Reject follow requests of blocked users (#10633) 2019-04-25 02:47:33 +02:00
ThibGandEugen Rochko 0e78862b61 Allow switching between singe-option and multiple-option polls (#10603) 2019-04-22 14:56:14 +02:00
ThibGandEugen Rochko bdec58b514 Minor code cleanup (#10613) 2019-04-22 14:55:24 +02:00
ThibGandEugen Rochko 6e620dcab1 Use correct local names for fonts (#10594) 2019-04-21 04:42:02 +02:00
ThibGandYamagishi Kazutoshi 7f75792bf3 Allow modal secondary button to shrink and allow wider confirmation modals (#10586)
Fixes #10531
2019-04-16 08:23:07 +09:00
ThibGandEugen Rochko 5247ea4efd Fix batch actions not working on pending accounts (#10508) 2019-04-08 18:35:41 +02:00
ThibGandEugen Rochko cb71c95e22 Export and import show_reblogs together with following list (#10495)
* Refactor imports

* Export show_reblogs when exporting list of followed users

* Add support for importing show_reblogs with following collection

* Fix tests
2019-04-08 07:28:27 +02:00
ThibGandEugen Rochko cc6e3c3900 Cache featured collections, as well as outbox, followers and following (#10467) 2019-04-04 01:30:44 +02:00
ThibGandEugen Rochko d4882aa64a Export and import hide_notifications alongside user mutes (#10335)
* Export hide_notifications along with user mutes

* Import hide_notifications along with muted users list

* Add headers for CSV exports
2019-04-03 18:17:43 +02:00
ThibGandEugen Rochko daab45d4ae Update poll remaining time just like with status timestamps (#10466) 2019-04-03 18:16:55 +02:00
ThibGandEugen Rochko d07b0c038f Hopefully fix input text selection quirks on iOS (#10463)
Fix #10448 (hopefully)
2019-04-03 17:54:54 +02:00
ThibGandEugen Rochko 120544067f Fix filtering of favourited_by, reblogged_by, followers and following (#10447) 2019-04-01 21:24:28 +02:00
ThibGandEugen Rochko 62bafa20a1 Hide blocking accounts from blocked users (#10442)
* Revert "Add indication that you have been blocked in web UI (#10420)"

This reverts commit bd02ec6daa.

* Revert "Add `blocked_by` relationship to the REST API (#10373)"

This reverts commit 9745de883b.

* Hide blocking accounts from search results

* Filter blocking accouts from account followers

* Filter blocking accouts from account's following accounts

* Filter blocking accounts from “reblogged by” and “favourited by” lists

* Remove blocking account from URL search

* Return 410 on trying to fetch user data from a user who blocked us

* Return 410 in /api/v1/account/statuses for suspended or blocking accounts

* Fix status filtering when performing URL search

* Restore some React improvements

Restore some cleanup from bd02ec6daa

* Refactor by adding `without_blocking` scope
2019-04-01 20:06:13 +02:00
ThibGandEugen Rochko 2acd8940de Fix more keybase-related test failures (#10443) 2019-04-01 19:10:44 +02:00
ThibGandEugen Rochko 68c797bece Ensure request.body isn't emptied out before signature verification (#10432)
Fixes #10429
2019-03-31 17:27:24 +02:00
ThibGandEugen Rochko abecaba317 Fix failing keybase-related test (#10428) 2019-03-30 18:15:23 +01:00
ThibGandEugen Rochko 58667072d9 Fix opacity of relationship tags (#10411) 2019-03-28 18:33:26 +01:00
ThibGandEugen Rochko a91acf79b5 Move the account dropdown menubar to the right, make sure it doesn't move (#10390)
* Move the account dropdown menubar to the right, make sure it doesn't move

* Fix margin
2019-03-26 23:05:21 +01:00
ThibGandEugen Rochko 6df4a82969 Add a “Block & Report” button to the block confirmation dialog (#10360) 2019-03-26 17:34:02 +01:00
ThibGandEugen Rochko 0c46bd11aa Fix HTML validation (#10354)
* Fix HTML validation

* Report first HTML error instead on validation error
2019-03-26 17:33:26 +01:00
ThibGandEugen Rochko 94aceb85ad Do not empty timeline of blocked users on block (#10359)
Fixes #10226
2019-03-24 19:15:58 +01:00
ThibGandEugen Rochko 2361917944 Mark the 410 gone response for suspended accounts as cachable (#10339)
This will help a great deal with #9377 when a caching reverse proxy is
configured.
2019-03-21 23:33:18 +01:00
ThibGandEugen Rochko 62dd0b7f9c Fix processing poll Updates (#10333)
ActivityPub::ProcessPollService was checking the JSON-LD context although
it was passed only the `Question` object embedded in the `Update` activity.
2019-03-21 14:24:09 +01:00
ThibGandEugen Rochko 80f0910e21 Add support for custom emojis in poll options (#10322)
* Backend changes for custom emoji support in poll options

* Serialize poll emojis in REST API

* Render custom emojis in poll options

* Render custom emoji in poll options on public pages
2019-03-20 17:29:12 +01:00
ThibGandEugen Rochko 66d9452092 Do not try fetching keys of unknown accounts on a Delete from them (#10326) 2019-03-20 17:20:16 +01:00
ThibGandEugen Rochko 158c31b9df Reduce padding around logo on landing page (#10291) 2019-03-19 23:47:10 +01:00
ThibGandEugen Rochko 1217185cfa Do not distribute Delete when rejecting unapproved accounts (#10321) 2019-03-19 16:33:30 +01:00
ThibGandEugen Rochko d041b7a1e7 Do not show timeline preview or directory widgets if they are disabled (#10284) 2019-03-19 05:48:17 +01:00
ThibGandEugen Rochko a20354a20b Set and store report URIs (#10303)
Fixes #10271
2019-03-17 15:34:56 +01:00
ThibGandEugen Rochko 5e38ef87a7 Fix reblogs privacy (#10302)
* Fix reblogs privacy

* Fix Announce processing specs
2019-03-17 14:54:09 +01:00
ThibGandEugen Rochko 7477db7268 Save quick filter settings when selecting a different filter (#10296)
The active filter is stored in the web app's settings, but no save
is explicitly triggered, meaning that it is only saved when a different
setting is changed.
2019-03-17 03:13:29 +01:00
ThibGandEugen Rochko 6b0eda14a1 Avoid race condition when streaming deleted statuses (#10280)
* Avoid race condition when streaming deleted statuses

* Move redis lock to DistributionWorker to avoid extra Redis value
2019-03-16 20:18:47 +01:00
ThibGandEugen Rochko 9915777a17 Migrate existing open_registrations setting to the new registrations_mode (#10269)
* Migrate existing `open_registrations` setting to the new `registrations_mode`

Fixes #10263

* Remove unrelated db changes that have creeped in
2019-03-14 20:10:43 +01:00
ThibGandEugen Rochko 65d9004ac9 Add UI for enabling/disabling poll notifications (#10255)
* Add UI for enabling/disabling poll notifications

* Add poll notifications to the (advanced) quick filter bar

* Update poll notification message

“Your poll has ended” → “A poll you have voted in has ended”

* Clear up associated notifications when a poll is deleted
2019-03-13 19:29:54 +01:00
ThibGandEugen Rochko 79b00d294d Increase DNS timeouts (#10238) 2019-03-11 13:27:57 +01:00
ThibGandEugen Rochko 5506b9406d Avoid race conditions when creating backups (#10234)
Under load, multiple backups for a single user could be planned, which
is very expensive.
2019-03-11 00:50:31 +01:00
ThibGandEugen Rochko 3a92885a86 Support pushing and receiving updates to poll tallies (#10209)
* Process incoming poll tallies update

* Send Update on poll vote

* Do not send Updates for a poll more often than once every 3 minutes

* Include voters in people to notify of results update

* Schedule closing poll worker on poll creation

* Add new notification type for ending polls

* Add front-end support for ended poll notifications

* Fix UpdatePollSerializer

* Fix Updates not being triggered by local votes

* Fix tests failure

* Fix web push notifications for closing polls

* Minor cleanup

* Notify voters of both remote and local polls when those close

* Fix delivery of poll updates to mentioned accounts and voters
2019-03-11 00:49:31 +01:00
ThibGandEugen Rochko c11dff5049 Reject existing Follows when suspending a remote account (#10230)
* Reject existing Follows when suspending a remote account

Partial fix to #10229

* Add tests
2019-03-10 16:18:58 +01:00
ThibGandEugen Rochko 3f4a6d44fe Fix setting up fields of a previously suspended account (#10222)
Fix #10177 for real
2019-03-08 19:59:08 +01:00
ThibGandEugen Rochko 3aaac4f134 Do not allow adding votes to expired polls (#10214)
* Do not allow adding votes to expired polls

* Only validate expires_at on create
2019-03-08 00:54:50 +01:00
ThibGandEugen Rochko 09c042aa10 Handle StaleObjectError when retrieving polls (#10208) 2019-03-07 15:52:38 +01:00
ThibGandEugen Rochko 34f261e6af Avoid unnecessarily fetching the replies collection when it is empty (#10201) 2019-03-07 01:50:37 +01:00
ThibGandEugen Rochko dfb45374d2 Fix AddLockVersionToPolls migration (#10200) 2019-03-07 01:50:06 +01:00
ThibGandEugen Rochko 96f905f409 Add optimistic lock to avoid race conditions when handling votes (#10196)
* Add optimistic lock to avoid race conditions when handling votes

* Force-reload polls when getting `ActiveRecord::StaleObjectError`
2019-03-06 19:53:57 +01:00
ThibGandEugen Rochko b3668a79ec Disable the underlying button element when an ItemButton is disabled (#10194)
Fixes #10191
2019-03-06 15:10:32 +01:00
ThibGandEugen Rochko cb217444b8 Disable file upload when there is a poll (#10195) 2019-03-06 15:09:18 +01:00
ThibGandEugen Rochko efd0fb8088 Fix newlines in OStatus and RSS serializations (#10183) 2019-03-05 23:58:58 +01:00
ThibGandEugen Rochko 636db1f54f When serializing polls over OStatus, serialize poll options to text (#10160)
* When serializing polls over OStatus, serialize poll options to text

* Do the same for RSS feeds

* Use “[ ] ” as a prefix for poll options instead of “- ”
2019-03-05 21:09:18 +01:00
ThibGandEugen Rochko df5924a1db Do not error out on unsalvageable errors in FetchRepliesService (#10175)
* Do not error out on unsalvageable errors in FetchRepliesService

Fixes #10152

* Fix FetchRepliesWorker erroring out on deleted statuses
2019-03-05 15:21:14 +01:00
ThibGandEugen Rochko d785497ba5 Fix suspended account's fields being set as empty dict instead of list (#10178)
Fixes #10177
2019-03-05 15:19:54 +01:00
ThibGandEugen Rochko cda6ece760 Display closed polls as such (#10156) 2019-03-04 22:52:41 +01:00
ThibGandEugen Rochko 833ffce2df Store remote votes URI (#10158)
* Store remote votes URI

* Add spec for accepting remote votes

* Make poll vote id generation work the same way as follows
2019-03-04 22:51:23 +01:00
ThibGandEugen Rochko 7a25bb858a Ensure only people allowed to see the poll can actually vote (#10161) 2019-03-04 22:47:47 +01:00
ThibGandEugen Rochko f2a1b8b96b Widen allowed time windows for polls (#10162) 2019-03-04 22:46:38 +01:00
ThibGandEugen Rochko 3de71887d8 Add non-JS fallback for polls on public pages (#10155) 2019-03-04 18:03:12 +01:00
ThibGandEugen Rochko 4ced609497 Fixes to the polls UI (#10150)
* Allow unselecting choices in multiple choice polls

* Properly disable checkboxes/radio buttons for polls in public pages

* Visually differentiate checkboxes and radio buttons
2019-03-04 01:54:14 +01:00
ThibGandEugen Rochko f821eca3b3 Correctly make polls and media mutually exclusive (#10141) 2019-03-04 00:40:21 +01:00
ThibGandEugen Rochko e13d3792f3 Make sure the poll is created before storing its id (#10142)
* Make sure the poll is created before storing its id

* Fix updating poll results

* Support fetching Question activities from the search bar
2019-03-04 00:39:06 +01:00
ThibGandEugen Rochko 26c56d0c10 Insert polls in redux stores before statuses so it avoids crashes (#10140) 2019-03-03 23:44:52 +01:00
ThibGandEugen Rochko 99dc212ae5 Fix lists export (#10136) 2019-03-03 15:38:47 +01:00
ThibGandEugen Rochko ee7d79c0ce Fix serialization of boosts (#10129)
The condition introduced by #9998 was wrong, serializing boosts
that weren't self-boosts, and not serializing self-boosts.
2019-02-28 21:35:16 +01:00
ThibGandEugen Rochko d8498b3983 Give the replies collection an identifier and enable pagination (#10128) 2019-02-28 18:16:34 +01:00
ThibGandEugen Rochko 9d3c6f1849 Improved remote thread fetching (#10106)
* Fetch up to 5 replies when discovering a new remote status

This is used for resolving threads downwards. The originating
server must add a “replies” attributes with such replies for it to
be useful.

* Add some tests for ActivityPub::FetchRepliesWorker

* Add specs for ActivityPub::FetchRepliesService

* Serialize up to 5 public self-replies for ActivityPub notes

* Add specs for ActivityPub::NoteSerializer

* Move exponential backoff logic to a worker concern

* Fetch first page of paginated collections when fetching thread replies

* Add specs for paginated collections in replies

* Move Note replies serialization to a first CollectionPage

The collection isn't actually paginable yet as it has no id nor
a `next` field. This may come in another PR.

* Use pluck(:uri) instead of map(&:uri) to improve performances

* Fix fetching replies when they are in a CollectionPage
2019-02-28 15:22:21 +01:00
ThibGandEugen Rochko 6e8743d17a Fix direct timeline pagination in the WebUI (#10126)
The `hasMore` property of timelines in redux store was set whenever an API
request returned only one page of results, *even* if the query only requested
newer conversations (using `since_id`), causing `hasMore` to be incorrectly set to
false whenever fetching new toots in the direct timeline, which happens each time
the direct message column is opened.

(Basically #9516 for direct messages)
2019-02-27 19:13:16 +01:00
ThibGandEugen Rochko 9edab46368 Fix mention processing for unknwon accounts on incoming ActivityPub Notes (#10125)
`::FetchRemoteAccountService` is not `ActivityPub::FetchRemoteAccountService`,
its second argument is the pre-fetched body. Passing `id: false` actually passed
a `Hash` as the prefetched body, instead of properly resolving unknown remote
accounts.
2019-02-27 14:57:14 +01:00
ThibGandEugen Rochko 9dd54ffb1c Avoid redundant HTTP request on some error cases (#10115) 2019-02-25 15:54:17 +01:00
ThibGandEugen Rochko 738c034213 Do not error out when performing admin actions on no statuses (#10094)
Same as #8220 but for reports
2019-02-21 19:36:48 +01:00
ThibGandEugen Rochko 8e7fc7ec73 Fix crash when conversations have no valid participants (#10078)
* Never return empty participants for conversations

Fixes #10068

* Fix client-side crash when conversations have no participants
2019-02-19 20:00:41 +01:00
ThibGandEugen Rochko 359d26a053 Fix “reset” button of instance filter switching to custom emoji admin panel (#10076) 2019-02-19 14:01:22 +01:00
ThibGandEugen Rochko 3a8cb6c737 Add quick link from admin account view to block/unblock instance (#10073) 2019-02-18 14:59:46 +01:00
ThibGandEugen Rochko 6840a77711 Add domain search/filter to the "Federation" (/admin/instances) page (#10071) 2019-02-18 14:59:19 +01:00
ThibGandEugen Rochko 2f7f6af26a Hide domain filter in admin page when “local” filter is active (#10074)
Since the “domain” field is ignored in this case.
2019-02-18 13:37:13 +01:00
ThibGandEugen Rochko d1d7d14f77 Fix video player width not being updated to fit container width (#10069) 2019-02-18 00:10:21 +01:00
ThibGandEugen Rochko 041ff5fa9a Fix crash on public hashtag pages when streaming fails (#10061) 2019-02-16 14:53:27 +01:00