Commit Graph

49852 Commits

Author SHA1 Message Date
Ted Johansson 517c9e7782
DEV: Remove deprecated 'desc' parameter from group members endpoint (#22147) 2023-06-16 16:42:00 +08:00
Alan Guo Xiang Tan d60c90aef1
DEV: Change `have_section_link` match to use exact text match. (#22148)
Today I learnt that `has_link?("text of link")` by default does an
includes instead of looking for a link with the exact text. This is not
the behaviour I want so I'm changing
`PageObjects::Components::Sidebar.has_section_link?` to use the
`exact_text` option instead.
2023-06-16 16:36:34 +08:00
Martin Brennan 3802d0de9d
DEV: Further refine development reload for plugin files (#22141)
Followup f3afc8bf85 to better
exclude all spec files including PageObject files.
2023-06-16 16:15:15 +08:00
Ted Johansson d548231475
DEV: Remove old deprecation warnings where constants already removed (#22140)
We renamed these constants 3 years ago. This PR just removes the old deprecation notices.
2023-06-16 11:26:26 +08:00
Martin Brennan 9174716737
DEV: Remove Discourse.redis.delete_prefixed (#22103)
This method is a huge footgun in production, since it calls
the Redis KEYS command. From the Redis documentation at
https://redis.io/commands/keys/:

> Warning: consider KEYS as a command that should only be used in
production environments with extreme care. It may ruin performance when
it is executed against large databases. This command is intended for
debugging and special operations, such as changing your keyspace layout.
Don't use KEYS in your regular application code.

Since we were only using `delete_prefixed` in specs (now that we
removed the usage in production in 24ec06ff85)
we can remove this and instead rely on `use_redis_snapshotting` on the
particular tests that need this kind of clearing functionality.
2023-06-16 12:44:35 +10:00
Sérgio Saquetim e89c70643b
DEV: Add attributes identifying the setting on the user chat settings (#22139) 2023-06-15 23:32:17 -03:00
Martin Brennan d6374fdc53
FEATURE: Allow users to manually track threads without replying (#22100)
This commit adds a tracking dropdown to each individual thread, similar to topics,
that allows the user to change the notification level for a thread manually. Previously
the user had to reply to a thread to track it and see unread indicators.

Since the user can now manually track threads, the thread index has also been changed
to only show threads that the user is a member of, rather than threads that they had sent
messages in.

Unread indicators also respect the notification level -- Normal level thread tracking
will not show unread indicators in the UI when new messages are sent in the thread.
2023-06-16 12:08:26 +10:00
Alan Guo Xiang Tan 783bce4b2c
DEV: Don't render header on invites page (#22138)
What this change?

Previous solution relied on CSS to hide the header which is first
wasteful since we're still rendering the header and second makes it
untestable. If we don't want the header to show, we should avoid
rendering it in the first place.
2023-06-16 09:42:00 +08:00
Alan Guo Xiang Tan 9fad71809c
UX: Improve defaults shown for categories and tags section in sidebar (#22062)
Why is this change required?

When a site is newly setup and a user has just been created, the
categories and tags sections are hidden from the user. This happens
because the admin has not configured the `default_navigation_menu_categories` or
`default_navigation_menu_tags` site settings. When the categories and tags
sections are hidden from the user, the sidebar looks extremely bare and
does not create a good experience.

What is being change?

In this commit, we're changing the logic such that the site's top
categories and tags are displayed if the user does not have any
categories/tags configured in each respective section. The only
regression introduced in this change is that the categories and tags
section can no longer be hidden as a result. However, we have plans to
address this in the future by allowing sidebar sections to be configured
to be hidden by each individual user.
2023-06-16 09:06:01 +08:00
Joffrey JAFFEUX 7352ba1fe8
FIX: direct message channels can be flagged (#22134)
The events leading to this mistake are unclear but we decided few months ago to make direct messages NOT flaggable and even wrote a spec for this, when we actually support flagging of direct messages.

This commit ensures it will show for direct messages channels and inverses the existing spec.
2023-06-16 11:04:59 +10:00
dependabot[bot] d53e306681
Build(deps-dev): Bump ember-cli-app-version in /app/assets/javascripts (#22136)
Bumps [ember-cli-app-version](https://github.com/ember-cli/ember-cli-app-version) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/ember-cli/ember-cli-app-version/releases)
- [Changelog](https://github.com/ember-cli/ember-cli-app-version/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli-app-version/compare/v6.0.0...v6.0.1)

---
updated-dependencies:
- dependency-name: ember-cli-app-version
  dependency-type: direct:development
  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>
2023-06-16 01:38:49 +02:00
dependabot[bot] 3995b87667
Build(deps-dev): Bump ember-cli-dependency-checker (#22137)
Bumps [ember-cli-dependency-checker](https://github.com/quaertym/ember-cli-dependency-checker) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/quaertym/ember-cli-dependency-checker/releases)
- [Commits](https://github.com/quaertym/ember-cli-dependency-checker/commits)

---
updated-dependencies:
- dependency-name: ember-cli-dependency-checker
  dependency-type: direct:development
  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>
2023-06-16 01:38:34 +02:00
dependabot[bot] 4b35653854
Build(deps): Bump sass-embedded from 1.63.3 to 1.63.4 (#22135)
Bumps [sass-embedded](https://github.com/ntkme/sass-embedded-host-ruby) from 1.63.3 to 1.63.4.
- [Commits](https://github.com/ntkme/sass-embedded-host-ruby/compare/v1.63.3...v1.63.4)

---
updated-dependencies:
- dependency-name: sass-embedded
  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>
2023-06-16 01:38:10 +02:00
dependabot[bot] a5c69ee56a
Build(deps): Bump @ember/test-helpers in /app/assets/javascripts (#22133)
Bumps [@ember/test-helpers](https://github.com/emberjs/ember-test-helpers) from 2.9.3 to 2.9.4.
- [Release notes](https://github.com/emberjs/ember-test-helpers/releases)
- [Changelog](https://github.com/emberjs/ember-test-helpers/blob/v2.9.4/CHANGELOG.md)
- [Commits](https://github.com/emberjs/ember-test-helpers/compare/v2.9.3...v2.9.4)

---
updated-dependencies:
- dependency-name: "@ember/test-helpers"
  dependency-type: direct:production
  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>
2023-06-15 20:27:08 +02:00
Godfrey Chan 0fa92529ed
DEV: enable plain functions as helpers in Ember (#22023)
* Enable "plain function as helpers" polyfill

This feature landed in Ember 4.5+, but this polyfill would allow
it to work on 3.25+

References

RFC: https://github.com/emberjs/rfcs/pull/756
Update: https://github.com/emberjs/rfcs/pull/788
Guides: https://github.com/ember-learn/guides-source/pull/1924

* Convert truth-helpers to use plain functions

Mainly to test that the polyfill is working, but it's a good
refactor anyway.
2023-06-15 19:57:41 +02:00
Kris 7958f57174
UX: softer dropdown and menu panel shadows (#22114) 2023-06-15 10:52:51 -04:00
Sérgio Saquetim 4b22e67c8b
DEV: Added modifier to change mentions extracted from cooked text (#21654)
Added a new modifier hook to allow plugins to modify the @mentions
extracted from a cooked text.

Use case: Some plugins may change how the mentions are cooked to prevent
them from being confused with user or group mentions and display the user
card.

This modifier hook allows the plugin to filter the mentions detected or add new ways
to add mentions into cooked text.
2023-06-15 10:52:52 -03:00
dependabot[bot] 5bd09edc2d
Build(deps): Bump webpack in /app/assets/javascripts (#22121)
Bumps [webpack](https://github.com/webpack/webpack) from 5.86.0 to 5.87.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.86.0...v5.87.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:production
  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>
2023-06-15 15:40:08 +02:00
Meghna 7da307669f
UX: stack group inbox label horizontally (#22130) 2023-06-15 18:35:36 +05:30
Godfrey Chan fa509224f0
DEV: Migrate discourse core to Ember initializers (#22095)
https://meta.discourse.org/t/updating-our-initializer-naming-patterns/241919

For historical reasons, Discourse has different initializers conventions than standard Ember:

```
| Ember                 | Discourse          |                        |
| initializers          | pre-initializers   | runs once per app load |
| instance-initializers | (api-)initializers | runs once per app boot |
```

In addition, the arguments to the initialize function is different – Ember initializers get either the `Application` or `ApplicationInstance` as the only argument, but the "Discourse style" gets an extra container argument preceding that.

This is confusing, but it also causes problems with Ember addons, which expects the standard naming and argument conventions:

1. Typically, V1 addons will define their (app, instance) initializers in the `addon/(instance-)initializers/*`, which appears as `ember-some-addon-package-name/(instance-)initializers/*` in the require registry.

2. Just having those modules defined isn't supposed to do anything, so typically they also re-export them in `app/(instance-)initializers/*`, which gets merged into `discourse/(instance-)initializers/*` in the require registry.

3. The `ember-cli-load-initializers` package supplies a function called `loadInitializers`, which typically gets called in `app.js` to load the initializers according to the conventions above. Since we don't follow the same conventions, we can't use this function and instead have custom code in `app.js`, loosely based on official version but attempts to account for the different conventions.

The custom code that loads initializers is written with Discourse core and plug-ins/themes in mind, but does not take into account the fact that addons can also bring initializers, which causes the following problems:

* It does not check for the `discourse/` module prefix, so initializers in the `addon/` folders (point 1 above) get picked up as well. This means the initializer code is probably registered twice (once from the `addon/` folder, once from the `app/` re-export). This either causes a dev mode assertion (if they have the same name) or causes the code to run twice (if they have different names somehow).

* In modern Ember blueprints, it is customary to omit the `"name"` of the initializer since `ember-cli-load-initializers` can infer it from the module name. Our custom code does not do this and causes a dev mode assertion instead.

* It runs what then addon intends to be application initializers as instance initializers due to the naming difference. There is at least one known case of this where the `ember-export-application-global` application initialize is currently incorrectly registered as an instance initializer. (It happens to not use the `/addon` folder convention and explicitly names the initializer, so it does not trigger the previous error scenarios.)

* It runs the initializers with the wrong arguments. If all the addon initializer does is lookup stuff from the container, it happens to work, otherwise... ???

* It does not check for the `/instance-initializers/` module path so any instance initializers introduced by addons are silently ignored.

These issues were discovered when trying to install an addon that brings an application initializer in #22023.

To resolve these issues, this commit:

* Migrates Discourse core to use the standard Ember conventions – both in the naming and the arguments of the initialize function

* Updates the custom code for loading initializers:
  * For Discourse core, it essentially does the same thing as `ember-cli-load-initializers`
  * For plugins and themes, it preserves the existing Discourse conventions and semantics (to be revisited at a later time)

This ensures that going forward, Ember addons will function correctly.
2023-06-15 14:17:43 +02:00
Joffrey JAFFEUX 79a260a6bb
FIX: allows selection of messages in threads (#22119)
This commit fixes the selection of message in threads and also applies various refactorings
- improves specs and especially page objects/components
- makes the channel/thread panes responsible of the state
- adds an animationend modifier
- continues to follow the logic of "state" should be displayed as data attributes on component by having a new `data-selected` attribute on chat messages
2023-06-15 11:27:31 +02:00
Martin Brennan f3afc8bf85
DEV: Do not auto reload on plugin spec file changes (#22127)
There is no need to reload the rails server if plugin spec
files change, since they are not autoloaded but they are also
not loaded into the app.
2023-06-15 16:34:30 +10:00
Martin Brennan c819c96c31
FIX: Minor thread indicator issue (#22128)
* Set a line height for the last reply excerpt so the height
  does not jump when including an emoji
2023-06-15 16:05:06 +10:00
Sérgio Saquetim c10e3ac57b
DEV: Export dropdown in widgets/header to be used by plugins/TCs (#22126) 2023-06-15 01:05:47 -03:00
Alan Guo Xiang Tan 1bbb41a901
UX: Hide sidebar on invites page (#22125)
This hides the sidebar to make the signup experience less confusing.

Co-authored-by: Ella E <ella.estigoy@gmail.com>
2023-06-15 12:01:04 +08:00
Natalie Tay fcaefc9f2f
FIX: De-duplicate poll vote on user merge (#22107)
When merging users, polls may error out if the source and target users have both voted on the same poll before. 😢 

There is no constraint on the `poll_votes` table either to support this. Ideally a composite primary key can be used `(poll_id, user_id)`, but alas there is no support yet, which is probably why it wasn't created in the first place.

This fix ensures that merging is successful by only keeping the target poll votes if duplicates exist.

This fix also runs a migration on older poll votes where failed merges would have caused a single user to have voted twice on a single poll. e.g. this weird edge case
2023-06-15 11:18:51 +08:00
Joseph ec31eb4c7b
DEV: Fix broken link (#22112)
"SMTP and SEND API Settings" link under Mailjet.
2023-06-15 09:53:49 +08:00
Krzysztof Kotlarek 959c50001d
FIX: rename everything link to topics (#22076)
Rename everything link in community sidebar section to topics, which is
a bit more descriptive.
2023-06-15 11:36:38 +10:00
Martin Brennan f75ac9da30
FEATURE: Thread indicator improvements and participants (#21909)
This commit adds the initial part of thread indicator improvements:

* Show the reply count, last reply date and excerpt,
and the participants of the thread's avatars and
count of additional participants
* Add a participants component for the thread that
can be reused for the list
* Add a query class to get the thread participants
* Live update the thread indicator more consistently
with the last reply and participant details
image image

In subsequent PRs we will cache the participants since
they do not change often, and improve the thread list
further with participants.

This commit also adds a showPresence boolean (default
true) to ChatUserAvatar, since we don't want to show the
online indicator for thread participants.

---------

Co-authored-by: chapoi <charlie@discourse.org>
2023-06-15 10:49:27 +10:00
dependabot[bot] 897b6d86c7
Build(deps-dev): Bump better_errors from 2.10.0 to 2.10.1 (#22123)
Bumps [better_errors](https://github.com/BetterErrors/better_errors) from 2.10.0 to 2.10.1.
- [Release notes](https://github.com/BetterErrors/better_errors/releases)
- [Commits](https://github.com/BetterErrors/better_errors/compare/v2.10.0...v2.10.1)

---
updated-dependencies:
- dependency-name: better_errors
  dependency-type: direct:development
  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>
2023-06-15 08:34:56 +08:00
dependabot[bot] 68ff053956
Build(deps-dev): Bump sass from 1.63.3 to 1.63.4 in /app/assets/javascripts (#22122)
Bumps [sass](https://github.com/sass/dart-sass) from 1.63.3 to 1.63.4.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.63.3...1.63.4)

---
updated-dependencies:
- dependency-name: sass
  dependency-type: direct:development
  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>
2023-06-15 08:34:45 +08:00
dependabot[bot] 28cb3300bc
Build(deps): Bump racc from 1.7.0 to 1.7.1 (#22120)
Bumps [racc](https://github.com/tenderlove/racc) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/tenderlove/racc/releases)
- [Changelog](https://github.com/ruby/racc/blob/master/ChangeLog)
- [Commits](https://github.com/tenderlove/racc/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: racc
  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>
2023-06-15 08:34:03 +08:00
dependabot[bot] b11685f74b
Build(deps): Bump json_schemer from 1.0.2 to 1.0.3 (#22124)
Bumps [json_schemer](https://github.com/davishmcclurg/json_schemer) from 1.0.2 to 1.0.3.
- [Changelog](https://github.com/davishmcclurg/json_schemer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/davishmcclurg/json_schemer/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: json_schemer
  dependency-type: direct:production
  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>
2023-06-15 08:33:44 +08:00
Krzysztof Kotlarek 2effcaa0f9
FIX: Update sidebar to be navigation menu (#22101)
Communities can use sidebar or header dropdown, therefore navigation menu is a better name settings in 2 places:

- Old user sidebar preferences;
- Site setting about default tags and categories.
2023-06-15 09:31:28 +10:00
Blake Erickson be7d82d2b0
DEV: Clean up unused routes (#22118)
This cleans up our routes.rb file so that it only has routes that map to
existing controller actions.

Some routes were just old and their corresponding controller methods
were deleted without cleaning up the route for it. Other routes were
just accidentally created using the `resources` helper and never mapped
to actual controller methods.
2023-06-14 16:18:32 -06:00
Ella E 61cf221416
UX: Remove branded blobs background (#22115)
* UX: Remove branded blobs background

* Update app/assets/stylesheets/common/base/login.scss

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

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-06-14 13:21:08 -06:00
Keegan George 9dc63c0755
UX: Add required indicator to fields with `required` validation (#22096) 2023-06-14 11:25:05 -07:00
David Taylor 6084b331ed
Unsilence this-property-fallback (#21615) 2023-06-14 11:16:56 -07:00
Keegan George cd6183de93
DEV: Temporarily hide form when editing topic with template (#22099) 2023-06-14 11:16:39 -07:00
Juan David Martínez Cubillos 8b39125985
FEATURE: Implement max_tags_per_email_subject (#22050)
* FEATURE: Implement max_tags_per_email_subject

* made it so only max_tags_per_email_subject is responsible for tags in emails when the feature is enabled

* added locales for implemented siteSettings

* reworded locale for enable_max_tags_per_email_subject

* added min value for max_tags_per_email_subject

* Implemented suggested changes to spec description
2023-06-14 12:22:14 -05:00
Ella E b5d60da191
A11Y: Adjust contrast for the Dark and Solarized Dark tertiary color schemes (#22102) 2023-06-14 10:14:53 -06:00
Andrei Prigorshnev e5c705af8a
DEV: group tests related to mentions (#22017) 2023-06-14 19:34:38 +04:00
Selase Krakani 2652354da3
FIX: Moderator(non-admin staff user) group visibility scope queries (#22109)
Currently, groups owned by moderators are not visible to them on the
groups page. This happens because, the group visibility queries don't
account for non-admin staff user group ownership.

This change updates the group visibility scope queries to account for a
moderator(non-admin staff user) group ownership.
2023-06-14 15:25:45 +00:00
Roman Rizzi 1865eb1de3
FIX: Don't add the no-text class if translatedLabel is present (#22111) 2023-06-14 12:18:17 -03:00
Roman Rizzi 9e20fcb9c1
FIX: Correctly get the topic_id from the first post (#22110) 2023-06-14 11:52:27 -03:00
David Taylor a49b45dc14
FIX: Update workbox class references following version bump (#22108)
Followup to cc2f18121d
2023-06-14 14:39:04 +01:00
Joffrey JAFFEUX 5a035e2f5d
PERF: fixes multiple N+1 while loading threads (#22106) 2023-06-14 13:51:52 +02:00
Natalie Tay 3fe06bba9d
FIX: Allow half-merged user to be accessed in admin UI (#22105) 2023-06-14 19:19:12 +08:00
Ted Johansson a674c6c4c2
DEV: Update username in new quote format - Part 1 (#22032)
When we introduced the new quote format with full-name display name:

```
[quote="Ted Johansson, post:1, topic:2, username:ted"]
we overlooked the code responsible for rewriting quotes when a user's name is changed.
```

The functional part of this change adds support for the new quote format in the code that updates quotes when a user's username changes. See the test case in `spec/services/username_changer_spec.rb` for the details.

In addition, this change adds a regression test for PrettyText to cover the new quote format, and extracts the code responsible for rewriting raw and cooked quotes into its own `QuoteRewriter` class. The functionality of the latter is tested through the tests in `spec/services/username_changer_spec.rb`.
2023-06-14 16:14:11 +08:00
Martin Brennan cb87ef52de
FIX: Backfill chat thread memberships (#21971)
Since we created user_chat_thread_memberships in
cc2570f we haven't
yet backfilled it for users who previously sent a message in
in threads -- this migration creates the UserChatThreadMemberships
needed for those threads, making sure the last read message id
is accurate for those participants.
2023-06-14 13:54:51 +10:00