Commit Graph

44624 Commits

Author SHA1 Message Date
David Taylor d81359246a
DEV: Be more lenient in CLI confirmation (#16290)
If someone types `yes` rather than `YES`, continue anyway.

The chance of typing `yes`, when you actually want to stop, is non-existent. The chance of typing `yes` when you meant `YES` is  high, and it's very frustrating when the script quite because you got the case wrong!
2022-03-25 20:14:41 +00:00
Bianca Nenciu 6eb3d658ca
FIX: Do not wrap unaccent around tsqueries (#16284)
tsqueries use quotes and having other characters that when unaccented
become quotes results in invalid tsqueries.
2022-03-25 19:10:05 +02:00
Mark VanLandingham 96719cbf4f
DEV: Rename param passed to updateNotificationLevel (#16289) 2022-03-25 11:20:24 -05:00
Mark VanLandingham a3563336db
FIX: Bug setting notification level to muted/ignored on user page (#16268) 2022-03-25 10:51:45 -05:00
David Taylor f3aab19829
DEV: Promote historic post_deploy migrations (#16288)
This commit promotes all post_deploy migrations which existed in Discourse v2.7.13 (timestamp <= 20210328233843)

This reduces the likelihood of issues relating to migration run order

Also fixes a couple of typos in `script/promote_migrations`
2022-03-25 15:48:20 +00:00
Daniel Waterworth 9ce6280f51
DEV: Make tests more resilient (#16279)
Since we give a 200 response for login errors, we should be checking
whether the error key exists in each case or not.

Some tests were broken, because they weren't checking.
2022-03-25 10:44:12 -05:00
Roman Rizzi 136f7dbf78
DEV: Remove old link building code. (#16121)
We have a new API introduced [here](https://github.com/discourse/discourse/pull/14553).
2022-03-25 09:36:39 -03:00
Dan Ungureanu 76ece494f9
DEV: Fix "serialize to JSON safely" deprecation (#16280)
Job arguments must match after a serialize-deserialize cycle and
symbols were converted to strings during this process.
2022-03-25 09:07:21 +08:00
dependabot[bot] c5508a5790
Build(deps): Bump uniform_notifier from 1.15.0 to 1.16.0 (#16281)
Bumps [uniform_notifier](https://github.com/flyerhzm/uniform_notifier) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/flyerhzm/uniform_notifier/releases)
- [Changelog](https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/flyerhzm/uniform_notifier/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: uniform_notifier
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-24 23:26:49 +01:00
Andrei Prigorshnev 5423d46442
UX: cleaner messages for empty state on the user activity topics page (#16267) 2022-03-25 00:20:55 +04:00
Dan Ungureanu 03ad88f2c2
FIX: Add `errors` field if group update confirmation (#16260)
* FIX: Redirect if Discourse-Xhr-Redirect is present

`handleRedirect` was passed an wrong argument type (a string) instead of
a jqXHR object and missed the fields checked in condition, thus always
evaluating to `false`.

* FIX: Add `errors` field if group update confirmation

An explicit confirmation about the effect of the group update is
required if the default notification level changes. Previously, if the
confirmation was missing the API endpoint failed silently returning
a 200 response code and a `user_count` field. This change ensures that
a proper error code is returned (422), a descriptive error message and
the additional information in the `user_count` field.

This commit also refactors the API endpoint to use the
`Discourse-Xhr-Redirect` header to redirect the user if the group is
no longer visible.
2022-03-24 14:50:44 +02:00
OsamaSayegh 771dddb711 A11Y: Make the views column in topics lists tabbable 2022-03-24 13:42:24 +03:00
OsamaSayegh bc54b0055c A11Y: Improve topic entrance modal
Clicking the Replies cell of a topic in a topics list shows a little
modal with 2 buttons that take you to the first and last posts of the
topic. This modal is currently completely inaccessible to
keyboard/screen reader users because it can't be reached using the
keyboard.

This commit improves the modal so that it traps focus when it's shown
and makes it possible to close the modal using the esc key.
2022-03-24 13:42:24 +03:00
OsamaSayegh 0d4fad67db A11Y: Add `aria-label`s to topics list column headers
Topics lists like /latest are ordered by last activity date by default,
but the order can be changed (and reversed) to something else such as
replies count and views count by clicking on the corresponding column
header in the topics list. These column headers are tabbable, but screen
readers announce them as, using the replies column as example, `Replies
toggle button`. This doesn't communicate very well that this the button
changes the order, so this commit adds `aria-label`s to all column
headers to make it clear that they change order. The current copy for
the `aria-label` is `Sort by replies`.
2022-03-24 13:42:24 +03:00
OsamaSayegh 0d6bb64c0f A11Y: Add aria-label to the Replies cell in topics list
When tabbing through a topics list like /latest, /unread, /new etc. the
Replies column is announced as `<replies count> button` by screen
readers and it's not clear that number means the topic has that number
of replies. This commit adds an `aria-label` so the Replies column to
make it clear what that number means. The current copy of the
`aria-label` is "This topic has <replies count> replies".
2022-03-24 13:42:24 +03:00
Martin Brennan 9d5737fd28
SECURITY: Hide private categories in user activity export (#16273)
In some of the user's own activity export data,
we sometimes showed a secure category's name or
exposed the existence of a secure category.
2022-03-24 15:38:44 +10:00
Osama Sayegh 8dd6cb14ee
FIX: Don't attempt to focus .title in topic-list-item if it doesn't exist (#16274)
Follow-up to 97e7bb1ce4

Themes/plugins may override the default `topic-list-item` and remove the `.main-link` or `.title` elements from the template. We shouldn't attempt to focus them if they don't exist.
2022-03-24 08:33:17 +03:00
Martin Brennan 817035b557
DEV: Add useUploadPlaceholders to composer-upload-uppy (#16272)
This option is being added because some composer derivatives
like the chat composer use ComposerUploadUppy, but do not
need the placeholder text for uploads to be inserted/replaced.
This way those components can set useUploadPlaceholders to
false to avoid it.
2022-03-24 14:50:18 +10:00
Martin Brennan 1341baaeba
DEV: Use composerEventPrefix for paste in textarea-text-manipulation (#16262)
In the commit d678ba1103 we added
gif parsing support on paste, but we also slightly changed the
isComposer check there, along with a change in chat this caused
isComposer to be true (which is correct), however the event we fire
is composer:insert-text which the chat composer does not pick up.

Instead, we should use composerEventPrefix if it is present to
fire the insert-text event, and if it is not present (e.g. for
some custom composer that someone has implemented) fall back to
the default. There is a companion commit for chat to handle this
change there.
2022-03-24 09:49:56 +10:00
Penar Musaraj 99a6f32554
DEV: Add `registerCustomLastUnreadUrlCallback`to plugin API (#16222) 2022-03-23 13:34:17 -04:00
Joffrey JAFFEUX 4a39850aac
FIX: closing the picker shouldn't propagate the pointer event (#16266) 2022-03-23 16:42:53 +01:00
Bianca Nenciu cbaf7c949b
FIX: Make sure max_oneboxes_per_post is enforced (#16215)
PostAnalyzer and CookedPostProcessor both replace URLs with oneboxes.
PostAnalyzer did not use the max_oneboxes_per_post site and setting and
CookedPostProcessor replaced at most max_oneboxes_per_post URLs ignoring
the oneboxes that were replaced already by PostAnalyzer.
2022-03-23 17:36:08 +02:00
Penar Musaraj 147ffadcf3
DEV: Update Uppy to 2.1.6 (#16227) 2022-03-23 09:28:55 -04:00
Jarek Radosz 7fcf4dcd4b
FIX: Allow `@ember/test` import in embercli prod builds (#16264)
This matches the behavior of legacy discourse-loader and the regular Ember resolver.
2022-03-23 14:28:09 +01:00
Osama Sayegh 97e7bb1ce4
FIX: Don't listen for focus/blur events if the topic-list opts out of last visited focus (#16263)
Follow-up to eb237e634a.

Some `{{topic-list}}` instances, like the one for suggested topics, opt out of focusing the row of the last visited topic in the list, but we currently still add listeners for focus/blur events even if when the topic-list instance opts out. This commit adds a check so that we only register focus/blur listeners if the topic-list opts in for last visited topic focus.
2022-03-23 15:30:11 +03:00
Osama Sayegh eb237e634a
A11Y: Focus last viewed topic in topic lists (take 3) (#16257)
Another attempt at fixing https://meta.discourse.org/t/discourse-with-a-screen-reader/178105/88?u=osama. Previous PR (reverted): #16240.

The problems with the previous PR were:

1. As you scrolled down a topics list, the first topic of every new batch of topics would receive focus and the indicator would show up.
2. Similar to 1, clicking the `See X new or updated topics` notice would also focus a random topic from the new topics that were just loaded.
3. Topics in the suggested topics list received focus too
4. Our custom focus indicator appeared on mobile, but it shouldn't.

This commit should have none of these problems.
2022-03-23 13:03:56 +03:00
Martin Brennan 8040b95e8c
DEV: Re-add polymorphic bookmark columns (#16261)
This commit is a redo of2f1ddadff7dd47f824070c8a3f633f00a27aacde
which we reverted because it blew up an internal CI check. I looked
into it, and it happened because the old migration to add the bookmark
columns still existed, and those columns were dropped in a post migrate,
so the two migrations to add the columns were conflicting before
the post migrate was run.

------

This commit only includes the creation of the new columns and index,
and does not add any triggers, backfilling, or new data.

A backfill will be done in the final PR when we switch this over.
Intermediate PRs will look something like this:

Add an experimental site setting for using polymorphic bookmarks,
and make sure in the places where bookmarks are created or updated
we fill in the columns. This setting will be used in subsequent
PRs as well.
Listing and searching bookmarks based on polymorphic associations
Creating post and topic bookmarks using polymorphic associations,
and changing special for_topic logic to just rely on the Topic
bookmarkable_type
Querying bookmark reminders based on polymorphic associations
Make sure various other areas like importers, bookmark guardian,
and others all rely on the associations
Prepare plugins that rely on the Bookmark model to use polymorphic
associations
The final core PR will remove all the setting gates and switch over
to using the polymorphic associations, backfill the bookmarks
table columns, and ignore the old post_id and for_topic colummns.
Then it will just be a matter of dropping the old columns down the
line.
2022-03-23 12:43:08 +10:00
dependabot[bot] cd7ce52138
Build(deps): Bump concurrent-ruby from 1.1.9 to 1.1.10 (#16259)
Bumps [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby) from 1.1.9 to 1.1.10.
- [Release notes](https://github.com/ruby-concurrency/concurrent-ruby/releases)
- [Changelog](https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ruby-concurrency/concurrent-ruby/compare/v1.1.9...v1.1.10)

---
updated-dependencies:
- dependency-name: concurrent-ruby
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-23 00:31:48 +01:00
dependabot[bot] 38e4b1829b
Build(deps): Bump rubocop from 1.26.0 to 1.26.1 (#16258)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.26.0 to 1.26.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.26.0...v1.26.1)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-23 00:30:36 +01:00
Neil Lalonde 9bbddd2cb3
Version bump to v2.9.0.beta3 (#16256) 2022-03-22 14:46:23 -04:00
Dan Ungureanu 8e9cbe9db4
FIX: Do not raise if title cannot be crawled (#16247)
If the crawled page returned an error, `FinalDestination#safe_get`
yielded `nil` for `uri` and `chunk` arguments. Another problem is that
`get` did not handle the case when `safe_get` failed and did not return
the `location` and `set_cookie` headers.
2022-03-22 20:13:27 +02:00
Jarek Radosz 3f98af73ce
DEV: Add discourse-bcc to the official plugins (#16251) 2022-03-22 18:18:09 +01:00
Osama Sayegh 97519a3ea5
Revert "A11Y: Focus last viewed topic in topic lists (#16240)" (#16255)
This reverts commit 5d77f485cb.

There are some edge cases that we need to handle better. Reverting this
commit because we're going to do a beta release later today.
2022-03-22 20:09:12 +03:00
David Taylor 9df28fe4b3
DEV: Only raise `rake themes:update` errors when flag provided (#16254)
Switching behavior based on multisite/single-site configuration can create some difficult-to-debug situations. The flag is much more obvious.
2022-03-22 17:02:14 +00:00
Mark VanLandingham f0e87aa35f
DEV: appEvent to close user card (#16253) 2022-03-22 12:00:44 -05:00
Osama Sayegh 5d77f485cb
A11Y: Focus last viewed topic in topic lists (#16240)
Meta topic: https://meta.discourse.org/t/discourse-with-a-screen-reader/178105/88?u=osama

This is another attempt to fix the same problem that https://github.com/discourse/discourse/pull/15300 was meant to fix, but it had to be reverted because the `focus()` call caused the topic title to have an outline on certain browsers. This commit does mostly the same thing as the previous one, but the difference is that the native focus indicator outline is replaced with a custom indicator that only appear on the left side of the topic rather than all sides. See https://github.com/discourse/discourse/pull/16240#issuecomment-1075212093 for screenshots.
2022-03-22 19:26:38 +03:00
David Taylor daacb3b038 FIX: Ensure all/none subcategory filters work correctly with tags
This is done by defining a `/all` route for use when a category's default filter is 'none'. This was defined for regular category routes in 3e7f7fdd, but not for tag routes.

This commit also corrects the route name TagsShowNoneCategory*Route -> TagsShowCategoryNone*Route, which fixes an error when setting subcategories=none while filtering by tags.
2022-03-22 15:26:00 +00:00
David Taylor 80dd769530 FIX: Issue 404 for invalid `/tags/c/...` routes
Previously we would issue a 403 for all invalid routes under `/tags/c/...`, which is not semantically correct. In some cases, these 403'd routes would then be handled successfully in the Ember app, leading to some very confusing behavior.
2022-03-22 15:26:00 +00:00
Discourse Translator Bot b8a98708d8
Update translations (#16250) 2022-03-22 16:01:16 +01:00
David Taylor 6acd2c58a9
DEV: Drop padStart and padEnd polyfills (#16249)
These methods have been natively supported in all our target browsers for many years. We're now feature-detecting `String.prototype.replaceAll`, which is a much more recent addition. If a browser has `replaceAll`, it'll have `padStart` and `padEnd`
2022-03-22 11:46:13 +00:00
David Taylor cf6deb439a
FIX: Add replaceAll to browser-detect (#16248)
We're using replaceAll in a few places. If it's not supported, we should fall back to the basic-html view.
2022-03-22 11:45:03 +00:00
Alan Guo Xiang Tan 4e6f7a1a6e
Revert "DEV: Re-add polymorphic bookmark columns (#16245)" (#16246)
This reverts commit 2f1ddadff7.
2022-03-22 13:13:42 +08:00
Martin Brennan 2f1ddadff7
DEV: Re-add polymorphic bookmark columns (#16245)
This commit is a redo of e21c640a3c
which we reverted to not include half-done work in a release.

This commit is slightly different though, in that it only includes
the creation of the new columns and index, and does not add any
triggers, backfilling, or new data.

A backfill will be done in the final PR when we switch this over.
Intermediate PRs will look something like this:

1. Add an experimental site setting for using polymorphic bookmarks,
   and make sure in the places where bookmarks are created or updated
   we fill in the columns. This setting will be used in subsequent
   PRs as well.
2. Listing and searching bookmarks based on polymorphic associations
3. Creating post and topic bookmarks using polymorphic associations,
   and changing special for_topic logic to just rely on the Topic
   bookmarkable_type
4. Querying bookmark reminders based on polymorphic associations
5. Make sure various other areas like importers, bookmark guardian,
   and others all rely on the associations
6. Prepare plugins that rely on the Bookmark model to use polymorphic
   associations

The final core PR will remove all the setting gates and switch over
to using the polymorphic associations, backfill the bookmarks
table columns, and ignore the old post_id and for_topic colummns.
Then it will just be a matter of dropping the old columns down the
line.
2022-03-22 14:26:13 +10:00
Jarek Radosz be3dceccfa
DEV: Merge two spec files (#16244)
Also reenabled two specs on macOS as they're green now.
2022-03-22 09:23:06 +08:00
Vinoth Kannan 8a9a7a77d8
FIX: staff should not be able to PM groups that "Nobody" can message (#16163)
If a group's messageable_level is set to nobody then staff can't should not be able to send PMs to it.

Co-authored-by: Martin Brennan <martin@discourse.org>
2022-03-22 10:23:14 +10:00
dependabot[bot] 31bc756037
Build(deps): Bump uniform_notifier from 1.14.2 to 1.15.0 (#16241)
Bumps [uniform_notifier](https://github.com/flyerhzm/uniform_notifier) from 1.14.2 to 1.15.0.
- [Release notes](https://github.com/flyerhzm/uniform_notifier/releases)
- [Changelog](https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/flyerhzm/uniform_notifier/compare/v1.14.2...v1.15.0)

---
updated-dependencies:
- dependency-name: uniform_notifier
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-21 22:37:17 +01:00
dependabot[bot] 5599f0c93e
Build(deps): Bump parallel from 1.21.0 to 1.22.0 (#16242)
Bumps [parallel](https://github.com/grosser/parallel) from 1.21.0 to 1.22.0.
- [Release notes](https://github.com/grosser/parallel/releases)
- [Commits](https://github.com/grosser/parallel/compare/v1.21.0...v1.22.0)

---
updated-dependencies:
- dependency-name: parallel
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-21 22:37:08 +01:00
Robin Ward d025405130
FIX: When using Ember CLI, plugin admin code was not being loaded in tests (#16239) 2022-03-21 15:46:41 -04:00
Roman Rizzi 581d435d09
Revert "FEATURE: Let reviewables override the score type title. (#16234)" (#16238)
This reverts commit 746f8f3797.
2022-03-21 16:32:47 -03:00
Roman Rizzi 746f8f3797
FEATURE: Let reviewables override the score type title. (#16234)
Plugins like chat add custom score type to override the title in the UI, but that should be reserved for situations when you need to manage the flag priority separately, which is configurable in the queue settings page.

Currently, if a plugin creates a custom score type, it won't be able to associate a priority, so there's no real gain from doing so. Priorities are tightly related to post-action types, which is something we might want to revise. For now, this change lets plugins move away from custom score types without compromises.
2022-03-21 14:29:57 -03:00