Commit Graph
100 Commits
Author SHA1 Message Date
ThibGandEugen Rochko f178a01c11 Fix client-side resizing of image uploads (#11570)
Fixes #11567
2019-08-15 11:52:26 +02:00
ThibGandEugen Rochko 7ffec882ae Fix reverse-proxy caching of instance actor object (#11561) 2019-08-13 15:30:37 +02:00
ThibGandEugen Rochko 5f63339744 Fix more ActivityPub queries setting cookies and preventing caching (#11557) 2019-08-12 22:26:07 +02:00
ThibGandEugen Rochko 789cb3c028 Revert bcrypt to 3.1.12 (#11555) 2019-08-12 17:52:12 +02:00
ThibGandEugen Rochko 646f96d448 Fix ActivityPub and REST API queries setting cookies and preventing caching (#11539)
Regression from #8657
2019-08-11 22:59:40 +02:00
ThibGandEugen Rochko fd01043691 Fix “read more” button behing hidden (regression from #11404) (#11522)
* Fix “read more” button behing hidden (regression from #11404)

This has the side-effect of putting the “Read more” button below possibly
trunctated polls instead of putting the poll below the “Read more”

* Remove dead code
2019-08-08 17:05:50 +02:00
ThibGandEugen Rochko bced70469a Add domain block notes (#11515)
* Add database columns for adding notes to domain blocks/restrctions

* Add admin UI to set private and public comments when blocking a domain

* Add text for private and public comments on domain blocks

* Show domain block comments in admin UI

* Add comments to the domain block undo page

* Make UnblockDomainService more robust regarding upgraded domain blocks

* Allow editing domain blocks

* Rename button from “undo domain block” to “view domain block” in account admin UI

* Change test to unsilence silenced users from upgraded blocks
2019-08-07 20:20:23 +02:00
ThibGandEugen Rochko 396b8cdd0f Improve focus handling with dropdown menus (#11511)
- Focus first item when activated via keyboard
- When the dropdown menu closes, give back the focus to
  the actual element which was focused prior to opening the menu
2019-08-07 13:58:53 +02:00
ThibGandEugen Rochko 111a0628fc Fix image uploads being perfectly white when canvas read access is blocked (#11499)
Fixes #11496
2019-08-06 12:08:19 +02:00
ThibGandEugen Rochko 27a0d02d0d Improve keyboard navigation in privacy dropdown (#11492)
* Trap tab in privacy dropdown

* Give focus back to last focused element when privacy dropdown menu closes

* Actually give back focus to the element that had it before clicking the dropdown
2019-08-06 11:59:58 +02:00
ThibGandEugen Rochko a12f1a0baf Improve dropdown menu keyboard navigation (#11491)
* Allow selecting menu items with the space bar in status dropdown menus

* Fix modals opened by keyboard navigation being immediately closed

* Fix menu items triggering modal actions

* Add Tab trapping inside dropdown menu

* Give focus back to last focused element when status dropdown menu closes
2019-08-06 11:59:46 +02:00
ThibGandEugen Rochko 5c73746b69 Trap tab in modals (#11493) 2019-08-06 11:59:28 +02:00
ThibGandEugen Rochko 792d0dd470 Fix privacy dropdown active state when dropdown is placed on top of it (#11495) 2019-08-06 11:59:14 +02:00
ThibGandEugen Rochko c8fd823327 Change icon button styles to make hover/focus states more obvious (#11474)
* Change icon buttons styles to make hover/focused states more obvious

* Fix CW button size inconsistency

* Fix icon button background color consistency
2019-08-03 19:10:50 +02:00
ThibGandEugen Rochko 089c641020 Disable list title validation button when list title is empty (#11475) 2019-08-03 19:10:39 +02:00
ThibGandEugen Rochko ff789a751a Fix boosting & unboosting preventing a boost from appearing in the TL (#11405)
* Fix boosting & unboosting preventing a boost from appearing in the TL

* Add tests

* Avoids side effects when aggregate_reblogs isn't true
2019-07-30 13:18:23 +02:00
ThibGandEugen Rochko b31b232edf Change links in webUI to rewrite misleading links (#11426)
* [WiP] Show host for “misleading” links

* Disallow misleading targets which domain names are prefixes of link text

* Move decodeIDNA to app/javascript/mastodon/utils

* Add support for international domain names

* Change link origin tag color to darker text color

* Handle links to domains starting with www. as shortened by Mastodon

* [WiP] Ignore links that cannot be misread as URLs, rewrite other links
2019-07-30 12:13:29 +02:00
ThibGandEugen Rochko 78144f4c79 Fix crash when expanding search results for hashtags (#11447) 2019-07-30 12:06:21 +02:00
ThibGandEugen Rochko 9349f1067a Fix animate on hover in poll options without CW (#11404) 2019-07-28 13:48:04 +02:00
ThibGandEugen Rochko 10e78ecf57 Change contrast of status links that are not mentions nor hashtags (#11406) 2019-07-28 06:00:51 +02:00
ThibGandEugen Rochko 92569ffde8 Fix invites not being disabled upon account suspension (#11412)
* Disable invite links from disabled/suspended users

* Add has_many invites relationship to users

* Destroy unused invites when suspending an account
2019-07-26 18:55:33 +02:00
ThibGandEugen Rochko d0c25584b8 Change settings to show restricted accounts only what they have access to (#11394)
Follow-up to 964ae8eee5
2019-07-25 04:22:09 +02:00
ThibGandEugen Rochko fb1b710e8d Fix scrolling in single-column mode on Chrome (#11395)
Fixes #11389
2019-07-23 15:47:18 +02:00
ThibGandEugen Rochko 59fd622adc Fix boost to original audience not working on mobile (#11371) 2019-07-21 18:11:09 +02:00
ThibGandEugen Rochko 7de8c51873 Play animated custom emoji on hover (#11348)
* Play animated custom emoji on hover in status

* Play animated custom emoji on hover in display names

* Play animated custom emoji on hover in bios/bio fields

* Add support for animation on hover on public pages emojis too

* Fix tests

* Code style cleanup
2019-07-21 18:10:40 +02:00
ThibGandEugen Rochko 4bd58b7f2d Display custom emoji in bio field names (#11350)
Already displayed in public pages, but not WebUI
2019-07-21 03:40:27 +02:00
ThibGandEugen Rochko c37c1da41e Disallow numeric-only hashtags (#11363)
* Add spec covering numeric-only hashtags

* Fix hashtag regex
2019-07-19 23:22:35 +02:00
ThibGandEugen Rochko 650459f93c Fix some flash notices/alerts staying on unrelated pages (#11364) 2019-07-19 23:13:21 +02:00
ThibGandEugen Rochko 4fa6472523 Fix avatar animation on hover when not logged in (#11349) 2019-07-19 09:18:23 +02:00
ThibGandEugen Rochko fda437a020 Fix sanitizing lists contents (#11354)
* Add test

* Fix code for sanitizing nested lists stripping all tags
2019-07-19 01:44:58 +02:00
ThibGandEugen Rochko 730c4053d6 Add ActivityPub actor representing the entire server (#11321)
* Add support for an instance actor

* Skip username validation for local Application accounts

* Add migration script to create instance actor

* Make Codeclimate happy

* Switch to id -99 for instance actor

* Remove unused `icon` and `image` attributes from instance actor

* Use if/elsif/else instead of return + ternary operator

* Add instance actor to fresh installs

* Use instance actor as instance representative

Use instance actor for forwarding reports, relay operations, and spam
auto-reporting.

* Seed database in test environment

* Fix single-user mode

* Fix tests

* Fix specs to accomodate for an extra `Account`

* Auto-reject follows on instance actor

Following an instance actor might make sense, but we are not handling that
right now, so auto-reject.

* Fix webfinger lookup and serialization for instance actor

* Rename instance actor

* Make it clear in the HTML view that the instance actor should not be blocked

* Raise cache time for instance actor as there's no dynamic content

* Re-use /about/more with a flash message for instance actor profile
2019-07-19 01:44:42 +02:00
ThibGandEugen Rochko 87f4aea52a Fix typo in StatusPolicy (#11344) 2019-07-18 00:48:26 +02:00
ThibGandEugen Rochko 7e2b6da57f Add setting to disable the anti-spam (#11296)
* Add environment variable to disable the anti-spam

* Move antispam setting to admin settings

* Fix typo

* antispam → spam_check
2019-07-17 21:09:15 +02:00
ThibGandEugen Rochko 873828ad2d Fix custom CSS controller (#11336) 2019-07-17 17:14:25 +02:00
ThibGandEugen Rochko 5599caef49 Extend AUTHORIZED_FETCH mode to user blocks as well (#11332)
* Extend AUTHORIZED_FETCH mode to user blocks as well

* Move decision to deny access to StatusPolicy
2019-07-17 01:53:37 +02:00
ThibGandEugen Rochko 15ddabf95a Fix caching headers in ActivityPub endpoints (#11331)
* Fix reverse-proxy caching in public fetch mode

* Fix caching in ActivityPub-specific controllers
2019-07-17 00:00:39 +02:00
ThibGandEugen Rochko 91544a6cb5 Remove unused Account#magic_key (#11327) 2019-07-16 14:25:56 +02:00
ThibGandEugen Rochko 2f813b7ea1 Disable LDSigning when AUTHORIZED_FETCH is set to true (#11295) 2019-07-15 02:29:39 +02:00
ThibGandEugen Rochko 3595ce6325 Fix leaking private statuses the admin account follows (#11300)
Now that the request is signed, it can return private toots. Do not leak them.
2019-07-15 02:29:04 +02:00
ThibGandEugen Rochko 4e1260feaa Fix BlockService trying to reject incorrect follow request (#11288)
Fixes #11148
2019-07-11 14:50:27 +02:00
ThibGandEugen Rochko d04c584159 Drop magic-public-key from webfinger replies as it's only used for OStatus (#11280) 2019-07-10 17:10:43 +02:00
ThibGandEugen Rochko 85eb418e1f Fix handling of webfinger redirects in ResolveAccountService (#11279) 2019-07-10 17:10:12 +02:00
ThibGandEugen Rochko 27ad4c1501 Fix old migration script depending on the StreamEntry model (#11278) 2019-07-10 17:09:10 +02:00
ThibGandEugen Rochko 1e7187f2a8 Fix Status.remote scope matching *all* statuses (#11265) 2019-07-08 18:17:22 +02:00
ThibGandEugen Rochko 87c1ad4ea3 Fix BackupService crashing when an attachment is missing (#11241)
* Fix BackupService crashing when an attachment is missing

For various reasons such as admin error or out-of-sync media and
database backups, it might be possible for local attachments to be lost.

This commit allows the BackupService to continue its work even if some media
file is missing.

* Change error message
2019-07-08 02:24:25 +02:00
ThibGandEugen Rochko 58276715be Fix support for HTTP proxies (#11245)
* Disable incorrect check for hidden services in Socket

Hidden services can only be accessed with an HTTP proxy, in which
case the host seen by the Socket class will be the proxy, not the
target host.

Hidden services are already filtered in `Request#initialize`.

* Use our Socket class to connect to HTTP proxies

Avoid the timeout logic being bypassed

* Add support for IP addresses in Request::Socket

* Refactor a bit, no need to keep the DNS resolver around
2019-07-07 02:05:38 +02:00
ThibGandEugen Rochko c07cca4727 Only scroll to the compose form if it's not horizontally in the viewport (#11246)
Avoids jumping the scroll around vertically when giving it focus and
editing long toots.
2019-07-06 18:18:08 +02:00
ThibGandEugen Rochko ed544f3166 Fix HTTP requests to IPv6 hosts (#11240) 2019-07-05 22:03:00 +02:00
ThibGandEugen Rochko 99924f282f Memoize ancestorIds and descendantIds in detailed status view (#11234) 2019-07-02 16:03:54 +02:00
ThibGandEugen Rochko dc88d226e1 When deleting & redrafting a poll, fill in closest expires_in (#11203)
Use the smallest preset expires_in such that the new poll would
not expire before the old one.

In the typical case of a quick delete & redraft, this results in
using the same poll duration.

Fixes #10567
2019-07-02 00:36:16 +02:00
ThibGandEugen Rochko 082b3b282f Fix expiration date of filters being set to “Never” when editing them (#11204)
When editing a custom filter, select the shortest preset duration that
still covers the remaining time of that filter.

Fixes #9506
2019-06-30 16:11:21 +02:00
ThibGandEugen Rochko f895bf1984 Optimize makeGetStatus (#11211)
* Optimize makeGetStatus

Because `ImmutableList.filter` always returns a new object and `createSelector`
memoizes based on object identity, the selector returned by `makeGetStatus`
would *always* execute.

To avoid that, we wrap `getFilters` into a new memoizer that memoizes based on
deep equality, thus returning the same object as long as the filters haven't
changed, allowing the memoization of `makeGetStatus` to work.

Furthermore, we memoize the compiled regexs instead of recomputing them each
time the selector is called.

* Fix memoized result being cleared too often

* Make notifications use memoized getFiltersRegex
2019-06-30 00:12:38 +02:00
ThibGandEugen Rochko ccc7fe3e1d When sending a toot, ensure a CW is only set if the CW field is visible (#11206)
In some occasions, such as the browser or a browser extension auto-filling
the existing but disabled/hidden CW field, a CW can be set without the user
knowing.
2019-06-29 18:32:36 +02:00
ThibGandEugen Rochko 84ff393842 Use ScrollToOptions for smooth scrolling if supported (#11207) 2019-06-29 18:32:06 +02:00
ThibGandEugen Rochko 4f5b221be2 Display FTS warning based on actual search term, not the one being typed (#11202)
Follow-up to #11112
2019-06-28 19:29:11 +02:00
ThibGandEugen Rochko 072158ee97 Fix swiping columns on mobile sometimes failing (#11200)
Fixes #9779
2019-06-28 13:52:15 +02:00
ThibGandEugen Rochko ca8944728f Add message telling FTS is disabled when no toot can be found because of this (#11112)
* Add message telling FTS is disabled when no toot can be found because of this

Fixes #11082

* Remove info icon and reword message
2019-06-27 21:12:26 +02:00
ThibGandEugen Rochko 9a90ec3b3b Fix account URI in UpdatePollSerializer (#11194)
* Fix account URI in UpdatePollSerializer

Fixes #11185

* Add specs
2019-06-27 19:41:55 +02:00
ThibGandEugen Rochko 3086c645fd Add option to disable blurhash previews (#11188)
* Add option to disable blurhash previews

* Update option text

* Change options order
2019-06-26 19:33:04 +02:00
ThibGandEugen Rochko 915c619394 Add support for Audio activities (#11189)
Fixes #11127
2019-06-26 19:32:36 +02:00
ThibGandEugen Rochko 32a4494926 Scroll to compose form rather than reply indicator on focus (#11182) 2019-06-26 14:28:36 +02:00
ThibGandEugen Rochko 47ef4a6c7a Apply filters to poll options (#11174)
* Apply filters to poll options in WebUI

Fixes #11128

* Apply filters to poll options server-side

* Add poll options to searchable text
2019-06-25 14:45:14 +02:00
ThibGandEugen Rochko c8fae508cf Completely hide toots matched by “irreversible” filters even if they got to the client (#11113)
Fixes #11090
2019-06-18 18:23:08 +02:00
ThibGandEugen Rochko 17747e2cd7 Fix User#active scope only returning suspended users (#11111)
Fix a regression from #10660
2019-06-18 18:22:02 +02:00
ThibGandEugen Rochko 01e362316c Do not scroll in the compose panel on single-column (#11093) 2019-06-16 18:46:55 +02:00
ThibGandEugen Rochko b4d67fe57a Fix ordering of keyboard access between CW field, textarea and emoji picker (#11066) 2019-06-13 17:07:43 +02:00
ThibGandEugen Rochko dd45c63921 List attachments in reply indicator and boost modal (#10997)
* Add media attachments list to boost modal

* Add attachment list to reply indicator
2019-06-13 17:04:52 +02:00
ThibGandEugen Rochko a4a502e85c Do not expand toot when clicking on a poll option (#11067)
Fixes regression introduced by e9ddd5a159
2019-06-13 00:16:46 +02:00
ThibGandEugen Rochko 1b4dcc3f78 Only show profile directory link when it's enabled (#11064) 2019-06-13 00:16:27 +02:00
ThibGandEugen Rochko c98573fdf9 Add button to conveniently copy OAuth code (#11065) 2019-06-13 00:14:42 +02:00
ThibGandEugen Rochko faafc3ae25 Fix border-bottom of active tab bars (#11068) 2019-06-13 00:14:27 +02:00
ThibGandEugen Rochko 5bcd98172c Fix clicking on the left side of a conversation not marking it as read (#11041) 2019-06-10 19:27:10 +02:00
ThibGandEugen Rochko e428e320b6 Fix old migrations failing because of new version of strong_migrations (#11018) 2019-06-09 22:55:28 +02:00
ThibGandEugen Rochko e9ddd5a159 Put poll options behind content warnings (#10983)
* Put poll options behind CWs in WebUI

* Put polls behind CWs on public pages

* Add poll icon to public pages CWs

* Revert to not showing an icon in the CW button
2019-06-08 17:40:59 +02:00
ThibGandEugen Rochko cdb420862e Fix display of alt-text when a media attachment is not available (#10981) 2019-06-07 12:41:08 +02:00
ThibGandEugen Rochko 2657765d2a Fix “mark as sensitive” not being used in delete & redraft (#10980) 2019-06-06 13:04:34 +02:00
ThibGandEugen Rochko cac9110533 Cleanup various controllers (#10972)
* Remove skip_session! as it is not supported in Rails 5

* Minor cleanup in StreamEntriesController

* Remove redundant mark_cacheable! calls
2019-06-05 14:02:59 +02:00
ThibGandEugen Rochko 7fa23ec697 Fix potential private status leak (#10969) 2019-06-05 13:40:20 +02:00
ThibGandEugen Rochko d34a3a2cc7 Fix refreshing featured toots when the new collection is empty (#10971)
Fixes #10945
2019-06-05 13:39:59 +02:00
ThibGandEugen Rochko 6c464cd424 Do not misattribute inlined boosts if attributedTo isn't present (#10967)
* Do not misattribute inlined boosts if `attributedTo` isn't present

Fixes #10950

* Fix tests
2019-06-04 23:24:31 +02:00
ThibGandEugen Rochko 3a84bacf86 Handle blank poll options more gracefully (#10946)
Pleroma currently allows (erroneously imho) empty poll options, that is,
options with an empty (but existing) `name`.
2019-06-03 20:04:00 +02:00
ThibGandEugen Rochko a353dc6030 Fix NotifyService test with regards to reblogs (#10928)
Fixes #10890
2019-06-02 18:08:26 +02:00
ThibGandEugen Rochko 1c78d600d3 Fix old migrations failing because of new version of strong_migrations (#10904) 2019-05-30 22:35:29 +03:00
ThibGandEugen Rochko 3333250ede Fix React warning about legacy lifecycle calls and sensitive status resetting (#10872) 2019-05-29 17:33:15 +03:00
ThibGandEugen Rochko fe3b863926 Fix web push notifications for polls (#10864)
Fixes #10861
2019-05-28 00:26:08 +02:00
ThibGandEugen Rochko 0e9b8be18a Improve rate limiting (#10860)
* Rate limit based on remote address IP, not on potential reverse proxy

* Limit rate of unauthenticated API requests further

* Rate-limit paging requests to one every 3 seconds
2019-05-27 21:57:49 +02:00
ThibGandEugen Rochko a472190729 Add a keyboard shortcut to hide/show media (#10647)
* Move control of media visibility to parent component

* Add keyboard shortcut to toggle media visibility
2019-05-25 23:20:51 +02:00
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