Commit Graph

17416 Commits

Author SHA1 Message Date
Joffrey JAFFEUX
a2ca430068
DEV: prevents hooks to create leaks on widgets (#14207)
Before this, mounted widgets were not correctly unhooked and would keep a reference to a custom widget object.
2021-09-01 14:34:20 +02:00
Joffrey JAFFEUX
55739fd3c9
DEV: cards were leaking mousedown event listener (#14206) 2021-09-01 13:01:37 +02:00
Mark VanLandingham
eba317b74e
DEV: Extract textarea text manipulation to mixin (#14201) 2021-08-31 14:36:26 -05:00
Kris
2bf81592ec
UX: Comma separate public custom field lists (#14200) 2021-08-31 14:08:04 -04:00
Penar Musaraj
8f06528bb2
A11Y: Add "skip to main content" link (#14190) 2021-08-31 13:43:30 -04:00
Kris
94085d0996
UX: Select-kit update alignment fixes (#14199) 2021-08-31 17:44:11 +02:00
Joffrey JAFFEUX
499c69c827
DEV: prevents _lastKeyTimeout to leak after component lifecycle (#14194) 2021-08-31 15:22:25 +02:00
Blake Erickson
a2ccf0a9ff
DEV: Use named parameters for dir-span helper (#14195)
* DEV: Use named parameters for dir-span helper

Follow up to: e50a5c0c73

In order to improve code clarity this change introduces named parameters
for the dir-span helper. This is specifically for the new `htmlSafe`
parameter which you can use instead of just passing in a boolean if the
strings you are passing in have already been escaped.

Before: `{{dir-span category.description false}}`
After: `{{dir-span category.description htmlSafe=true}}`

* Set default value for params arg
2021-08-31 13:51:08 +08:00
Osama Sayegh
45a166b6ef
FIX: Jump to reply button in post stream was not working (#14123) 2021-08-31 15:18:45 +10:00
Penar Musaraj
ba91041b35
UX: Better login/signup styling for small desktop windows (#14185)
This aims to fix UI issues when authenticating sites on DiscourseHub in
iPadOS, which uses a special dialog-like window that is about 650px wide.
2021-08-30 15:22:05 -04:00
Blake Erickson
e50a5c0c73
DEV: Add default on encoding to dir-span (#14183) 2021-08-30 11:25:12 -06:00
Mark VanLandingham
db0429da1f
DEV: make composer-upload-uppy more flexible 2021-08-27 11:56:46 -05:00
David Taylor
31db83527b DEV: Introduce PresenceChannel API for core and plugin use
PresenceChannel aims to be a generic system for allow the server, and end-users, to track the number and identity of users performing a specific task on the site. For example, it might be used to track who is currently 'replying' to a specific topic, editing a specific wiki post, etc.

A few key pieces of information about the system:
- PresenceChannels are identified by a name of the format `/prefix/blah`, where `prefix` has been configured by some core/plugin implementation, and `blah` can be any string the implementation wants to use.
- Presence is a boolean thing - each user is either present, or not present. If a user has multiple clients 'present' in a channel, they will be deduplicated so that the user is only counted once
- Developers can configure the existence and configuration of channels 'just in time' using a callback. The result of this is cached for 2 minutes.
- Configuration of a channel can specify permissions in a similar way to MessageBus (public boolean, a list of allowed_user_ids, and a list of allowed_group_ids). A channel can also be placed in 'count_only' mode, where the identity of present users is not revealed to end-users.
- The backend implementation uses redis lua scripts, and is designed to scale well. In the future, hard limits may be introduced on the maximum number of users that can be present in a channel.
- Clients can enter/leave at will. If a client has not marked itself 'present' in the last 60 seconds, they will automatically 'leave' the channel. The JS implementation takes care of this regular check-in.
- On the client-side, PresenceChannel instances can be fetched from the `presence` ember service. Each PresenceChannel can be used entered/left/subscribed/unsubscribed, and the service will automatically deduplicate information before interacting with the server.
- When a client joins a PresenceChannel, the JS implementation will automatically make a GET request for the current channel state. To avoid this, the channel state can be serialized into one of your existing endpoints, and then passed to the `subscribe` method on the channel.
- The PresenceChannel JS object is an ember object. The `users` and `count` property can be used directly in ember templates, and in computed properties.
- It is important to make sure that you `unsubscribe()` and `leave()` any PresenceChannel objects after use

An example implementation may look something like this. On the server:

```ruby
register_presence_channel_prefix("site") do |channel|
  next nil unless channel == "/site/online"
  PresenceChannel::Config.new(public: true)
end
```

And on the client, a component could be implemented like this:

```javascript
import Component from "@ember/component";
import { inject as service } from "@ember/service";

export default Component.extend({
  presence: service(),
  init() {
    this._super(...arguments);
    this.set("presenceChannel", this.presence.getChannel("/site/online"));
  },
  didInsertElement() {
    this.presenceChannel.enter();
    this.presenceChannel.subscribe();
  },
  willDestroyElement() {
    this.presenceChannel.leave();
    this.presenceChannel.unsubscribe();
  },
});
```

With this template:

```handlebars
Online: {{presenceChannel.count}}
<ul>
  {{#each presenceChannel.users as |user|}} 
    <li>{{avatar user imageSize="tiny"}} {{user.username}}</li>
  {{/each}}
</ul>
```
2021-08-27 16:26:06 +01:00
Joffrey JAFFEUX
480e512e37
DEV: reapply height hack for iOS (#14176) 2021-08-27 12:02:05 +02:00
Martin Brennan
90232af778
DEV: Bump Uppy to v2.X and rebuild bundle (#14173)
Uppy V2 includes the S3 multipart batch presigning change
we contributed in d613b849a6
so we need to upgrade it. This also brings both package.json
files into line and accounts for the renaming of Plugin
to BasePlugin in Uppy.

This has been tested and is working locally for both
regular Ember and Ember CLI, for uploads.json
XHR uploads and for direct S3 uploads (single and multipart).
2021-08-27 11:02:57 +10:00
Martin Brennan
cfeb6347c3
DEV: Make composer-uppy-upload mixin more extensible (#14138)
This mixin needs to be shared between the composer and composer-like
user interfaces. This commit makes it so the events and the underlying
data model is configurable by the component extending the ComposerUploadUppy
mixin.

Also removes two MessageBus unsubscribe calls which were unnecessary.
2021-08-27 10:04:27 +10:00
Joffrey JAFFEUX
14e92bb0ea
FIX: correctly apply unusual padding to profile dropdowns (#14172) 2021-08-27 10:03:59 +10:00
Martin Brennan
99ec8eb6df
FIX: Capture S3 metadata when calling create_multipart (#14161)
The generate_presigned_put endpoint for direct external uploads
(such as the one for the uppy-image-uploader) records allowed
S3 metadata values on the uploaded object. We use this to store
the sha1-checksum generated by the UppyChecksum plugin, for later
comparison in ExternalUploadManager.

However, we were not doing this for the create_multipart endpoint,
so the checksum was never captured and compared correctly.

Also includes a fix to make sure UppyChecksum is the last preprocessor to run.
It is important that the UppyChecksum preprocessor is the last one to
be added; the preprocessors are run in order and since other preprocessors
may modify the file (e.g. the UppyMediaOptimization one), we need to
checksum once we are sure the file data has "settled".
2021-08-27 09:50:23 +10:00
David Taylor
189b4c4992
DEV: Promote all javascripts/discourse devDependencies to dependencies (#14167) 2021-08-26 22:19:44 +01:00
Andrei Prigorshnev
9415fecfd0
UX: improve blank page syndrome on the user messages page (#14165)
The user-topic-list template is also in use in other places when we want to improve blank page syndrome, so this PR is a preparation for that changes as well.
2021-08-26 21:38:34 +04:00
Joffrey JAFFEUX
f66217c0b3
DEV: updates popperjs 2.0.6 -> 2.9.3 (#14163) 2021-08-26 16:37:04 +02:00
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
Martin Brennan
6597a2f7dd
FIX: Paste event not propagating from composer using Uppy (#14040)
When I added the paste event for files in the composer to
send to Uppy, I inadvertently called event.preventDefault()
if the pasted data was text. I removed that now, and I only
return early if the user cannot upload, and if there are no
files on the clipboard nothing happens.
2021-08-13 14:09:59 +10:00
Martin Brennan
b626373b31
FEATURE: First pass of using uppy in the composer (#13935)
Adds uppy upload functionality behind a
enable_experimental_composer_uploader site setting (default false,
and hidden).

When enabled this site setting will make the composer-editor-uppy
component be used within composer.hbs, which in turn points to
a ComposerUploadUppy mixin which overrides the relevant
functions from ComposerUpload. This uppy uploader has parity
with all the features of jQuery file uploader in the original
composer-editor, including:

progress tracking
error handling
number of files validation
pasting files
dragging and dropping files
updating upload placeholders
upload markdown resolvers
processing actions (the only one we have so far is the media optimization
worker by falco, this works)
cancelling uploads
For now all uploads still go via the /uploads.json endpoint, direct
S3 support will be added later.

Also included in this PR are some changes to the media optimization
service, to support uppy's different file data structures, and also
to make the promise tracking and resolving more robust. Currently
it uses the file name to track promises, we can switch to something
more unique later if needed.

Does not include custom upload handlers, that will come
in a later PR, it is a tricky problem to handle.

Also, this new functionality will not be used in encrypted PMs because
encrypted PM uploads rely on custom upload handlers.
2021-08-13 09:14:34 +10:00
Andrei Prigorshnev
bbc565c929
FEATURE: Show the incomming topics banner on the Unseen view (#14032) 2021-08-12 23:59:23 +04:00
Jordan Vidrine
45c9bbc112
UX: Add data-topic-id to featured topic items (#14031) 2021-08-12 14:32:33 -05:00
Jordan Vidrine
4602e14cac
FIX: Button alignment on messages (#14029)
* FIX: Button alignment on messages
2021-08-12 14:00:32 -05:00
Alan Guo Xiang Tan
2fb17b7b17 DEV: Remove code that is not being used.
Code was added in e15c86e8c5 but it isn't
necessary anymore.

Follow-up to e15c86e8c5
2021-08-12 07:56:38 +08:00
Martin Brennan
814aa64a5d
FIX: Notification menu broken on older browsers (#14019)
replaceAll is not available in all versions of Chrome/Firefox/Edge
that we support, so we need to use replace instead
2021-08-12 09:54:15 +10:00
Kris
f848f6cbb6
UX: Fix mobile PM nav for regular users (#14007) 2021-08-11 12:47:03 -04:00
David Taylor
b3c1cb6df6
DEV: Add caret_position.js to ember-cli build (#14009)
This is used when positioning autocompletes in the composer, and elsewhere
2021-08-11 16:42:04 +01:00
Mark VanLandingham
3119b881aa
DEV: Define --footer-nav-height css var (#14008) 2021-08-11 10:29:16 -05:00
David Taylor
70f8fdbe45
FEATURE: Allow linking an existing account from invite acceptance (#13998)
The invite acceptance page is an alternative signup flow, so it makes sense to include the new 'link' functionality there as well.

Followup to 7dc8f8b794
2021-08-11 10:26:37 +01:00
Arpit Jalan
e9b2415e7d
UX: show flair help text for private member visibility only (#14005) 2021-08-11 16:23:58 +10:00
Alan Guo Xiang Tan
e157925308 DEV: Remove unused attributes when publishing read/new. 2021-08-11 11:12:23 +08:00
Osama Sayegh
bdcb96ad1b
UX: Indicate capped history revisions only when they're actually capped (#14000)
We've recently added a limit to the posts history modal so it displays the last 100 revisions only for performance reasons. However, the title of the modal now always says `History, last 100 revisions` even when the post has fewer than 100 revisions which can be a bit noisy.

This PR amends the history modal so the title of the modal says `History` when the post's revisions count is ≤100, and `History, last 100 revisions` when it has more >100 revisions.
2021-08-11 00:24:37 +03:00
Jordan Vidrine
8569895f71
FIX: Fix rtl style for pull right (#13999)
* FIX: RTL fix for pull right
2021-08-10 15:31:04 -05:00
David Taylor
7dc8f8b794 FEATURE: Allow linking an existing account during external-auth signup
When a user signs up via an external auth method, a new link is added to the signup modal which allows them to connect an existing Discourse account. This will only happen if:

- There is at least 1 other auth method available

and

- The current auth method permits users to disconnect/reconnect their accounts themselves
2021-08-10 15:07:40 +01:00
David Taylor
46dc189850 DEV: Improve robustness of associate_accounts_controller
This handles a few edge cases which are extremely rare (due to the UI layout), but still technically possible:

- Ensure users are authenticated before attempting association.

- Add a message and logic for when a user already has an association for a given auth provider.
2021-08-10 15:07:40 +01:00
Arpit Jalan
97f701bc4c
UX: update member visibility help text to include flair information (#13995) 2021-08-10 19:31:29 +05:30
Joffrey JAFFEUX
6d41c37c16
DEV: stop propagation of events on button click (#13993) 2021-08-10 15:52:59 +02:00
Joffrey JAFFEUX
2efe91f49f
UI: fixes sidebar settings border and active styles (#13990)
- active setting should now correctly show an arrow which was previously floating in the middle of nowhere
- uses a correct color for border separation, previously the border was present but invisible as similar to the background
- slighty tweak padding
- makes arrow computation based on a variable
2021-08-10 08:53:22 +02:00
Alan Guo Xiang Tan
fa952c036c UX: Missing translation for title attribute for PM tag route. 2021-08-10 09:58:59 +08:00
Bianca Nenciu
d68f2de4c7
FIX: Reuse avatar-flair component in group preview (#13961)
Sometimes the group flair preview was different than the real group
flair because different components were used for rendering.
2021-08-09 15:38:49 -03:00
Robin Ward
5c07e544af Revert "DEV: Discourse.User has been deprecated since 2.6"
This reverts commit 3edf24437a.

Too many plugins rely on this right now and need to be updated.
2021-08-09 13:42:26 -04:00
Robin Ward
3edf24437a DEV: Discourse.User has been deprecated since 2.6 2021-08-09 12:40:42 -04:00
Jarek Radosz
e68c1d5ba5
DEV: Use key over the deprecated keyCode (#13795)
Makes the code a bit more readable. Inspired by https://github.com/emberjs/ember.js/pull/19185
2021-08-09 11:41:36 +02:00
Joffrey JAFFEUX
8df48b516f
DEV: ensures click listeners are reset between tests (#13900) 2021-08-09 10:00:56 +02:00
Joffrey JAFFEUX
800926fcce
FIX: prevents s shortcut to generate an error (#13974)
When no element is selected, on the homepage for example, pressing `s` would generate the following error:

```
Uncaught TypeError: Cannot read property 'click' of undefined
```

Note that this commit also removes jquery usage.
2021-08-09 09:39:01 +02:00
Vinoth Kannan
8c27e69523
UX: disable "Queue For Review" button if user can't perform action. (#13966)
Currently, it's returning JS error when trying to click the button when the action is already performed by the same staff user.
2021-08-07 12:36:56 +05:30
Joffrey JAFFEUX
bf43d8eb40
DEV: uses vanilla js and DOM to replace link mentions (#13959)
- uses DOM apis
- do not concat strings
- ensures string is set as innerText and not HTML
- do not work on jquery objects
2021-08-06 09:26:54 +02:00
Robin Ward
844c05b70b DEV: New Plugin API method for delegating an app event 2021-08-05 14:44:26 -04:00
Bianca Nenciu
38199424bc
SECURITY: Sanitize d-popover attributes (#13958) 2021-08-05 16:39:17 +03:00
Robin Ward
18c5e9338f DEV: Allow us to use Ember CLI assets in production
This adds an optional ENV variable, `EMBER_CLI_PROD_ASSETS`. If truthy,
compiling production assets will be done via Ember CLI and will replace
the assets Rails would otherwise use.
2021-08-05 08:32:33 -04:00
Andrei Prigorshnev
0c0a11b66a
FEATURE: Disallow putting urls in the title for TL-0 users (#13947)
This disallows putting URLs in topic titles for TL0 users, which means that:

If a TL-0 user puts a link into the title, a topic featured link won't be generated (as if it was disabled in the site settings)
Server methods for creating and updating topics will be refusing featured links when they are called by TL-0 users
TL-0 users won't be able to put any link into the topic title. For example, the title "Hey, take a look at https://my-site.com" will be rejected.

Also, it improves a bit server behavior when creating or updating feature links on topics in the categories with disabled featured links. Before the server just silently ignored a featured link field that was passed to him, now it will be returning 422 response.
2021-08-05 13:38:39 +04:00
Alan Guo Xiang Tan
2c046cc670 FEATURE: Dismiss new and unread for PM inboxes. 2021-08-05 12:56:15 +08:00
Martin Brennan
d3779d4cf7
FIX: Wrong default notification level shown for group (#13952)
In the group interaction UI, if the default_notification_level for
a group was set to 0 (muted) it incorrectly showed as Watching in
the UI because of the ember or() helper, using JS comparison, considered
0 to be a falsey value and always showed 3 (watching) instead.
2021-08-05 13:17:36 +10:00
Krzysztof Kotlarek
7063933755
FEATURE: send user-card:show event (#13910)
Send user-card:show event when card is opened. Other parts may listen, for example, for analytic purpose.
2021-08-05 11:52:28 +10:00
Joffrey JAFFEUX
2ebe900914
DEV: resets post menu extra buttons between tests (#13939)
This ensures we do not leak buttons in acceptance tests
2021-08-05 11:47:49 +10:00
Martin Brennan
d8a0d2262c
DEV: Update pretender and fake-xml-http-request (#13937)
We are still on a version of pretender since 2017
https://github.com/pretenderjs/pretender/releases/tag/v1.6.1

Since then many changes have been made, including adding support
for xhr.upload. Upgrading will let us write proper acceptance
tests for uppy, which uses XmlHTTPRequest internally including
xhr.upload.

Updates pretender to 3.4.7 and fake-xml-http-request to 2.1.2.

Note: There have been no breaking changes in the releases that would
affect us, mainly dropping support for old node versions.
2021-08-05 08:23:01 +10:00
Robin Ward
17f28d4018 DEV: Add a widget API for injecting services
When declaring your widget you can now add an option like: `services: ['cool']`

And your widget instances will automatically get a `this.cool` property
which will resolve to the service. This saves having to look it up
yourself.
2021-08-04 16:27:19 -04:00
Jarek Radosz
fbd1cd5fe1
DEV: Prevent npm usage (#13945)
We rely on yarn workspaces so we don't want people using npm in the repo by accident.

Also updated the required node version to 12+.

~~Not sure about the min yarn version – the latest one could be missing in various CI-like envs, so I might change it yet.~~
Downgraded yarn to ">= 1.21.1" (the oldest of "current" versions, tagged "legacy")
2021-08-04 22:04:58 +02:00
Joffrey JAFFEUX
5b85b254db
DEV: do not process composer preview when collapsed (#13941) 2021-08-04 16:40:31 +02:00
Arpit Jalan
4122affc0f
FIX: use search message context on group message page (#13936) 2021-08-04 13:42:17 +05:30
Osama Sayegh
e67670c1e4
FIX: Consistently show history modal when clicking edit notifications (#13912)
Currently when a user clicks on an edit notification, we use `appEvents` to
notify the topics controller that it should open up the history modal for the
edited post and the appEvents callback opens up the history modal in the next
Ember runloop (by scheduling an `afterRender` callback).

There are 2 problems with this implementation:

1) the callbacks are fired/executed too early and if the post has never been
loaded from the server (i.e. not in cache), we will not get a modal history
because the method that shows the modal `return`s if it can't find the post:

016efeadf6/app/assets/javascripts/discourse/app/controllers/topic.js (L145-L152)

2) when clicking an edit notification from a non-topic page, you're redirected
to the topic page that contains the edited post and you'll see the history
modal briefly and it'll be closed immediately. The reason for this is because
we attempt to show the history modal before the route transition finishes
completely, and we have cleanup code in `initializers/page-tracking.js` that's
called after every transition and it does several things one of which is
closing any open modals.

The fix in this commit defers showing the history modal until posts are loaded
(whether fresh or cached). It works by storing some bits of information (topic
id, post number, revision number) whenever the user clicks on an edit
notification, and when the user is redirected to the topic (or scrolled to the
edited post if they're already in the topic), the post stream model checks if
we have stored information of an edit notification and requests the history
modal to be shown by the topics controller.
2021-08-03 19:06:23 +03:00
David Taylor
ab1460e2ca
UX: Ensure external login icons are visible on hover (#13914)
Some authentication buttons (e.g. apple, oidc, oauth2, saml) do not have a specific color specified. Therefore they were taking the default button-with-icon color, and the icons would almost disappear on hover. This commit adds a default of #000 for these buttons, so that the button hover looks similar to core auth buttons.
2021-08-03 12:48:21 +01:00
Martin Brennan
8eabbdae5c
DEV: Move composer-editor upload functions into mixin (#13923)
This PR moves all the upload related functions into a new
ComposerUpload mixin that is extended by the composer-editor
component. This is being done so I can introduce a ComposerUploadUppy
mixin that overrides functions in the regular ComposerUpload mixin,
via a new composer-editor-uppy component that inherits from
ComposerEditor. The proposed structure, which will be in the next PR,
looks like this:

composer-editor-uppy

```javascript
import ComposerEditor from "discourse/components/composer-editor"
import ComposerUploadUppy from "discourse/mixins/composer-upload-uppy"

export default ComposerEditor.extend(ComposerUploadUppy, {
  layoutName: "components/composer-editor"
});
```

This way the new composer-editor is a dumb component purely used for
testing uppy safely, and within the template for composer.hbs we do
this:

```javascript
@discourseComputed
composerComponent() {
  return this.siteSettings.enable_experimental_composer_uploader
    ? "composer-editor-uppy"
    : "composer-editor";
},
```

```handlebars
{{component composerComponent ...}}
```

This is the only way I can think to do it, because it is not possible to
access the site settings when the component is first declared I can't do
something like:

```javascript
const uploaderMixin = this.siteSettings.use_experimental_uploader?
ComposerUploaderUppy : ComposerUploader;

Component.extend(uploaderMixin, {});
```

An additional change in this PR is explicitly passing in these four
plugin data structures to the composer-editor Component, rather
than relying on JS closures which the mixin cannot do:

* uploadMarkdownResolvers
* uploadProcessorActions
* uploadProcessorQueue
* uploadHandlers
2021-08-03 14:46:32 +10:00
Jordan Vidrine
2c3b4ff135
UX: UX Fixes (#13918)
* UX: Adjust name alignment on email group chooser

* UX: Remove dotted line when using j/k navigation on topic
2021-08-02 17:36:48 -05:00
Rafael dos Santos Silva
e92163367d
FIX: Upload placeholder was missing line break (#13917) 2021-08-02 16:33:51 -03:00
Jean
e7b8e75583
FEATURE: Add post edits count to user activity (#13495) 2021-08-02 10:15:53 -04:00
Joe
7b56325f89
UX: adds hover title with full date to admin users columns (#13913)
This PR adds a hover title to a few columns on the admin users' page

/admin/users/list/active

The hover title will show the date in full format on those columns with shortened dates
2021-08-02 20:54:05 +08:00
Bianca Nenciu
fbf7627c8e
FIX: Make search work with sub-sub-categories (#13901)
Searching in a category looked only one level down, ignoring the site
setting max_category_nesting. The user interface did not support the
third level of categories and did not display them in the "Categorized"
input of the advanced search options.
2021-08-02 14:04:13 +03:00
Alan Guo Xiang Tan
016efeadf6
FEATURE: New and Unread messages for user personal messages. (#13603)
* FEATURE: New and Unread messages for user personal messages.

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2021-08-02 12:41:41 +08:00
Kris
00820f0fad
UX: History controls should use nav-pill styles (#13904) 2021-07-30 19:52:15 -04:00
Rafael dos Santos Silva
d2ab5ab53f
FIX: Better composer placeholder handling during media optimization (#13907) 2021-07-30 18:46:55 -03:00
Andrei Prigorshnev
f0d048b42a
DEV: don't swallow a promise from group.findMembers method and switch to using async/await (#13888) 2021-07-30 21:00:34 +04:00
Jarek Radosz
f740c1a952
DEV: Clear all navItem information between tests (#13903)
Expands the original `clearCustomNavItemHref` from #13025. Fixes issues with discourse-assign tests.
2021-07-30 18:05:04 +02:00
David Taylor
ccf1cd0ca6
UX: Improve copy when a group member search returns no results (#13899)
Previously it would say "There are no members in this group". Now it says "No members match that search."

https://meta.discourse.org/t/group-username-search-empty-search-message-is-wrong/198609
2021-07-30 11:40:21 +01:00
Bianca Nenciu
531dbc5e6a
FIX: Do not offer to save draft if invalid (#13863)
An invalid draft is the draft of a topic with a short title or body.
The client does not save these, but it will ask the client if they want
to save it. Even if the answer is 'yes', the draft is discarded. This
commit skips Save button for small drafts.
2021-07-30 10:43:09 +03:00
Alan Guo Xiang Tan
5633c40e50 DEV: Bump client side plugin-api version.
Follow-up to  91456ad2cb
2021-07-30 10:12:16 +08:00
Alan Guo Xiang Tan
5a47b351ac DEV: Remove ember export which has long been deprecated. 2021-07-30 09:39:31 +08:00
Kris
200a75e4b6
re-show excerpts on bookmark page (#13892) 2021-07-29 18:50:58 -04:00
Kris
668272387d
UX: use share modal in dominating topic msg (#13837) 2021-07-29 16:36:02 -04:00
Mark VanLandingham
c51b39302c
FIX: Typu in intercept-click (#13889) 2021-07-29 15:15:10 -05:00
Mark VanLandingham
91456ad2cb
DEV: Plugin API to add card listener elements (#13887) 2021-07-29 14:25:10 -05:00
Kris
a049b8f596
UX: User bookmark page style adjustments (#13869) 2021-07-29 12:11:15 -04:00
David Taylor
1e66e4602f
UX: Update styling of readonly values in signup form (#13886)
During some authentication flows (e.g. external auth with validated emails), some fields on the signup form are readonly. Previously, they were rendered in a simple `<span>`, with no associated label. This commit makes them render in a disabled `<input>` field, so that the styling matches the rest of the form.

A subtle background is added to the disabled input to distinguish them from editable inputs.
2021-07-29 09:19:44 -05:00
David Taylor
9b8c4d4790
FIX: Add users-directory-controls outlet to mobile template (#13883)
This outlet was added to the desktop template in e1175f9f
2021-07-29 14:40:36 +01:00
Joffrey JAFFEUX
74f0631acd
FIX: allows authentication data to be present in bootstrap (#13885) 2021-07-29 15:01:11 +02:00
Joffrey JAFFEUX
b673fee946
DEV: resets user search cache between tests (#13873)
The current behaviour was producing random tests failures which where consistently reproducible using `seed=32037592518471299633729129648744282271`

The cause of this error, is a previous test not giving any topicId or categoryId resulting in a cache key "undefined-undefined", just like a possibly previous test. Reseting cache between tests, seems the most straightforward and future proof solution
2021-07-28 15:32:49 +02:00
awesomerobot
343ea81ac3 UX: Remove theme-specific css, fix space 2021-07-28 09:34:33 +08:00
Martin Brennan
84e77e9078
FIX: Remove additional setting check for uppy-upload (#13867)
Because the enable_s3_uploads setting may be false for
some sites but GlobalSetting.use_s3? is true, we need to
remove this additional check in uppy-upload. The hidden
enable_direct_s3_uploads setting is sufficient.
2021-07-28 11:26:09 +10:00
Martin Brennan
b500949ef6
FEATURE: Initial implementation of direct S3 uploads with uppy and stubs (#13787)
This adds a few different things to allow for direct S3 uploads using uppy. **These changes are still not the default.** There are hidden `enable_experimental_image_uploader` and `enable_direct_s3_uploads`  settings that must be turned on for any of this code to be used, and even if they are turned on only the User Card Background for the user profile actually uses uppy-image-uploader.

A new `ExternalUploadStub` model and database table is introduced in this pull request. This is used to keep track of uploads that are uploaded to a temporary location in S3 with the direct to S3 code, and they are eventually deleted a) when the direct upload is completed and b) after a certain time period of not being used. 

### Starting a direct S3 upload

When an S3 direct upload is initiated with uppy, we first request a presigned PUT URL from the new `generate-presigned-put` endpoint in `UploadsController`. This generates an S3 key in the `temp` folder inside the correct bucket path, along with any metadata from the clientside (e.g. the SHA1 checksum described below). This will also create an `ExternalUploadStub` and store the details of the temp object key and the file being uploaded.

Once the clientside has this URL, uppy will upload the file direct to S3 using the presigned URL. Once the upload is complete we go to the next stage.

### Completing a direct S3 upload

Once the upload to S3 is done we call the new `complete-external-upload` route with the unique identifier of the `ExternalUploadStub` created earlier. Only the user who made the stub can complete the external upload. One of two paths is followed via the `ExternalUploadManager`.

1. If the object in S3 is too large (currently 100mb defined by `ExternalUploadManager::DOWNLOAD_LIMIT`) we do not download and generate the SHA1 for that file. Instead we create the `Upload` record via `UploadCreator` and simply copy it to its final destination on S3 then delete the initial temp file. Several modifications to `UploadCreator` have been made to accommodate this.

2. If the object in S3 is small enough, we download it. When the temporary S3 file is downloaded, we compare the SHA1 checksum generated by the browser with the actual SHA1 checksum of the file generated by ruby. The browser SHA1 checksum is stored on the object in S3 with metadata, and is generated via the `UppyChecksum` plugin. Keep in mind that some browsers will not generate this due to compatibility or other issues.

    We then follow the normal `UploadCreator` path with one exception. To cut down on having to re-upload the file again, if there are no changes (such as resizing etc) to the file in `UploadCreator` we follow the same copy + delete temp path that we do for files that are too large.

3. Finally we return the serialized upload record back to the client

There are several errors that could happen that are handled by `UploadsController` as well.

Also in this PR is some refactoring of `displayErrorForUpload` to handle both uppy and jquery file uploader errors.
2021-07-28 08:42:25 +10:00
Joffrey JAFFEUX
8ded33c411
DEV: prevents badges tests to log 404 (#13859) 2021-07-27 14:46:49 +02:00
Joffrey JAFFEUX
cdeaddbbb6
DEV: referencing global exists is deprecated (#13857) 2021-07-27 14:42:36 +02:00
Joffrey JAFFEUX
32d0467881
DEV: avoids using document.write (#13858)
It doesn’t provide much than just avoiding some logs in tests. I didn't change test_starter as it's going to be removed at some point.
2021-07-27 14:42:21 +02:00
Bianca Nenciu
760c9a5698
FEATURE: Show draft count in user menu and activity (#13812)
This commit adds the number of drafts a user has next to the "Draft"
label in the user preferences menu and activity tab. The count is
updated via MessageBus when a draft is created or destroyed.
2021-07-27 14:05:33 +03:00
Joffrey JAFFEUX
d801e33e0b
DEV: ensures tree is present for traverseCustomWidgets (#13855)
We already had this check sometimes in code, it's just safer to have this responsibility baked in the function.
2021-07-27 11:37:40 +02:00
awesomerobot
c161f5e0b2 fix badge wrapping on user summary 2021-07-27 12:48:16 +08:00
jbrw
292412f196
DEV: Add new after-create-topic-button plugin outlet (#13848) 2021-07-26 17:39:59 -04:00
Alan Guo Xiang Tan
0ce9fd12d0 DEV: Remove depreciation warning in user-topics-lists controller.
```
The <(unknown):ember849>#canBulkSelect computed property was just overriden. This removes the computed property and replaces it with a plain value, and has been deprecated.
```

Follow-up to 43058db3ca
2021-07-26 09:14:55 +08:00
Andrei Prigorshnev
f79eb207a6 FIX: Don't show the Tis Weekend option in date pickers on Sundays 2021-07-26 08:57:29 +08:00
Andrei Prigorshnev
814781780d FIX: Don't show the Later This Week option in date pickers on Sundays 2021-07-26 08:55:18 +08:00
Andrei Prigorshnev
bd4b87245e
DEV: add more tests for future-date-input-selector (#13836)
This PR contains only tests. These tests are from my old PR with refactoring of future-date-input-selector. That PR was closed because we had some changes in our planes about our time-pickers and additionally these tests were flaky.

Tests in this PR aren't flaky, since they use fake time moments in the future. Tests just document current behaviour of future-date-input-selector.
2021-07-23 22:44:23 +04:00
Kris
c7beb0b9a6
UX: prioritize moderator bg color in PMs (#13833) 2021-07-23 13:06:48 -04:00
Kris
7d9d4bcb6d
FIX: Show bulk button on PMs for all users (#13801) 2021-07-23 12:04:18 -04:00
Bianca Nenciu
2c10809244
FIX: Long poll if window becomes active (#13825)
This commit fixes two bugs. The first one is that onPresenceChange was
called with invalid arguments and it did not register a callback. The
second bug is that it triggered the wrong visibilitychange event. The
function it tried to call does not exist in all versions of MessageBus.
It is safer to trigger an event instead because that exists in all
versions.
2021-07-23 15:52:10 +03:00
Mark VanLandingham
9165f0a0f8
DEV: Export pretty text function for plugin use (#13826) 2021-07-22 14:06:46 -05:00
Andrei Prigorshnev
8bc01c1bb5
DEV: extract leave_group method from the group#remove_member method (#13823)
* Copy remove_member to new `leave` method

* Remove unneeded code from the leave method

* Rearrange the leave method

* Remove unneeded code from the remove_member method

* Add tests

* Implement on the client side
2021-07-22 20:14:18 +04:00
Dan Ungureanu
27211ee7bb
FIX: Ensure browser history contains correct URLs (#13367)
Clicking on an incomplete link to a topic (/t/ID or /t/SLUG) from
another post could replace current history entry or create two: one for
the incomplete URL and another one for the correct one. Going back was
either impossible or took the user to a redirect loop, redirected back
to /t/ID which redirected them again to /t/SLUG/ID.
2021-07-22 18:59:59 +03:00
Andrei Prigorshnev
73e8183ffb
FIX: update the list of users after user joined group (#13822)
* Make UI update after user have joined a public group

* Check if a group exists in the join method
2021-07-22 18:48:26 +04:00
Bianca Nenciu
18c32a809b
FIX: Validate email_accent_bg_color color (#13778)
Using an invalid value was allowed. This commit tries to automatically
fix the color by adding missing # symbol or will show an error to the
user if it is not possible and it is not a CSS color either.
2021-07-22 17:42:47 +03:00
Andrei Prigorshnev
3cf7a3766a
DEV: extract join_group method from groups#add_members method (#13807)
* Copy the add_members method to the new join method

* Remove unneeded code from the join method

* Rearrange the join method

* Remove unneeded stuff from the add_members method

* Extract add_user_to_group method

* Implement of the client side

* Tests

* Doesn't inline users.uniq

* Return promise from join.then()

* Remove unnecessary begin and end

* Revert "Return promise from join.then()"

This reverts commit bda84d8d

* Remove variable already_in_group
2021-07-22 11:11:23 +04:00
Joffrey JAFFEUX
5eb6e9281a
FIX: manually adds frowning_face_with_open_mouth for apple (#13528) 2021-07-21 23:27:20 +02:00
Penar Musaraj
8a470e508e
UX: Improve quick search suggestions (#13813) 2021-07-21 14:00:27 -04:00
Robin Ward
4f328089d6 FIX: Force timeline/progress to re-insert into DOM on topic change
We have CSS animations which depend on the timeline/progress being
completely cleared when navigating from one topic directly to another.
This always worked because our loading component would clear the entire page
between topics but with our new experimental loading component the DOM was being
re-used.

This patch ensures that the timeline is removed completely from the DOM
if the topic changes.
2021-07-21 12:37:40 -04:00
Kris
5ebae8a64d
need to check if currentUser exists (#13814) 2021-07-21 12:26:28 -04:00
Kris
aa6daeaa3e
FEATURE: New style for personal messages (#13800) 2021-07-21 10:41:04 -04:00
Penar Musaraj
2ce2c83bc9
FIX: Show user filter hints when typing @ in search (#13799)
Will show the last 6 seen users as filtering suggestions when typing @ in quick search. (Previously the user suggestion required a character after the @.)

This also adds a default limit of 6 to the user search query, previously the backend was returning 20 results but a maximum of 6 results was being shown anyway.
2021-07-21 09:14:53 -04:00
Joffrey JAFFEUX
519528daa2
FIX: allows to use icon-picker in wizard (#13786)
- inlines dasherize helper in sk
- uses an ajax helper to load wizard's ajax lib when in wizard
- amends wizard's ajax lib to work with string as first arg
- disabled loading spinner in wizard as it's not available
2021-07-21 13:49:21 +02:00
Andrei Prigorshnev
d9faae483d
FIX: Consider 100 years suspension as permanent (instead of 500-years suspension) (#13808)
That'll be consistent with recent changes in https://github.com/discourse/discourse/pull/13776
2021-07-21 15:28:47 +04:00
Krzysztof Kotlarek
40f6ceb6f2
FIX: display warning when SSO email is different from invite email (#13804)
In this commit, we skipped frontend validation when email is obfuscated:
https://github.com/discourse/discourse/commit/534008ba24c

However, if email from SSO is different from email from invite, we should still display warning.
2021-07-21 17:03:04 +10:00
mintsaxon
7162ecfb04 FEATURE: Per-category default slow mode duration for topics.
When configured, all topics in the category inherits the slow mode
duration from the category's default.

Note that currently there is no way to remove the slow mode from the
topics once it has been set.
2021-07-21 12:32:07 +08:00
Kris
5f6b9e36ed
UX: New text and style for dominating topic message (#13789) 2021-07-20 13:58:38 -04:00
Mark VanLandingham
af5cf5ec2a
FIX: User directory - correct variable names (#13798) 2021-07-20 09:58:54 -05:00
Jarek Radosz
351ef6c2cc
UX: Tweak groups page css (#13775)
Improves icon-name alignment.
2021-07-20 12:26:52 +02:00
Kris
b335211038
FEATURE: Add input name so 1password ignores input (#13790) 2021-07-20 15:06:05 +10:00
Penar Musaraj
e3144fc0c7
FIX: Toggle search menu when click the same button (#13781) 2021-07-19 19:01:09 -04:00
Kris
fe5be427c3
Update class name to avoid ad blocker (#13785) 2021-07-19 16:15:09 -04:00
Michael Brown
aa12d12c0b discourse/discourse change from 'master' to 'main': update fixture data 2021-07-19 11:46:15 -04:00
Michael Brown
5f7e60d9dc discourse/discourse change from 'master' to 'main' 2021-07-19 11:46:15 -04:00
Alan Guo Xiang Tan
1472e47aae
FIX: Remove hardcoded value when displaying incoming messages count. (#13774)
Follow-up to 902d0e1e3a.
2021-07-19 14:59:05 +08:00
Kris
8de8989576
UX: consistent share modal & popup, refactoring (#13759) 2021-07-19 09:34:44 +08:00
Osama Sayegh
1c82989f77
FEATURE: Add filter box to the themes/components list (#13767) 2021-07-19 09:33:58 +08:00
Robin Ward
6d999fb087
DEV: Don't use chunked encoding in development mode (#13768)
The express server and http-proxy seem to buffer quite a bit and that
slows down message bus.
2021-07-19 09:31:22 +08:00
Penar Musaraj
4e9b4136b0
FIX: Alignment of user badges in user card (#13770) 2021-07-19 09:30:35 +08:00
Neil Lalonde
b0f06b8ed0
FIX: don't allow category and tag tracking settings on staged users (#13688)
Configuring staged users to watch categories and tags is a way to sign
them up to get many emails. These emails may be unwanted and get marked
as spam, hurting the site's email deliverability.
Users can opt-in to email notifications by logging on to their
account and configuring their own preferences.

If staff need to be able to configure these preferences on behalf of
staged users, the "allow changing staged user tracking" site setting
can be enabled. Default is to not allow it.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2021-07-16 14:50:40 -04:00
Rafael dos Santos Silva
216dc99f18
FIX: Media optimization setting was misnamed (#13766) 2021-07-16 15:13:16 -03:00
Andrei Prigorshnev
27b97e4f64
DEV: add pick-files-button component (#13764)
* DEV: add pick-files-button component
* Scope querySelector to the component, add removeEventListener, fix formatting
2021-07-16 21:50:50 +04:00
Rafael dos Santos Silva
366238bb81
FIX: Disable the post submit button during image processing properly (#13765)
There was a UI bug when submitting multiple files in the same batch. We
would remove the disabled status of the submit button after the previous
file was sucesfully uploaded and the next one was still mid
optimization.

Reported at https://meta.discourse.org/t/-/194841/15?u=falco
2021-07-16 14:19:59 -03:00
Dan Ungureanu
079d2af55f
FIX: Clear stale status of reloaded reviewables (#13750)
* FIX: Clear stale status of reloaded reviewables

Navigating away from and back to the reviewables reloaded Reviewable
records, but did not clear the "stale" attribute.

* FEATURE: Show user who last acted on reviewable

When a user acts on a reviewable, all other clients are notified and a
generic "reviewable was resolved by someone" notice was shown instead of
the buttons. There is no need to keep secret the username of the acting
user.
2021-07-16 19:57:12 +03:00
Mark VanLandingham
9b15affaae
DEV: Plugin outlet in topic-status component (#13763) 2021-07-16 11:10:35 -05:00
Penar Musaraj
438a762956
FEATURE: Add assistant to quick search widget (#13650)
Replaces the autocomplete overlay for categories and usernames on the search input and adds suggestions as items in the search results instead. Also adds the same behaviour for @mentions as well as special `in: status: order:` keywords. See PR for more details.
2021-07-16 11:08:20 -04:00
Osama Sayegh
810892139b
FIX: Ascending/descending sorting in the group membership requests page
The `GroupsController#members` endpoint accepts a `desc` parameter to determine how members are sorted, but it's been deprecated in favor of a boolean `asc` parameter. However, in the frontend, specifically the group membership requests page was not updated entirely to use the `asc` param and it still passes a `desc` param when changing how group requests are sorted.

This commit updates the `group-requests` Ember controller so it passes a boolean `asc` param and removes all references of `desc`. The controller view/template has already been updated to use `asc`:

207c3085fc/app/assets/javascripts/discourse/app/templates/group-requests.hbs (L15-L16)
2021-07-16 11:02:24 +03:00
Penar Musaraj
207c3085fc
DEV: Refactor stylesheet live-reloading (#13755)
We have had reports of tabs freezing in Firefox, and reporting an error
in this line. I haven't been able to reproduce, but I suspect the
`forEach` loop is at the heart of the issue, so I have replaced it with
(hopefully) a safer call.

* More refactoring
* Do not reload stylesheets with unchanged filenames
* Select last matching stylesheet
2021-07-16 13:43:31 +10:00
Andrei Prigorshnev
1cadae3879
FIX: simplify and improve choosing favorite badges (#13743)
* No need to return anything except a status code from the server

* Switch a badge state before sending a request and then switch it back in case of an error
2021-07-16 11:13:00 +08:00
Osama Sayegh
7323c65d53
FIX: Debounce group name validation correctly (#13757) 2021-07-16 10:51:13 +08:00
Jarek Radosz
c458cebfc3
FIX: User's "Top badges" grid (#13752)
Fixes a regression introduced in #13719
2021-07-15 21:16:35 +02:00
Vinoth Kannan
d6fc39c886
FEATURE: update existing users when group default notifications changed. (#13434)
Currently, the changes will only affect the users added after.
2021-07-15 19:53:57 +05:30
Joe
ebce983a26
DEV: pass more arguments to before-create-topic-button (#13740)
This commit passes a few more arguments to the `before-create-topic-button` outlet.

We need these arguments to avoid template overrides in themes.
2021-07-15 21:11:59 +08:00
Osama Sayegh
31aa701518
FEATURE: Add option to grant badge multiple times to users using Bulk Award (#13571)
Currently when bulk-awarding a badge that can be granted multiple times, users in the CSV file are granted the badge once no matter how many times they're listed in the file and only if they don't have the badge already.

This PR adds a new option to the Badge Bulk Award feature so that it's possible to grant users a badge even if they already have the badge and as many times as they appear in the CSV file.
2021-07-15 05:53:26 +03:00
Kris
0109edb847
UX: stop imgur/google photo mobile onebox overflow (#13738) 2021-07-15 09:14:05 +08:00
Penar Musaraj
7d43e51821
FIX: Remove button to dismiss theme error messages (#13734) 2021-07-14 15:17:32 -04:00
Jarek Radosz
f89b135a21
FIX: user/badges grid fix (#13729)
No more special CSS just for this path.
2021-07-14 16:43:24 +02:00
Bianca Nenciu
2318bd66a7
FIX: Use array to keep best link for each onebox (#13717)
Use a Map to hold the best link element for each Onebox HTML element.

Using an Object did not work as intended because Object can use only
Strings or Symbols as keys. Using HTML elements (representing oneboxes)
as keys most probably converted them to some generic string and sometimes
different Oneboxes were associated same key. It seems to be browser and
content dependent, without any clear indication of what is happening
internally.

This bug caused link counts to show only for the last Onebox because
the best link from the last Onebox was considered for all the other
Oneboxes.
2021-07-14 12:51:55 +03:00
Jordan Vidrine
1fb48fc9a6
A11Y: Add labels where needed (#13686) 2021-07-14 14:19:21 +08:00
Jarek Radosz
a2425487b2
UX: Make sure there's always a margin on badges page (#13693) 2021-07-14 13:45:26 +08:00
Jarek Radosz
c3045e6828
FIX: Don't try to load badges if there none left (#13695)
Converted `actions` hash to `@action` and added:

```
if (!this.canLoadMore) {
  return;
}
```
2021-07-14 14:42:31 +10:00
Bianca Nenciu
d11fe6fde5
FIX: Use rem for font sizes in post headings (#13720)
Size of headings increased proportionally with their nesting because
their size was relative to the parent element (used em). This commit
makes headings from posts use rem instead which are relative to the
root HTML element.

<h1><div><h1>test</h1></div></h1> looks the same as <h1>test</h1> now.
2021-07-14 11:15:58 +10:00
Jarek Radosz
15320d432b
DEV: Make badges grid a grid (#13719)
Even grid gaps, more space for text, removed on-hover shadow

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2021-07-13 21:58:51 +02:00
Gerhard Schlager
9c8645b9e1 FIX: Don't downcase "all groups" in dropdown
Because this doesn't make sense in languages other than English
2021-07-13 20:29:07 +02:00
Bianca Nenciu
5bff65aa69
FIX: Do not show invalid option in flair chooser (#13725)
Both of the commits in this PR are meant to fix the problem of invalid
option being shown in the flair chooser. An invalid option can be shown
if at some point it was a valid one - a group with a flair that was
later changed by an admin and flair was removed. The other option an
invalid option can be selected is if the user had a primary group when
the migration ran and copied the same value to the flair_group_id
column.

* FIX: Set flair_group_id only if group has flair

Follow up to 4ba93aac66.

* FIX: Do not show invalid option in flair chooser

If selected flair group became unavailable because the flair was removed
then the option would still be selected and visible as an ID only.
2021-07-13 19:22:39 +03:00
Mark VanLandingham
5ea98b4df3
DEV: App event when modal is closed (#13722) 2021-07-13 09:57:10 -05:00
Guhyoun Nam
0dc96ce817
FEATURE: Setting to allow moderators to change post ownership (#13708) 2021-07-13 09:40:11 -05:00
Bianca Nenciu
21cf1b78da
FIX: Various translation string fixes (#13715)
Make small action post description a correct sentence. Replace true and
false in site settings description with enabled and disabled.
2021-07-13 12:52:13 +03:00
Martin Brennan
7911124d3d
FEATURE: Uppy image uploader with UppyUploadMixin (#13656)
This PR adds the first use of Uppy in our codebase, hidden behind a enable_experimental_image_uploader site setting. When the setting is enabled only the user card background uploader will use the new uppy-image-uploader component added in this PR.

I've introduced an UppyUpload mixin that has feature parity with the existing Upload mixin, and improves it slightly to deal with multiple/single file distinctions and validations better. For now, this just supports the XHRUpload plugin for uppy, which keeps our existing POST to /uploads.json.
2021-07-13 12:22:00 +10:00
Kris
e2d04a8592
UX: Improve share modal consistency (#13689) 2021-07-12 20:55:59 -04:00
Roman Rizzi
024911cfc4
UX: Move the skip auth confirmation spinner inside the modal body. (#13710) 2021-07-12 20:21:57 -03:00
Jeff Wong
d87a0216bb
FEATURE: Penalty history improvements (#13359)
* FEATURE: add penalty history when silencing a user

Display penalty history (last 6 months) when silencing/suspending a user

* FEATURE: allow default penalty values to be chosen

Adds a site setting that designates default penalty values in hours.

Silence/suspend modals will auto-fill in the default values, but otherwise
will still allow moderators to pick and overwrite values as normal.

First silence/suspend: first value
Second silence/suspend: second value
etc.

Penalty counts are forgiven at the same rate as tl3 promotion requirements do.

Co-authored-by: jjaffeux <j.jaffeux@gmail.com>
2021-07-12 11:36:56 -07:00
Kris
729a9856f8
UX: Add copy button to theme public key (#13690) 2021-07-12 14:34:08 -04:00
Bianca Nenciu
2f5e63fd7f
FIX: Use created_at if last_posted_at is null (#13668)
Topic timeline showed Jan 1970 as last posted time if all posts of a
topic were deleted or whispers.
2021-07-12 19:35:40 +03:00
Andrei Prigorshnev
d9eb37be70
UX: improve the link to the preferences page on the new and unread tabs (#13701)
When the New tab and the Unread tab are empty we show educational messages with links to the preferences page. Both links lead to preferences/account page. In fact, settings that changes behaviour of the New and the Unread tab are on the preferences/notifications page. This PR makes links lead there.
2021-07-12 16:52:23 +04:00
Jarek Radosz
efac01d259
FIX: Scroll to top on badge pages (#13694)
…so we don't end up at a random point on the page after a transition.
2021-07-12 10:48:23 +10:00
Kris
aebc6164fc
UX: Add success state to copy button (#13691)
Replaces the message "Topic link copied" with a more intuitive delayed change of the copy button to a success tick.
2021-07-12 10:47:24 +10:00
Dan Ungureanu
2d904ade6d
FIX: Let staged users choose their username (#13678)
When a staged user tried to redeem an invite, a different username was
suggested and manually typing the staged username failed because the
username was not available.
2021-07-12 07:57:38 +10:00
Kris
538dcb7acd
UX: Fix z-index for new topic alert (#13676) 2021-07-09 15:22:30 -04:00
Penar Musaraj
c7cdebd931
FIX: Switch logos live when changing color schemes in user prefs (#13684) 2021-07-09 14:07:00 -04:00
David Taylor
e1175f9f35
DEV: Add users-directory-controls outlet (#13679)
This can be used by themes/plugins to add additional buttons to the user directory controls
2021-07-09 11:49:34 +01:00
Roman Rizzi
ba62ecac68
FIX: can_admin_group should be true when creating a new group. (#13671)
It looks like this regressed in #10432.

A user can create a group if they're an admin or if they're a mod and the "moderators_manage_categories_and_groups" setting is enabled, so it's safe to always set "can_admin_group" to true for new groups.

It will let us configure automatic membership, default title, and effects on create.
2021-07-09 12:15:00 +08:00
Bianca Nenciu
c39ab6c0ae
FIX: Do not wrap flair title in chooser (#13667) 2021-07-08 15:51:47 +03:00
Bianca Nenciu
87c1e98571
FEATURE: Let users select flair (#13587)
User flair was given by user's primary group. This PR separates the
two, adds a new field to the user model for flair group ID and users
can select their flair from user preferences now.
2021-07-08 10:46:21 +03:00
David Taylor
2a1abe9ff0
DEV: Expire cn cookie at end of session (#13659)
This cookie is used to transmit notification read state to the server. It is always cleared by the server on the next page load, so there is no need for the expiry to be so long. This commit updates it to expire at the end of the session (the default), and replaces raw `document.cookie` usage with our `cookie` library.
2021-07-07 11:44:26 +01:00
Alan Guo Xiang Tan
f57d49ed01
UX: Layout issues with topic last visit line. (#13655)
Remove the calculation of width and instead switch to small action class
that automatically sets the width based on the screen size.
2021-07-07 12:40:40 +08:00
Martin Brennan
35f6441938
DEV: Add uppy.js to build and project (#13645)
This PR adds uppy to the project with a custom JS build and the shims needed to import it into our JS code. We need a custom build of Uppy because we do not use webpack for our JS modules/build. The only way to get what you want from Uppy is to use the webpack modules or to include the entire Uppy project including all plugins in a single JS file. This way we can just use the plugins we actually want. Future PRs will actually use Uppy!
2021-07-07 10:39:33 +10:00
Penar Musaraj
95b5794331
DEV: Compile core and plugin stylesheets independently of themes (#13638)
Take 2 of https://github.com/discourse/discourse/pull/13466. 

Fixes a few issues with the original PR: 

- color definition stylesheet target now includes the theme id, to avoid themes set to use the default color scheme loading the same stylesheet 
- changes the internal cache key for color definition stylesheet to reset the pre-existing cache
2021-07-06 13:11:10 -04:00
Dan Ungureanu
da03a3f5d6
FIX: Maintain order when updating notifications (#13643)
A more complex algorithm was used to achieve consensus between server
and client lists of notifications. This commit uses a different and
more simple approach that ignores order, but updates read status of
existing notifications and removes stale notifications.
2021-07-06 13:33:56 +03:00
Vinoth Kannan
33eae4cbd8
FEATURE: add period filter in top topics route for tags. (#13415)
And also move all the "top topics by period" routes to query string param.

/top/monthly => /top?period=monthly
/c/:slug/:id/l/top/monthly => /c/:slug/:id/l/top?period=monthly
/tag/:slug/l/top/daily => /tag/:slug/l/top?period=daily (new)
2021-07-06 15:25:11 +05:30
Dan Ungureanu
34387c5a38
FEATURE: Warn if invited user cannot see topic (#13548)
Users can invite people to topics from secured category, but they will
not be redirected to the topic after signing up unless they have the
permissions to view the topic. This commit shows a warning when invite
is saved if the topic is in a secured category and none of the invite
groups are allowed to see it.
2021-07-06 12:49:26 +03:00
jbrw
cf63931b9e
UX: Remove background image after image has loaded (#13642)
* UX: Remove background image after image has loaded

If an image has a `smallUpload`, that may be set as the `background-image` on the `img` element, and the `img` element set to use `lazy` loading. When the browser decides to load the `src` of the image element, it is rendered on top of the existing background image.

However, if the image proper has a transparent background, the background image may be partially visible through the transparent portions of the image.

This change creates an `onload` event that removes the background image when the image proper has completed loading.
2021-07-05 19:15:29 -04:00
Penar Musaraj
48f36d43eb
DEV: Remove duplicate filterable option in tag-drop (#13640)
Has no effect and raises a console deprecation warning.
2021-07-05 14:42:17 -04:00
Alan Guo Xiang Tan
04f97d4f51
UX: Remove top border on small action after last visit line. (#13633)
Follow-up to 37b8ce79c9
2021-07-05 16:00:50 +08:00
Alan Guo Xiang Tan
37b8ce79c9
FEATURE: Add last visit indication to topic view page. (#13471)
This PR also removes grey old unread bubble from the topic badges by
dropping `TopicUser#highest_seen_post_number`.
2021-07-05 14:17:31 +08:00
Alan Guo Xiang Tan
43058db3ca
UX: Use topic list bulk select toggle for user messages list. (#13614) 2021-07-05 10:43:58 +08:00
David Taylor
ddaf2f55fd
FIX: Build quote share URL using post number, not post ID (#13622) 2021-07-02 22:50:04 +01:00
Roman Rizzi
7e6a317597
FIX: Load the category when the category_id attr is present. (#13621)
The store won't autoload the reviewable category anymore as we removed that piece of code in #13412. This commit adds it as a computed property.
2021-07-02 18:25:51 -03:00
Mark VanLandingham
894eb66a0d
FIX: Do not reload whole directory table on username input change (#13616) 2021-07-02 09:51:14 -05:00
Jarek Radosz
fdb85b8025
DEV: Add theme-color meta to bootstrap (#13615)
It's rendered in Rails in:

ebcc70a5ba/app/views/layouts/_head.html.erb (L9-L9)
2021-07-02 16:43:10 +02:00
Jarek Radosz
926889e2d4 FIX: Invalid link definition in bootstrap-json 2021-07-02 10:14:10 -04:00
Dan Ungureanu
3db4ed113b
FIX: Show empty search results sets (#13604)
If the server returned an empty result set, the client did not update
the local set and displayed last search results.
2021-07-02 11:00:31 +10:00
Andrei Prigorshnev
1c38b4abf1
FEATURE: pass supported file extensions to the system file picker (#13583) 2021-07-01 17:13:20 +04:00
Jarek Radosz
e4aa02365c
FIX: Set class on color scheme links in bootstrap (#13594)
Exposes to Ember CLI environment the feature provided in the production env by `lib/stylesheet/manager.rb:295`.

Fixes development env compatibility with discourse-color-scheme-toggle.
2021-07-01 10:58:26 +02:00