Commit Graph

17195 Commits

Author SHA1 Message Date
Joffrey JAFFEUX a4684c151b
REFACTOR: badge-title component (#14162)
- uses tagName=""
- removes user property which is not being used
- extract utility functions
- better wording for boolean properties
- initializes all properties
- uses @action
- uses optional chaining
- other minor changes
2021-08-26 15:19:09 +02:00
Martin Brennan 2eddf210d3 DEV: Revert uppy upgrade
This rolls uppy back to the previous bundle that was used,
which will break multipart functionality (which is not yet
enabled anywhere).

No other upload functionality should be affected by this change,
it will be as if d295a16dab had
not been merged.
2021-08-26 09:18:16 -04:00
Blake Erickson 75b0d6df93
SECURITY: escape cat name (#14154) 2021-08-25 17:11:58 -06:00
Robin Ward 167fcb5eef Revert "DEV: fixes broken tests on ember-cli due to uppy"
This reverts commit d4a418e295.
2021-08-25 17:17:53 -04:00
Penar Musaraj 85b8fea262
UX: Add Styling step to wizard (#14132)
Refactors three wizard steps (colors, fonts, homepage style) into one new step called Styling.
2021-08-25 17:10:12 -04:00
Robin Ward cfbf69848a Revert "FIX: The `LogsNotice` service was never unsubscribing from the mbus"
This reverts commit 14b76dece6.
2021-08-25 17:04:59 -04:00
Robin Ward 14b76dece6 FIX: The `LogsNotice` service was never unsubscribing from the mbus
Whenever we `subscribe` to something there should be an equivalent
`unsubscribe` and this implements it for `LogsNotice`.

In the future we should make this closer to what Ember expects a Service
to be, but at least it's properly cleaning up after itself now.
2021-08-25 16:31:48 -04:00
jjaffeux d4a418e295 DEV: fixes broken tests on ember-cli due to uppy
The import was not found and causing the following error:

```
Uncaught TypeError: Class extends value undefined is not a constructor or null
```
2021-08-25 16:01:14 -04:00
Andrei Prigorshnev 506a5dc607
FEATURE: improve "blank page syndrome" on the user notifications page (#14103) 2021-08-25 20:57:27 +04:00
Bianca Nenciu 5ae700e731
FIX: Make user-card-metadata plugin outlet tagless (#14131) 2021-08-25 13:03:53 +03:00
Martin Brennan 58e9fffe4c
DEV: Do not abort direct S3 uploads if upload_debug_mode enabled (#14141)
See the previous commit d66b258b0e as
well.

If enable_upload_debug_mode is true, we do not want to abort the
direct S3 upload, because that will delete the file on S3 and prevent
further inspection of any errors that have come up.
2021-08-25 14:48:06 +10:00
Arpit Jalan 419d71abcb
FEATURE: allow admin to delete all posts by a user irrespectively (#14128)
This commit allows admin to delete all posts by a user irrespective of
site settings `delete_user_max_post_age` and `delete_all_posts_max`.
2021-08-25 10:14:22 +05:30
Alan Guo Xiang Tan f66007ec83
FEATURE: Display unread and new counts for messages. (#14059)
There are certain design decisions that were made in this commit.

Private messages implements its own version of topic tracking state because there are significant differences between regular and private_message topics. Regular topics have to track categories and tags while private messages do not. It is much easier to design the new topic tracking state if we maintain two different classes, instead of trying to mash this two worlds together.

One MessageBus channel per user and one MessageBus channel per group. This allows each user and each group to have their own channel backlog instead of having one global channel which requires the client to filter away unrelated messages.
2021-08-25 11:17:56 +08:00
Martin Brennan d295a16dab
FEATURE: Uppy direct S3 multipart uploads in composer (#14051)
This pull request introduces the endpoints required, and the JavaScript functionality in the `ComposerUppyUpload` mixin, for direct S3 multipart uploads. There are four new endpoints in the uploads controller:

* `create-multipart.json` - Creates the multipart upload in S3 along with an `ExternalUploadStub` record, storing information about the file in the same way as `generate-presigned-put.json` does for regular direct S3 uploads
* `batch-presign-multipart-parts.json` - Takes a list of part numbers and the unique identifier for an `ExternalUploadStub` record, and generates the presigned URLs for those parts if the multipart upload still exists and if the user has permission to access that upload
* `complete-multipart.json` - Completes the multipart upload in S3. Needs the full list of part numbers and their associated ETags which are returned when the part is uploaded to the presigned URL above. Only works if the user has permission to access the associated `ExternalUploadStub` record and the multipart upload still exists.

  After we confirm the upload is complete in S3, we go through the regular `UploadCreator` flow, the same as `complete-external-upload.json`, and promote the temporary upload S3 into a full `Upload` record, moving it to its final destination.
* `abort-multipart.json` - Aborts the multipart upload on S3 and destroys the `ExternalUploadStub` record if the user has permission to access that upload.

Also added are a few new columns to `ExternalUploadStub`:

* multipart - Whether or not this is a multipart upload
* external_upload_identifier - The "upload ID" for an S3 multipart upload
* filesize - The size of the file when the `create-multipart.json` or `generate-presigned-put.json` is called. This is used for validation.

When the user completes a direct S3 upload, either regular or multipart, we take the `filesize` that was captured when the `ExternalUploadStub` was first created and compare it with the final `Content-Length` size of the file where it is stored in S3. Then, if the two do not match, we throw an error, delete the file on S3, and ban the user from uploading files for N (default 5) minutes. This would only happen if the user uploads a different file than what they first specified, or in the case of multipart uploads uploaded larger chunks than needed. This is done to prevent abuse of S3 storage by bad actors.

Also included in this PR is an update to vendor/uppy.js. This has been built locally from the latest uppy source at d613b849a6. This must be done so that I can get my multipart upload changes into Discourse. When the Uppy team cuts a proper release, we can bump the package.json versions instead.
2021-08-25 08:46:54 +10:00
Andrei Prigorshnev 4d5f5a67c1
FIX: the empty state message was appearing in wrong moments on the user bookmarks stage (#14127)
Steps to reproduce:

1. Go to activity/bookmarks
2. Search for something that isn’t in your bookmarks, so you get no results
3. Navigate away and then click "Bookmarked" on the sidebar or open the user menu and click the View All Bookmarks button on the bottom of the bookmarks tab, and you get the message "You haven't bookmarked anything yet". 

This commit fixes the problem. We have a controller with a query parameter q that contains a search query. And we also have a property searchTerm that is bound to the search box on the page and mirrors the value in q. We were using a value from searchTerm when querying the server, but ember controllers are singletons so the searchTerm value persisted between page visits and leaded to this bug.

To make things work properly, we should be using the value from q everywhere except two places when we copy a value from q to searchTerm and vice versa.
2021-08-24 23:40:08 +04:00
Bianca Nenciu ff367e22fb
FEATURE: Make allow_uploaded_avatars accept TL (#14091)
This gives admins more control over who can upload custom profile
pictures.
2021-08-24 10:46:28 +03:00
Kris bde6f7e9b0
UX: Update "get a room" composer message (#14104) 2021-08-23 18:34:23 -04:00
Penar Musaraj 8fa4849abc
FIX: minor SK3 styling issues in Safari (#14121) 2021-08-23 15:42:11 -04:00
Osama Sayegh 19632ecfbb
FIX: Discard old search results if search term changes when moving posts to a different topic (#14117)
This also fixes an incorrect usage of `debounce`.

Meta topic: https://meta.discourse.org/t/odd-search-behaviour-when-moving-messages-as-a-staff-member/201261?u=osama.
2021-08-23 21:03:52 +03:00
Joffrey JAFFEUX a230362f65
FIX: sk3 wizard regressions (#14120) 2021-08-23 19:57:42 +02:00
Joffrey JAFFEUX 691d1bde54
FIX: do not focus after search if dropdown is collapsed (#14118) 2021-08-23 19:33:50 +02:00
Joffrey JAFFEUX d7c185bf3d
DEV: updates chart.js to 3.5.1 (#14107) 2021-08-23 13:49:49 +02:00
Joffrey JAFFEUX cb59681d86
DEV: select-kit third major update with focus on accessibility (#13303)
Major changes included:
- better support for screen readers
- trapping focus in modals
- better tabbing order in composer
- alerts on no content found/number of items found
- better autofocus in modals
- mini-tag-chooser is now a multi-select component
- each multi-select-component will now display selection on one row
2021-08-23 10:44:19 +02:00
Sam f1701764a6
Revert "FIX: Close emoji autocomplete when the opening colon `:` is removed (#14102)" (#14112)
This reverts commit c74f116a48.

Unfortunately it appears to be making mention autocomplete fail
2021-08-23 15:25:33 +10:00
Krzysztof Kotlarek d41aa5e9f5
FEATURE: allow adding small action codes dedicated to groups (#14109)
Plugin API is allowing to add small action codes dedicated to groups.
This will be used by assign-plugin when topic is assigned or unassigned from group.
2021-08-23 15:06:58 +10:00
Osama Sayegh c74f116a48
FIX: Close emoji autocomplete when the opening colon `:` is removed (#14102) 2021-08-23 14:19:38 +10:00
Martin Brennan 4dc93a53e4
FIX: Reset preProcessorStatus state correctly for composer-upload-uppy (#14111)
When resetting the preprocessor status states, we weren't using
the same default state as when the preprocessor status state is
first initialized with an associated plugin. This commit brings
the two into alignment, fixing a bug where if you cancelled an
upload then tried a new one the "Processing Upload" message would
never change to "Uploading... X", so any subsequent uploads were
uncancellable.

Since the state was not being reset correctly, the properties that
were supposed to be numbers ended up as `undefined`, so when calling
prop-- or prop++, they turned into NaN.
2021-08-23 13:50:37 +10:00
Martin Brennan 8989c9e6c9
FIX: Use file.id instead of file.name for media-optimization resolvers (#14110)
This change only applies when uppy is calling the media-optimization-worker.

Since the old way of calling the worker via jQuery file uploader will
be removed soon, there is no point coming up with some random string
to use in place of the file name for the promise resolvers there, we
can live with this for now.
2021-08-23 12:10:33 +10:00
Joe 2ab4f2a126
DEV: adds plugin-outlet before category in /latest on mobile (#14105)
Adding this so themes can avoid template overrides.
2021-08-22 04:06:07 +08:00
Alan Guo Xiang Tan f3f7efd439
DEV: Remove invalid class. (#14100)
There is no CSS class for `noGlyph`.
2021-08-20 16:05:04 +08:00
Martin Brennan ecb83d0279
FIX: Adding debugging and fixing media-optimization-worker issues (#14099)
When we encountered an error with the media-optimization-worker,
we stopped the worker, which made it so further messages were not
received when optimizing images in parallel. Removed this based
on an option.

Also added more debugging lines to help track down issues.
2021-08-20 14:35:39 +10:00
Andrei Prigorshnev d1781e4c7d
FEATURE: improve "blank page syndrome" on the user bookmarks page 2021-08-20 00:08:59 +04:00
Joe e1815a125d
DEV: adds plugin-outlet before category in /latest (#14092)
Adding this so themes can avoid template overrides.
2021-08-20 03:02:40 +08:00
Bianca Nenciu a56122f2d3
FIX: Always reload post's raw when editing a post (#14085)
Sometimes the message bus update can be delayed and editing a post when
that happens will automatically result in a draft conflict.
2021-08-19 15:29:48 +03:00
Andrei Prigorshnev 46cdddbac9
FIX: pick-files-button component (#14045)
A file should be accepted if it has supported extension OR supported MIME type.
2021-08-19 14:56:03 +04:00
Arpit Jalan c481f2ce16
UX: do not show selected composer education messages on whisper post (#14078)
This commit disables the "sequential_replies" and "duplicate_link"
education message on composer when creating a whipser post.
2021-08-19 09:32:32 +05:30
Grayden 64ead3c3a1
FIX: Revoking admin or moderator status doesn't require refresh to delete/anonymize/merge user (#14073)
* FIX: Revoking admin or moderator status doesn't require refresh to delete/anonymize/merge user

On the /admin/users/<id>/<username> page, there are action buttons that are either visible or hidden depending on a few fields from the AdminDetailsSerializer: `can_be_deleted`, `can_be_anonymized`, `can_be_merged`, `can_delete_all_posts`.

These fields are updated when granting/revoking admin or moderator status. However, those updates were not being reflected on the page. E.g. if a user is granted moderation privileges, the 'anonymize user' and 'merge' buttons still appear on the page, which is inconsistent with the backend state of the user. It requires refreshing the page to update the state.

This commit fixes that issue, by syncing the client model state with the server state when handling a successful response from the server. Now, when revoking privileges, the buttons automatically appear without refreshing the page. Similarly, when granting moderator privileges, the buttons automatically disappear without refreshing the page.

* Add detailed user response to spec for changed routes.

Add tests to verify that the revoke_moderation, grant_moderation, and revoke_admin routes return a response formatted according to the AdminDetailedUserSerializer.
2021-08-19 09:57:16 +08:00
Arpit Jalan cfc280676e
FIX: do not show default locale option on site text customization (#14083) 2021-08-19 05:54:21 +05:30
Martin Brennan 2bf2d799c3
FIX: Bookmark delete button alignment in modal-footer (#14087)
The commit cd38ec2a4d broke
the bookmark delete button alignment in the modal.
2021-08-19 10:15:50 +10:00
Penar Musaraj 052c78381b
FIX: Include tags in quick search suggestions (#14080)
Followup to 438a762956
2021-08-18 14:14:10 -04:00
Arpit Jalan 6646ee3046
FIX: if the category slug is not present then search via ID (#14060) 2021-08-18 05:48:06 +05:30
Martin Brennan 49a0552096
DEV: Remove experimental uploader notice in composer (#14074) 2021-08-18 10:17:53 +10:00
Martin Brennan cd38ec2a4d
FIX: Move bookmark modal buttons into modal-footer (#14072) 2021-08-18 08:51:57 +10:00
Joffrey JAFFEUX 823f22ae5e
FIX: uses keyUp as widgets dont handle bubbling (#14068)
discourse/app/widgets/search-menu.js is using keyDown to handle all kind of behaviors, using keyUp here prevents override.
2021-08-17 15:30:57 -04:00
Penar Musaraj 40f7edd276
FIX: Do not display the color scheme ID in interface dropdown (#14066)
When a theme's default color scheme is not marked as user selectable, we were outputting the numeric ID in the UI. This outputs "Theme default" instead.
2021-08-17 15:05:17 -04:00
Joffrey JAFFEUX c65822d47b
FIX: allows paste from context menu to work (#14061)
- uses keyDown for Enter event
- input for other keys and pasting
2021-08-17 16:50:34 +05:30
Martin Brennan d7390f48c7
FIX: Clean up upload events properly in composer (#14052)
I was storing the wrong object as the event listener
reference for the paste and mobile upload button click
events so they were not being cleaned properly on element
destruction.

Also renamed `uploadButton` to the more descriptive
`mobileUploadButton`.
2021-08-16 12:59:27 +10:00
awesomerobot b801319fb8 UX: add a title to the user filter input 2021-08-16 10:53:05 +08:00
Martin Brennan f9e877dbff
FIX: Composer Processing/Uploading status not clearing on cancel and trash (#14050)
When the composer reply is cancelled and the draft is trashed,
the isUploading and isProcessing statuses were not being reset,
so when the composer was opened again the Uploading... or
Processing... message still showed even when the uploads had
been cancelled correctly.

The regular composer-upload mixin suffered the same problem
as the uppy one, where the Processing/Uploading message was not
reset when a reply was cancelled and the draft destroyed.
2021-08-16 09:55:55 +10:00
Jordan Vidrine 621892ea30
UX: Add margin to share input (#14041) 2021-08-13 09:28:45 -05:00