Commit Graph

25179 Commits

Author SHA1 Message Date
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 04db58fbd8
UX: Translate the action type in watched words regex error (#13680)
Previously we were using the untranslated key from the code
2021-07-09 14:34:08 +01: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
Bianca Nenciu 43d4859d30
FIX: Let user clear their flair group (#13669)
Users were able to select their flair, but were not able to clear it
by selecting (none).
2021-07-09 12:41:26 +08: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
Martin Brennan 9f275c12ab
FIX: Handle storage providers not implementing ACLs (#13675)
When secure media is enabled or when upload secure status
is updated, we also try and update the upload ACL. However
if the object storage provider does not implement this we
get an Aws::S3::Errors::NotImplemented error. This PR handles
this error so the update_secure_status method does not error
out and still returns whether the secure status changed.
2021-07-09 11:31:44 +10:00
Kane York ec537e5ea2 FIX: Do not interpret backreferences in email content
This changes from providing a string literal for the #sub replacement, to providing a block.
Because the block is provided the match object, it is presumed to have already performed all necessary backreferences.
This avoids any replacement of backreferences in the message body.
2021-07-08 15:56:09 -07: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
Martin Brennan c6f2459cc4
FIX: Do not prevent other topic timers running on error (#13665)
There was an issue with the TopicTimerEnqueuer where any timer
that failed to enqueue_typed_job with an error would prevent
all other pending timers after the one that errored from running.

To mitigate this we just capture the error and log it (so we can
still fix it if needed for bug crushing) and proceed with the
rest of the timer enqueues.

The commit https://github.com/discourse/discourse/pull/13544 highlighted
this issue originally in hosted sites.

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2021-07-08 12:49:58 +10:00
Mark VanLandingham 14a13dc192
FIX: Check type of existing reviewables when new reviewable is created (#13662) 2021-07-07 11:45:00 -05:00
Dan Ungureanu 9969631cef
FEATURE: Make invites work with existing users (#13532)
* FEATURE: Redirect logged in user to invite topic

Users who were already logged in and were given an invite link to a
topic used to see an error message saying that they already have an
account and cannot redeem the invite. This commit amends that behavior
and redirects the user directly to the topic, if they can see it.

* FEATURE: Add logged in user to invite groups

Users who were already logged in and were given an invite link to a
group used to see an error message saying that they already have an
account and cannot redeem the invite. This commit amends that behavior
and adds the user to the group.
2021-07-07 19:42:42 +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
David Taylor f999ef2d52
DEV: Drop user_options.disable_jump_reply column (#13646)
24ef4f7b removed the use of this column in 2019
2021-07-06 10:47:17 +01:00
David Taylor 4b55b59931 DEV: Update core model annotations
Generated using `bin/rake annotate:clean`
2021-07-06 10:11:06 +01:00
Martin Brennan b3d3ad250b
FIX: Handle SMTPServerBusy for group smtp email (#13632)
Use the `sidekiq_retry_in` code from Jobs::UserEmail in group SMTP. Also we don't need to keep `seconds_to_delay` -- sidekiq uses the default delay calculation if you return 0 or nil from the block. See 3330df0ee3/lib/sidekiq/job_retry.rb (L216-L234) for sidekiq default retry delay logic.

I experimented with extracting this into a concern or a module, but `sidekiq_retry_in` is quite magic and it would not allow me to abstract away into a module that calls some method specificall in the child job class.

I would love to write tests for this, but it does not seem possible (not sure if its because of our test
setup) to write tests that test sidekiq's retry capability, and I am not sure if we should be anyway. Initial addition
to UserEmail did not test this functionality 
d224966a0e
2021-07-06 13:37:52 +10: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
Martin Brennan 0f688f45bd
FIX: Handle edge cases for group SMTP email job (#13631)
Skip group SMTP email (and add log) if:

* topic is deleted
* post is deleted
* smtp has been disabled for the group

Skip without log if:

* enable_smtp site setting is false
* disable_emails site setting is yes

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2021-07-05 14:56:32 +10:00
Alan Guo Xiang Tan f26acb4b63
DEV: Remove `User` class methods that have been deprecated. (#13612) 2021-07-05 10:44:53 +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
Martin Brennan 100c3d6d62
FIX: Respect personal_email_time_window_seconds in group SMTP (#13630)
For other private messages we have the site setting
personal_email_time_window_seconds (default 20s) which allows
people to edit their post etc. before the email is sent.

This PR makes the Jobs::GroupSmtpEmail enqueuer in the
PostAlerter use the same delay.

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2021-07-05 10:09:16 +10: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
Roman Rizzi 0da2197219
DEV: Pass the cookie jar to the :after_auth event (#13591)
Plugins can add custom cookies by hooking to this event. The auth result is also included in this event so they can know if auth was successful.
2021-07-01 09:44:58 -03: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
Martin Brennan eb898e5523
FIX: Reorder and hide topic timer options (#13597)
This PR changes the order of the topic timer options
into a more logical order when the topic is open/closed.

Also, we are now hiding the "Schedule Publishing" option
if the topic is not a private message or in a private category.
It does not make sense to schedule publishing to a different
category for a public topic.
2021-07-01 13:18:38 +10:00
Alan Guo Xiang Tan b42e9e5c86
DEV: Remove broken associations on `Invite` model. (#13600)
No relevant foreign keys exists on the invites table for the
associations to even work.
2021-07-01 10:50:16 +08:00
Martin Brennan d2e867ae09
DEV: Try fix keyboard shortcut acceptance tests (#13576)
Page was not scrolled to top so buttons were not in
viewport, so they were being hidden.
2021-07-01 12:25:26 +10:00
Rafael dos Santos Silva fae68455b7
FIX: Detect decode failures earlier in image optimization pipeline (#13595)
* FIX: Detect decode failures earlier in image optimization pipeline

Follow up to 9b51b9b but also detects the bug earlier and backs off.

What iOS 15 is doing is returning all zeroes to `ctx.getImageData`,
so we don't have to wait until resize to detect the problem.

* Update app/assets/javascripts/discourse/app/lib/media-optimization-utils.js

Co-authored-by: Jarek Radosz <jradosz@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2021-06-30 19:03:34 -03:00
jbrw 4728962f7d
FIX: Don’t translate TrustLevel name when generating links (#13588)
We want to put the name of the trust level in to generated URLs, not the human-readable form.

i.e.:

`/admin/users/list/newuser`

rather than:

`/admin/users/list/new user`
2021-06-30 14:19:15 -04:00
Roman Rizzi 6209b11659
UX: Make emoji size consistent for oneboxed GH issues with short tags. (#13586) 2021-06-30 12:38:50 -03:00
Dan Ungureanu 6ba28cbed7
FIX: Reintroduce add group user by email (#13581)
This feature was removed when the modal for adding and inviting members
was split in two modals.
2021-06-30 17:59:22 +03:00
Andrei Prigorshnev 11baf872ed
FIX: do not close the merged topic if the first post wasn't merged (#13564)
When a topic is fully merged into another topic we close it and schedule it for deleting. But last time I changed this place I added a bug – when merging all posts in topic except the first one the topic was closing too.

If the OP is not merged into another topic, the original topic shouldn't be closed and marked for deletion. This PR fixes this.
2021-06-30 18:28:18 +04:00
Penar Musaraj 128fdf9d9c
DEV: Revert stylesheet refactors (#13584)
* Revert "FIX: Clear appropriate cache when updating font settings (#13582)"

This reverts commit de6cc7a924.

* Revert "DEV: Improve output of `Stylesheet::Mananger.precompile_theme_css`."

This reverts commit 95038856c9.

* Revert "FIX: Child themes being precompiled multiple times."

This reverts commit 6986b36985.

* Revert "Update spec/components/stylesheet/manager_spec.rb"

This reverts commit ddaa7cc7ea.

* Revert "Refactor scss live refreshing"

This reverts commit a838293aaf.

* Revert "Precompile core stylesheets independently of themes"

This reverts commit 99d259d39b.

* Revert "DEV: Add simple digest for core stylesheets"

This reverts commit d82c58e6cc.
2021-06-30 21:33:15 +08:00
Dan Ungureanu 16227e38ac
FIX: Do not redirect to a topic user cannot see (#13550)
Inviting a user to a private topic used to redirect them to a 404 page
immediately after sign up.
2021-06-30 12:00:47 +03:00
Andrei Prigorshnev a2e0da16a7
FEATURE: use native file picker in composer (#13552)
We want to remove completely our custom modal for uploading files in composer and directly trigger the system file picker.

This PR makes it happen. The fix is pretty simple since we already weren't using our custom modal on mobile. We just need to start using the same hidden <input type="file"> that we already use on mobile.

It seems to be pretty tricky to test opening a system modal so I haven't added new tests. We already have other tests for file uploading though. We directly trigger jquery-File-Upload plugin hooks in those tests - 3dda926cb2/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js (L89).
2021-06-30 12:45:47 +04:00
Krzysztof Kotlarek 5c43f9a3a3
FIX: problem when [] custom field is send (#13573)
Multiselect data can be saved but when all are removed then data are not cleared

Ajax function is removing an empty array from request data. In that case, we should change `[]` to `null`.

We need that empty values to properly empty data.
2021-06-30 16:18:37 +10:00
Arpit Jalan 1ea2880276
FEATURE: add staff action logs for watched words (#13574) 2021-06-30 11:22:46 +05:30
Penar Musaraj a838293aaf Refactor scss live refreshing 2021-06-30 13:42:40 +08:00
Bianca Nenciu e123476329
FIX: Always render topic counts (#13563)
A post is rendered multiple times when it is being loaded. Sometimes,
not all information is available and the best link in the Onebox cannot
be found.
2021-06-30 15:30:16 +10:00
Alan Guo Xiang Tan 9a7adcd178 FIX: Use absolute URL when redirecting SVG sprite path.
This ensures that CDN URLs with relative paths do not end up losing the
relative paths.
2021-06-30 11:25:05 +08:00
Joffrey JAFFEUX 33464cb07e
FIX: ensures we don't apply charts options to other modes (#13570)
This reverts commit 1f74ea0f08.
2021-06-29 21:58:35 +02:00
Mark VanLandingham 4b27de8c4b
FIX: Include user_field_ids in pagination URL for directory items (#13569) 2021-06-29 14:43:38 -05:00
Robin Ward 1f74ea0f08 FIX: Some admin reports (notably backups) were not showing up 2021-06-29 15:14:16 -04:00
Mark VanLandingham e870c09438
FIX: Do not call 'set' in destroyed directory table component (#13567) 2021-06-29 13:59:32 -05:00
Jarek Radosz aa56e2a758
DEV: Don't use the Ember global (#13535) 2021-06-29 19:54:18 +02:00
Mark VanLandingham 717908f426
FIX: Get all groups for user directory dropdown (#13566) 2021-06-29 11:03:27 -05:00
Krzysztof Kotlarek a69839689d
FEATURE: add multiselect user custom field (#13560)
New user custom field similar to dropdown but allowing users to select multiple options.
2021-06-29 16:29:25 +10:00
Jarek Radosz 5af0636d83
DEV: Fix a leaky test (#13559)
The error was:

```
↪ Unit | Model | topic::recover [✔]
↪ Unit | Utility | emoji::emojiUnescape [✔]
↪ Unit | Utility | pretty-text::quoting a quote [✔]
↪ Unit | Utility | click-track::routes to internal urlsUnhandled request in test environment: /forum/t/1234/recover (PUT)
Error: Unhandled request in test environment: /forum/t/1234/recover (PUT)
    at Pretender.server.unhandledRequest (discourse/tests/setup-tests:173:15)
    at Pretender.handleRequest (pretender:400:14)
    at FakeRequest.send (pretender:169:21)
    at Object.send (jquery:10100:10)
    at Function.ajax (jquery:9683:15)
    at performAjax (discourse/app/lib/ajax:174:19)
    at eval (discourse/app/lib/ajax:183:11)
    at invokeCallback (ember:63104:17)
    at publish (ember:63087:9)
    at eval (ember:57463:16)
 [✘]
```

* DEV: Don't duplicate a function
2021-06-29 10:40:29 +10:00
Martin Brennan d098f51ad3
DEV: Drop duration column from topic timers (#13543)
The duration column has been ignored since the commit
4af77f1e38
for topic_timers, we use duration_minutes instead.

Also removing the duration key from Topic.set_or_create_timer. The only
plugin to use this was discourse-solved, which doesn't use it any
longer
since
c722b94a97
2021-06-29 09:27:12 +10:00
Martin Brennan 03338f9086
FIX: Remove legacy topic timer code (#13544)
The new topic timer backend code introduced six months ago
in 0034cbd is now used instead of this legacy code. It can be safely removed
now.
2021-06-29 09:16:25 +10:00
Jarek Radosz 6afba42985
UX: Tweak spacing in the admin dashboard (#13557)
Even margins, indented `li > ul`, no extra space inside parens `( sha )`.
2021-06-28 23:35:31 +02:00
Rafael dos Santos Silva d860e2717b
UX: Adds 'Processing Upload' to the composer status area during upload optimization (#13556) 2021-06-28 18:22:22 -03:00
Rafael dos Santos Silva 99da221034
FIX: Handle image decoding failure in composer image optimization (#13555)
There are some hard limits in browser Canvas implementations, that will
throw a runtime exception when crossed. Since those limits are platform
dependent, the best we can do is catch it and back off from trying to
optimize a problematic file.

For example, a 60MB PNG can be processed fine by Chrome but Firefox will
fail trying to extract the ImageData from the CanvasRenderingContext2D
with NS_ERROR_FAILURE.

Also cleans up the media-optimization-utils and add post-resize size logs
2021-06-28 18:21:39 -03:00
Mark VanLandingham d03aee4642
UX: Horizontal scroll bar on top of user directory (when needed) (#13553) 2021-06-28 15:10:38 -05:00
Jarek Radosz 04baca593b
UX: Tweak the timestamp line in Twitter onebox (#13551)
Fixed alignment and made the color less intrusive to make the actual content pop out more.
2021-06-28 15:04:33 +02:00
Dan Ungureanu d015907668
FIX: Remove extra margin from share topic modal (#13549)
The styling between the "Create Invite" and "Share Topic" modals is
shared. The margin that was used to organize inputs in a list is not
needed for the "Share Topic" modal.
2021-06-28 15:52:44 +03:00
Arpit Jalan 3dda926cb2
FIX: only delete the word/phrase when the 'x' icon is clicked (#13547) 2021-06-28 15:14:18 +05:30
Andrei Prigorshnev 6be4699954
FIX: topic level bookmark button (#13530)
We changed (https://github.com/discourse/discourse/pull/13407) behaviour of the topic level bookmark button recently. That PR made the button be opening the edit bookmark modal when there is only one bookmark on the topic instead of just removing that bookmark as it was before.

This PR fixes the next problems that weren't taken into account in the previous PR:

1. Everything should work fine even on very big topics when a bookmarked post is unloaded from the post stream. I've added code that loads the post we need and makes everything work as expected
2. When at least one bookmark on the topic has a reminder, we should always be showing the icon with a clock on the topic level bookmark button
3. We should show correct tooltips for the topic level bookmark button
2021-06-28 12:24:23 +04:00
Martin Brennan a6b9289477
DEV: Remove old group form code (#13542)
We don't use this group form anymore
since
964da21817
when we revamped the UI
2021-06-28 14:57:51 +10:00
Martin Brennan 4d0178deab
FIX: Do not show In Reply To for group SMTP emails (#13541)
We do not want to show the In Reply To section of the
group SMTP email template, it is similar to Context Posts
which we removed and is unnecessary.

This PR also removes the link to staged user profiles in
the email; their email addresses will just be converted
to regular mailto: links.
2021-06-28 13:19:17 +10:00
Alan Guo Xiang Tan fd8016d678 DEV: Remove unused attributes from topic-tracking-state. 2021-06-28 11:02:49 +08:00
Alan Guo Xiang Tan ff1c53dd6f FIX: Missing category edit icon.
Follow-up to 0e4b8c5318
2021-06-28 10:54:23 +08:00
Martin Brennan d3e27cabf6
FIX: Improve participant display in group SMTP emails (#13539)
This PR makes several changes to the group SMTP email contents to make it look more like a support inbox message.

* Remove the context posts, they only add clutter to the email and replies
* Display email addresses of staged users instead of odd generated usernames
* Add a "please reply above this line" message to sent emails
2021-06-28 10:42:06 +10:00
Martin Brennan 87684f7c5e
FEATURE: Use group SMTP job and mailer instead of UserNotifications change (#13489)
This PR backtracks a fair bit on this one https://github.com/discourse/discourse/pull/13220/files.

Instead of sending the group SMTP email for each user via `UserNotifications`, we are changing to send only one email with the existing `Jobs::GroupSmtpEmail` job and `GroupSmtpMailer`. We are changing this job and mailer along with `PostAlerter` to make the first topic allowed user the `to_address` for the email and any other `topic_allowed_users` to be the CC address on the email. This is to cut down on emails sent via SMTP, which is subject to daily limits from providers such as Gmail. We log these details in the `EmailLog` table now.

In addition to this, we have changed `PostAlerter` to no longer rely on incoming email email addresses for sending the `GroupSmtpEmail` job. This was unreliable as a user's email could have changed in the meantime. Also it was a little overcomplicated to use the incoming email records -- it is far simpler to reason about to just use topic allowed users.

This also adds a fix to include cc_addresses in the EmailLog.addressed_to_user scope.
2021-06-28 08:55:13 +10:00
Roman Rizzi fa4e5e8dad
FEATURE: Render emojis on GitHub labels when oneboxing an issue. (#13531) 2021-06-25 14:48:36 -03:00
Jarek Radosz 61472d6aaa
DEV: Rename `hilight` to `highlight` (#13526) 2021-06-25 18:05:50 +02:00
Jarek Radosz b4f0a0fb94
FIX: Nil-filled CF arrays were not being deleted (#13518) 2021-06-25 11:34:51 +02:00
Bianca Nenciu 8ab6fd88ef
UX: Add notice when watched words are regexes (#13493)
There is a big difference between regular watched words and regular
expressions and this has been confusing in the past. This notice adds
an explanation.

This commit also reorganizes the code of the test modal.
2021-06-25 12:08:52 +03:00
awesomerobot 895df9c239 UX: margin improvement for mobile alerts 2021-06-25 09:18:06 +08:00
Penar Musaraj cb9e004121
UX: Make bulk select checkbox easier to target (#13517)
Adds a label element around the checkbox, so that user can more easily
hit the element. Quite useful when checking many items in topic list.
2021-06-24 11:46:26 -04:00
Mark VanLandingham 180c0c4dc3
FIX: Translation of plugin directory column on mobile (#13516) 2021-06-24 10:11:24 -05:00
Robin Ward a2b744ae25 DEV: Allow plugin tests to run in Ember CLI qunit 2021-06-24 10:13:35 -04:00
Roman Rizzi 2c918a3161
FEATURE: Staff can receive pending user reminders more frequently. (#13422)
* FEATURE: Staff can receive pending user reminders more frequently.

We now express the "pending_users_reminder_delay"  in minutes instead of hours so staff can have finer control over the delay.

We need to keep in mind that the reminders could still take up to 20 minutes, even when using a lower value. We send them from a scheduled job.

* Migrate to a new site setting for the reminders delay
2021-06-24 10:02:56 -03:00
Andrei Prigorshnev cf1e8b2764
FEATURE: Accept the flag modal on CTRL + ENTER and CMD + ENTER (#13497)
We want to submit the flag modal on pressing CTRL + ENTER and CMD + ENTER.

Here's how our modals work:

Every modal can be dismissed by pressing ESC. This behaviour can be disabled for a specific modal if we need to.
Every modal can be submitted by pressing ENTER if the cursor wasn't on a text area or a form at the moment of pressing.
Now, the flag modal is actually a one big form and pressing ENTER doesn't submit it. I've added submitting by CTRL+ENTER but at first it was interfering with the basic modal submitting by ENTER. It's a pretty tricky thing to fix because we use the keyup event for submitting by ENTER and we need to use the keydown event for submitting with modifiers (because submitting by CMD+ENTER on Macs doesn't work with keyup).

Eventually, I fixed the problem just by adding a possibility to disable default submitting on ENTER (in the same way as we already have the possibility of disabling dismissing on ESC). Then I disabled default submitting for the flag form and implemented submitting by CTRL+ENTER and CMD+ENTER. This way everything is simple and robust. I did it only for the flag modal but it'll be easy and safe to add the same behaviour to another modal.
2021-06-24 14:13:38 +04:00
Joffrey JAFFEUX 2654a6685c
DEV: adds support for bannered until (#13417)
ATM it only implements server side of it, as my need is for automation purposes. However it should probably be added in the UI too as it's unexpected to have pinned_until and no bannered_until.
2021-06-24 11:35:36 +02:00
Alan Guo Xiang Tan 0e4b8c5318 PERF: Cache categories in Site model take 3.
Previous attempt resulted in custom fields going missing in the
serialized output.

This reverts commit 83a6ad32ff.
2021-06-24 13:30:51 +08:00
Jarek Radosz 046a875222
DEV: Improve `script/downsize_uploads.rb` (#13508)
* Only shrink images that are used in Posts and no other models
* Don't save the upload if the size is the same
2021-06-24 00:09:40 +02:00
Mark VanLandingham 60a76737dc
FIX: Always serialize the correct attributes for DirectoryItems (#13510) 2021-06-23 14:55:17 -05:00
Kris 1702922a7c
UX: Fix mobile alert spacing (#13506) 2021-06-23 15:21:17 -04:00
Kris 958340b632
UX: Make it easier to hide the emoji on signup (#13509) 2021-06-23 15:20:54 -04:00
Mark VanLandingham 7c94efd6c9
FIX: Table header translations on admin users list (#13505) 2021-06-23 13:19:30 -05:00
Jordan Vidrine 385535f421
UX: Hide email columns when `Hide Emails` is selected (#13502)
* UX: Scroll user list container when emails are present
2021-06-23 12:42:16 -05:00
Mark VanLandingham a9175b7705
FIX: Manually update DirectoryItemSerializer attributes on directory column change (#13503) 2021-06-23 12:16:00 -05:00
Joe 7e5ad9aaaa
UX: improve lightbox gallery zoom/navigation (#13500)
This PR improves navigation within lightboxes that contain multiple images for both touch and non-touch devices.

Currently, if a gallery contains multiple large images, and you click on the one currently displayed, two things happen. 

1. we zoom in
2. we navigate to the next image

a0bbc346cb/app/assets/javascripts/discourse/app/lib/lightbox.js (L43-L49)

So, you get taken to the next image, and it shows zoomed in, even when the intention was to zoom in on the previous image.

Magnific popup has an option to disable image-click navigation in galleries. This PR toggles that on for non-touch devices.

The result is that if you click on an image in a gallery on a non-touch device, we zoom in on that image instead of navigating to the next one.

This has no impact on arrow/keyboard navigation.

Magnific popup also has an API when images change; we reset the zoom class when that happens. So, when you navigate to the next image, it won't be zoomed in.

For touch devices, clicking on the image will navigate to the next one without zooming in. Users can pinch-zoom if they want to see more details on touch devices.

I used jQuery for this because both Magnific popup and our implementation for this are based on jQuery. No point making a few lines use vanilla for this when the rest doesn't.
2021-06-24 00:32:17 +08:00
Mark VanLandingham 6e1fa7b082
PERF: Remove n+1 in user directory (#13501) 2021-06-23 10:45:18 -05:00
Rafael dos Santos Silva fa4a462517
FEATURE: Optimize images before upload (#13432)
Integrates [mozJPEG](https://github.com/mozilla/mozjpeg) and [Resize](https://github.com/PistonDevelopers/resize) using WebAssembly to optimize user uploads in the composer on the client-side.

NPM libraries are sourced from our [Squoosh fork](https://github.com/discourse/squoosh/tree/discourse), which was needed because we have an older asset pipeline.
2021-06-23 12:31:12 -03:00
Mark VanLandingham 18de11f3a6
FIX: Load more users URL respect group param (#13485) 2021-06-23 10:21:53 -05:00
Penar Musaraj cfc60f41f0
DEV: Rename emoji icon (#13499) 2021-06-23 11:12:48 -04:00
Dan Ungureanu 2c2e81486c
FEATURE: Split Add Members into Add Users & Invite (#13482)
Add Members could also invite new users via emails, but that was a less
known fact. Splitting the previous modal into two more accessible
modals should make this feature more discoverable.
2021-06-23 17:31:25 +03:00
Bianca Nenciu a22aa7562a
FIX: Make favorite work with multiple grant badges (#13492)
Badges that are awarded multiple times can be favorite and not favorite
at the same time. This caused few problems when users tried to favorite
them as they were counted multiple times or their state was incorrectly
displayed.
2021-06-23 14:41:23 +03:00
Martin Brennan 30c7a9b06d
DEV: Fix failing directory-columns ember CLI tests (#13490)
Since #13488 the ember cli CI tests are failing.
2021-06-23 13:26:37 +10:00
Penar Musaraj c8f4f7c235
FIX: Ignore missing uploads in theme settings (#13486)
In some rare cases, this could prevent the site from bootstrapping,
because theme settings are invoked early in the application.
2021-06-22 22:34:22 -04:00
Mark VanLandingham 75afd50cea
FIX: Absolute path for directory-columns.json (#13488) 2021-06-22 19:28:58 -05:00
Mark VanLandingham 7fc3d7bdde
DEV: Plugin API to add directory columns (#13440) 2021-06-22 13:00:04 -05:00
Jarek Radosz fe5923da06
DEV: Do not re-throw in popupAjaxError (#13462)
Effectively reverts 3ddc33b07c

Makes the failure states testable; see the uncommented test.

I don't think we're re-catching these errors anyway?

_update:_
We did in a single instance in discourse-code-review but it wasn't really intentional and I fixed it in https://github.com/discourse/discourse-code-review/pull/73
2021-06-22 19:29:20 +02:00
Bianca Nenciu ee87d8c93b
FEATURE: Make max number of favorite configurable (#13480)
It used to be hardcoded to 2 and now it uses max_favorite_badges site
setting. When zero, it disables favorite badges.
2021-06-22 18:58:03 +03:00
Penar Musaraj 4a4cceca4d
DEV: Remove leftover reference to intersection-observer (#13478)
Followup to f343cfd, should fix the build.
2021-06-22 10:04:33 -04:00
Penar Musaraj f343cfd92e
DEV: Remove IntersectionObserver polyfill (#13445) 2021-06-22 09:30:44 -04:00
Joffrey JAFFEUX 1a6759a5d9
FIX: ensures average is applied on last incomplete segment (#13472) 2021-06-22 12:26:52 +02:00
Gerhard Schlager fa470cf6fe
Fix i18n issues reported on Crowdin (#13191)
* Pluralize `js.topics.bulk.dismiss_new_with_selected`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-fr#57320

* Pluralize `js.topics.bulk.dismiss_read_with_selected`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-fr#57316

* Pluralize `js.topics.bulk.dismiss_button_with_selected`

* Replaces concatenated string used by `js.topic.suggest_create_topic`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-fr#41834

* Less confusing `admin_js.admin.watched_words.test.modal_title`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-sv#44992

* Delete unused `backup.location.*` keys
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-fr#46330

* Replace "reviewable" with "reviewable items"
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-fr#56952

* Remove "ago" from `emails.incoming.missing_attachment`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-sv#46038

* Remove "/Posts" from `js.keyboard_shortcuts_help.application.dismiss_new_posts`
  Because the shortcut doesn't do anything to posts anymore.
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/246/en-de#43180

* Pluralize `user.cannot_delete_has_posts`
  This fixes https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/248/en-he#57490
2021-06-22 11:29:35 +02:00
Jarek Radosz b78ab82284 DEV: Fix a flaky/leaky test
* pretender wasn't catching the request because it ran after this test finished
* restore wasn't needed, we do `sinon.restore()` after each test

The error was:
```
↪ Unit | Model | user::resolvedTimezone [✔]
↪ Unit | Utility | url::routeTo with prefixUnhandled request in test environment: /forum/u/chuck.json (PUT)
Error: Unhandled request in test environment: /forum/u/chuck.json (PUT)
    at Pretender.server.unhandledRequest (discourse/tests/setup-tests:173:15)
    at Pretender.handleRequest (pretender:400:14)
    at FakeRequest.send (pretender:169:21)
    at Object.send (jquery:10100:10)
    at Function.ajax (jquery:9683:15)
    at performAjax (discourse/app/lib/ajax:174:19)
    at eval (discourse/app/lib/ajax:183:11)
    at invokeCallback (ember:63104:17)
    at publish (ember:63087:9)
    at eval (ember:57463:16)
 [✘]
```

A minimal reproduction:
`http://localhost:3001/qunit?seed=3&testId=da76996b&testId=e52a53e7`
2021-06-22 09:49:09 +08:00
Martin Brennan 1fdef0dc5b
FIX: Remove duplicate add_unsubscribe_link hash key (#13467)
This double key was introduced in
f0c10edd28
2021-06-22 11:25:39 +10:00
Martin Brennan f9a1d2bb81
DEV: Try fix flaky dismiss keyboard specs (#13452)
Also add extra logging for test failures
2021-06-22 09:21:50 +10:00
Martin Brennan 5222247746
FEATURE: Add more columns to outbound EmailLog (#13449)
This adds the following columns to EmailLog:

* cc_addresses
* cc_user_ids
* topic_id
* raw

This is to bring the EmailLog table closer in parity to
IncomingEmail so it can be better utilized for Group SMTP
and IMAP mailing.

The raw column contains the full content of the outbound email,
but _only_ if the new hidden site setting
enable_raw_outbound_email_logging is enabled. Most sites do not
need it, and it's mostly required for IMAP and SMTP sending.

In the next pull request, there will be a migration to backfill
topic_id on the EmailLog table, at which point we can remove the
topic fallback method on EmailLog.
2021-06-22 08:32:01 +10:00
Jarek Radosz c3e4389b81
DEV: Add missing import, de-jQuerify (#13461) 2021-06-22 08:09:49 +10:00
Kane York 83a6ad32ff Revert "PERF: Cache categories in Site model take 2."
This reverts commit 06fa1efd3d.

Breakage in solved plugin
2021-06-21 12:25:04 -07:00
Kane York c72bf1d732 FEATURE: Improvement to history stack handling on server errors
The exception page is shown before Ember can actually figure out what the final destination URL we're going to is.
This means that the new page is not present in the history stack, so if we attempt to use the history stack to go back, we will actually navigate back by two steps.
By instead forcing a navigation to the current URL, we achieve the goal of going "back" with no history mucking.

Unfortunately, the actual URL that was attempted is not available. Additionally, this only works for the on-screen back button and not the browser back.

Additionally, several modernizations of the exception page code were made.
2021-06-21 11:09:23 -07:00
Kane York f25c55b5be FIX: Render detailed_404 page from 403 responses
This was previously broken by 59ef48c0b9 (#11425, #11424).

Centralize the logic into the exception controller, which avoids the problematic bug and makes it easy to add additional detailed 404 pages in the future.
2021-06-21 11:09:23 -07:00
Bianca Nenciu d1b2e9db3b
PERF: Update post uploads secure status in a job (#13459)
When secure uploads are enabled, editing a post with many uploads can
cause a timeout because the store has to be contacted for each upload.
2021-06-21 19:15:24 +03:00
Bianca Nenciu 15aa213a61
FIX: Show link count only once for oneboxes (#13444)
Sometimes oneboxes contain the same link multiple times and the link
count was shown for each of them. This commit adds link count only to
the most important link, that being either a heading or the header of
the onebox.
2021-06-21 19:14:57 +03:00
Joffrey JAFFEUX 8c213fa98b
FIX: correctly implements average for reports (#13447)
- Also now marks time_to_first_response as an averaged chart
- Averaged charts will now be marked as such in the UI
2021-06-21 10:35:11 +02:00
Alan Guo Xiang Tan 44aa46ca05 Code review comments. 2021-06-21 11:06:58 +08:00
Alan Guo Xiang Tan 8e3691d537 PERF: Eager load Theme associations in Stylesheet Manager.
Before this change, calling `StyleSheet::Manager.stylesheet_details`
for the first time resulted in multiple queries to the database. This is
because the code was modelled in a way where each `Theme` was loaded
from the database one at a time.

This PR restructures the code such that it allows us to load all the
theme records in a single query. It also allows us to eager load the
required associations upfront. In order to achieve this, I removed the
support of loading multiple themes per request. It was initially added
to support user selectable theme components but the feature was never
completed and abandoned because it wasn't a feature that we thought was
worth building.
2021-06-21 11:06:58 +08:00
Alan Guo Xiang Tan 06fa1efd3d PERF: Cache categories in Site model take 2.
Follow-up to aa4f0aee67.

Fixed the security problem in the previous attempt.
2021-06-21 09:47:05 +08:00
Martin Brennan f0c10edd28
FIX: Remove List-Unsubscribe header if using group SMTP (#13448)
The other mailing list headers were removed if using
group SMTP in ff6114d83f
2021-06-21 09:33:32 +10:00
Penar Musaraj 497aae062a
UX: Fix jump-to-post layout on mobile (#13443) 2021-06-18 16:37:17 -04:00
Penar Musaraj fcc02412c0
UX: Fix mobile progress bar button alignment (#13442) 2021-06-18 15:23:57 -04:00
Joffrey JAFFEUX 6b3adeed0f
UX: daily automatic grouping for less than 34 days instead of 30 (#13437) 2021-06-18 19:54:16 +02:00
Bianca Nenciu 1e992d9193
FIX: Do not check for duplicate links in Onebox (#13345)
If a user posted a URL that appeared inside a Onebox, then the user
got a duplicate link notice. This was fixed by skipping those links in
Ruby.

If a user posted a URL that was Oneboxes and contained other links that
appeared in previous posts, then the user got a duplicate link notice.
This was fixed by skipping those links in JavaScript.
2021-06-18 18:55:24 +03:00
Bianca Nenciu 74f7295631
FIX: Add word boundaries to replace and tag watched words (#13405)
The generated regular expressions did not contain \b which matched
every text that contained the word, even if it was only a substring of
a word.

For example, if "art" was a watched word a post containing word
"artist" matched.
2021-06-18 18:54:06 +03:00
Roman Rizzi 4afd8f9bdf
FEATURE: An API key scope for editing posts. (#13441) 2021-06-18 12:53:10 -03:00
Penar Musaraj 5b17902263
UX: Use button instead of anchor in filtered replies bar (#13439) 2021-06-18 10:40:56 -04:00
Bianca Nenciu 09b55fd338
FIX: Update post's raw from server response (#13438)
This fix is similar to ea2833d0d8, but
this time raw text is updated after the post is created.
2021-06-18 16:26:57 +03:00
Penar Musaraj e305365168
FEATURE: Use responsive image sizes in post stream (#13343) 2021-06-18 09:15:03 -04:00
Penar Musaraj e9e2827636
FIX: Mobile layout for watched words admin UI (#13427) 2021-06-18 08:57:13 -04:00
Joffrey JAFFEUX c9bd4b4c64
FIX: ensures validValues is an array (#13435)
Before this fix the setting object would have exceptions on 3 fields: computedNameProperty, computedValueProperty and validValues

```
TypeError: Cannot read property 'forEach' of undefined
    at Class.validValues (http://localhost:4200/assets/admin.js:10468:19)
    at Class.<anonymous> (http://localhost:4200/assets/vendor.js:82492:19)
    at http://localhost:4200/assets/vendor.js:28633:34
    at untrack (http://localhost:4200/assets/vendor.js:26641:7)
    at ComputedProperty.get (http://localhost:4200/assets/vendor.js:28632:13)
    at Class.CPGETTER_FUNCTION [as validValues] (http://localhost:4200/assets/vendor.js:26259:25)
    at Class.r (<anonymous>:1:83)
```
2021-06-18 14:02:21 +02:00
Joffrey JAFFEUX d88f792eb1
DEV: removes maximum limit on tag list site setting (#13436) 2021-06-18 12:53:30 +02:00
Joffrey JAFFEUX cbd01a0cca
REFACTOR: removes unused code (#13412)
This has been fully useless since this fix https://github.com/discourse/discourse/pull/12865

The removed test is not actually real life behavior, category should be on a topic type not a fruit.
2021-06-18 11:55:49 +02:00
Martin Brennan 7f916ad06d
FIX: Dismiss new keyboard shortcut not working (#13430)
The dismiss new keyboard shortcut (x,r) has been broken since
7a79bd7da3. A fix was done and JS
tests were added in 006d52f32b
and b01e4738ab but the test was not
quite correct and so the bottom dismiss new button was not clicked.

This also fixes an issue with our keyboard shortcut click handling.
If multiple elements matched the selector they were all clicked. Now
we just click the first match.
2021-06-18 13:56:23 +10:00
Kane York faca5c09fd
FIX: Use correct property for jump-up embedded post link (#13425)
Fixup for 77d33ebe21 #13320 which added the customShare property but did not update all uses
2021-06-17 13:17:56 -07:00