Commit Graph

49620 Commits

Author SHA1 Message Date
Meghna
ccf18b5e44
DEV: add class for static login description section (#22002) 2023-06-08 19:51:41 +05:30
Andrei Prigorshnev
c0d3cded73
DEV: refactor calls to message.cook when sending messages (#21934)
When editing a message, we call `message.cook()` in the beginning of 
`#sendEditMessage` methods, but when sending a new message, 
the call to `message.cook()` is hidden in the `stageMessage` method.

We can just call `message.cook()` before sending the message, no matter 
whether this is a new message or an edited message.
2023-06-08 18:21:22 +04:00
Joffrey JAFFEUX
9cbbcdef50
FIX: prevents lightbox to close chat on escape (#22003)
No test as this is very much a hack while lightbox is being revamped. We currently have no good/easy way AFAIK to stop event propagation on escape in magnificpopup.
2023-06-08 15:32:35 +02:00
Joffrey JAFFEUX
32dd43e02c
REVERT: makes touchstart passive (#22004)
This is causing issues with scroll, I need to find a different issue for the event propagating as a click.
2023-06-08 15:31:49 +02:00
Joffrey JAFFEUX
57877fd6db
FIX: on iOS PWA prevents touch to click (#22000)
This behavior has been possible for a long time and has been made more in recent commits. On PWA iOS when release the touch after the mobile actions menu has been shown, if the finger was over one of the buttons of the menu, it would trigger a click.

This commit should now correctly trap and cancel events.
2023-06-08 14:38:08 +02:00
Joffrey JAFFEUX
65d61b87c1
FIX: prevents back history loop (#22001)
The following case would create the perception of a broken back button on desktop:

- open discourse on home page
- click chat button in header
- hit back button
- observes that we are still on the channel didn't navigate to homepage as we would have expected

The back button is actually working but it's in a loop. We were doing a `transitionTo` after finding the ideal channel to show, so the browser history would look something like this:

- home
- chat index
- channel page

When hitting back, we would go to chat index which would run the same logic and transition us to channel page.

This change will use `replaceWith` to replace the chat index step by the channel step, this way our history will now look like this:

- home
- channel page

Hitting back will now correctly bring us to home.
2023-06-08 14:35:29 +02:00
Joffrey JAFFEUX
6513ca69da
UX: improves chat message long press and touch (#21984)
This commit attempts to refactor our long press logic to make it more resilient and precise.

With this improvement two very UX/UI changes have been made:
- scale animation on long press
- prevents click on reaction to propagate to the message which would cause the active state of the message to trigger
2023-06-08 08:21:32 +02:00
Martin Brennan
482ef0782d
FIX: Do not allow blank chat messages (#21968)
This fixes an issue where a user could send an empty
string as a chat message .e.g '   ' and the message would
be posted. We don't want this, we need to strip the message
first before validating for length etc.
2023-06-08 16:06:09 +10:00
Alan Guo Xiang Tan
853bce2abc
UX: Allow users to filter categories in edit sidebar categories modal (#21996)
What does this change do?

This change is a continuation of
2191b879c6 and adds an input filter to the
edit sidebar categories modal which the user can use to filter through
the list of categories by the category's name.

Note that if a child category is being shown, all of its ancestors will
be shown even if the names of the ancestors do not match the given
filter. This is to ensure that we continue to display the hierarchy of a
child category even if the parent category does not match the filter.
2023-06-08 12:54:51 +08:00
Martin Brennan
e48750281e
FIX: Pasting files into chat was not working (#21995)
Followup to e6c6c342d9,
we missed one part of this refactor which was to give
the correct composer element reference to ChatComposerUploads.
Without this the pasteEventListener for uploads was not
bound so uploading via paste did not work.

I tried to test this, and though I can write binary/text to
the clipboard and paste it into the composer, it does not
seem to be possible to end up with a paste event that
has clipboardData.files filled in, which is what is used
for the uploads. I think this is a restriction of JS
generally, and there doesn't seem to be a way to work around
it, so unfortunately we have to have no test for this still.
2023-06-08 13:03:55 +10:00
Alan Guo Xiang Tan
2191b879c6
FEATURE: Support sub-subcategories in new edit sidebar categories modal (#21994)
Why does this commit do?

This commit adds support for sub-subcategories in the new edit sidebar
categories modal added in fc296b9a81. Note
that sub-subcategories are enabled when `max_category_nesting` is set to
`3`.
2023-06-08 10:15:01 +08:00
Joffrey JAFFEUX
699f3e7014
FIX: correctly set value on textarea interactor (#21990)
This would mostly work without it by mutation but could cause subtle bugs.
2023-06-08 01:21:30 +02:00
dependabot[bot]
f9bd32af2d
Build(deps): Bump faraday from 2.7.5 to 2.7.6 (#21986)
Bumps [faraday](https://github.com/lostisland/faraday) from 2.7.5 to 2.7.6.
- [Release notes](https://github.com/lostisland/faraday/releases)
- [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lostisland/faraday/compare/v2.7.5...v2.7.6)

---
updated-dependencies:
- dependency-name: faraday
  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-08 07:10:15 +08:00
Juan David Martínez Cubillos
5fdd3bd28a
DEV: Implement staff logs for user columns edits (#21774)
* DEV: Implement staff logs for user columns edits

* deleted extra space in staff logger detail string, deleted string when no changes are made, added basic test coverage for EditDirectoryColumnsController

* fixed change made to #self.staff_actions un UserHistory

* implemented a method that builds the details, previous_values and new_values in a dynamic way

* removed details of changes

* refactored small merge
2023-06-07 17:19:58 -05:00
Bianca Nenciu
10ee92656c
FIX: Send TL2 promotion message to correct user (#21978)
Usually, when a user is promoted to TL2 two messages are sent. The
first one is a system message 'tl2_promotion_message' which triggers a
'system_message_sent' Discourse event.

When the event is fired and if Discourse Narrative Bot is enabled, then
a second message is sent to the recipient of the first message. The
recipients was determined by looking at the list of users that can
access that topic and pick the last one. This method does not work if
'site_contact_group_name' site setting is set because it adds the group
in the list of recipients.

A solution to this problem would have been to select the last user in
the list of 'topic_allowed_users', but an even better solution is to
pass the name of the recipients when the 'system_message_sent'
Discourse event is fired.
2023-06-07 22:51:24 +03:00
Jordan Vidrine
928589adfd
CSS: Move table editor button to right (#21976) 2023-06-07 14:50:34 -05:00
Joffrey JAFFEUX
e6c6c342d9
REFACTOR: composer/thread (#21910)
This commit contains multiple changes to improve the composer behavior especially in the context of a thread:

- Generally rename anything of the form `chatChannelThread...` to `chatThread...``
- Moves the textarea interactor instance inside the composer server
- Improves the focus state and closing of panel related to the use of the Escape shortcut
- Creates `Chat::ThreadList` as a component instead of having `Chat::Thread::ListItem` and others which could imply they were children of a the `Chat::Thread` component
2023-06-07 21:49:15 +02:00
Bianca Nenciu
5fc1586abf
PERF: Cache ToS and Privacy Policy paths (#21860)
Checking if the topic exists happened often and that can cause
performance issues.
2023-06-07 21:31:20 +03:00
Penar Musaraj
987ec602ec
FEATURE: image grid in posts (experimental) (#21513)
Adds a new `[grid]` tag that can arrange images (or other media) into a grid in posts. 

The grid defaults to a 3-column with a few exceptions:

- if there are only 2 or 4 items, it defaults to a 2-column grid (because it generally looks better)
- on mobile, it defaults to a 2-column grid
- if there is only one item, the grid has no effect
2023-06-07 14:15:57 -04:00
Kris
e43ac00bf4
FIX: add category colors back to categories pages (#21977) 2023-06-07 12:57:10 -04:00
Bianca Nenciu
96c6e535a6
FIX: Add removed image that may still be used (#21957)
This image is no longer referenced but existing forums may still
reference it in their welcome topics.
2023-06-07 18:49:44 +03:00
Joffrey JAFFEUX
821e9cb649
PERF: avoids eager pluck in posts controller (#21973)
Calling pluck is instantly making a SELECT, while passing the relationship allows rails to build a correct query.

Before (2 selects):

```
pry(main)> Post.where(topic_id: Topic.where(id: [1,3,4]).pluck(:id)).count
   (1.3ms)  SELECT "topics"."id" FROM "topics" WHERE "topics"."deleted_at" IS NULL AND "topics"."id" IN (1, 3, 4)
  Post Count (0.5ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."deleted_at" IS NULL AND "posts"."topic_id" IN (1, 3, 4)
```

After (1 select):

```
pry(main)> Post.where(topic_id: Topic.where(id: [1,3,4])).count
  Post Count (2.7ms)  SELECT COUNT(*) FROM "posts" WHERE "posts"."deleted_at" IS NULL AND "posts"."topic_id" IN (SELECT "topics"."id" FROM "topics" WHERE "topics"."deleted_at" IS NULL AND "topics"."id" IN (1, 3, 4))
```
2023-06-07 13:30:38 +02:00
Joffrey JAFFEUX
11d7270e36
PERF: prevents eager pluck in post alerter (#21972)
Before (4 selects):

```
  Topic Load (1.8ms)  SELECT "topics"."id", "topics"."title", "topics"."last_posted_at", "topics"."created_at", "topics"."updated_at", "topics"."views", "topics"."posts_count", "topics"."user_id", "topics"."last_post_user_id", "topics"."reply_count", "topics"."featured_user1_id", "topics"."featured_user2_id", "topics"."featured_user3_id", "topics"."deleted_at", "topics"."highest_post_number", "topics"."like_count", "topics"."incoming_link_count", "topics"."category_id", "topics"."visible", "topics"."moderator_posts_count", "topics"."closed", "topics"."archived", "topics"."bumped_at", "topics"."has_summary", "topics"."archetype", "topics"."featured_user4_id", "topics"."notify_moderators_count", "topics"."spam_count", "topics"."pinned_at", "topics"."score", "topics"."percent_rank", "topics"."subtype", "topics"."slug", "topics"."deleted_by_id", "topics"."participant_count", "topics"."word_count", "topics"."excerpt", "topics"."pinned_globally", "topics"."pinned_until", "topics"."fancy_title", "topics"."highest_staff_post_number", "topics"."featured_link", "topics"."reviewable_score", "topics"."image_upload_id", "topics"."slow_mode_seconds", "topics"."bannered_until", "topics"."external_id" FROM "topics" WHERE "topics"."deleted_at" IS NULL ORDER BY "topics"."id" DESC LIMIT 1
  User Load (1.2ms)  SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
   (0.6ms)  SELECT "groups"."id" FROM "groups" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = 1
   (0.4ms)  SELECT "topic_allowed_groups"."group_id" FROM "topic_allowed_groups" WHERE "topic_allowed_groups"."topic_id" = 7 AND "topic_allowed_groups"."group_id" IN (1, 3, 10, 11) LIMIT 1
```

After (3 selects):

```
  Topic Load (1.3ms)  SELECT "topics"."id", "topics"."title", "topics"."last_posted_at", "topics"."created_at", "topics"."updated_at", "topics"."views", "topics"."posts_count", "topics"."user_id", "topics"."last_post_user_id", "topics"."reply_count", "topics"."featured_user1_id", "topics"."featured_user2_id", "topics"."featured_user3_id", "topics"."deleted_at", "topics"."highest_post_number", "topics"."like_count", "topics"."incoming_link_count", "topics"."category_id", "topics"."visible", "topics"."moderator_posts_count", "topics"."closed", "topics"."archived", "topics"."bumped_at", "topics"."has_summary", "topics"."archetype", "topics"."featured_user4_id", "topics"."notify_moderators_count", "topics"."spam_count", "topics"."pinned_at", "topics"."score", "topics"."percent_rank", "topics"."subtype", "topics"."slug", "topics"."deleted_by_id", "topics"."participant_count", "topics"."word_count", "topics"."excerpt", "topics"."pinned_globally", "topics"."pinned_until", "topics"."fancy_title", "topics"."highest_staff_post_number", "topics"."featured_link", "topics"."reviewable_score", "topics"."image_upload_id", "topics"."slow_mode_seconds", "topics"."bannered_until", "topics"."external_id" FROM "topics" WHERE "topics"."deleted_at" IS NULL ORDER BY "topics"."id" DESC LIMIT 1
  User Load (0.5ms)  SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
   (0.8ms)  SELECT "topic_allowed_groups"."group_id" FROM "topic_allowed_groups" WHERE "topic_allowed_groups"."topic_id" = 7 AND "topic_allowed_groups"."group_id" IN (SELECT "groups"."id" FROM "groups" INNER JOIN "group_users" ON "groups"."id" = "group_users"."group_id" WHERE "group_users"."user_id" = 1) LIMIT 1
```
2023-06-07 12:46:48 +02:00
David Taylor
fab506149a
DEV: Convert modal wrapper from named outlet to component (#21970)
This removes the modal container named-outlet/controller/template and replaces it with a component. Named outlets will be removed in Ember 4.x, so this change is part of that upgrade project.

Smaller changes include:
- update some of the computed values to be getters rather than calculated during `show()`.
- update tests which were previously depending on the modal class persisting after the modal was closed

Much of the logic in the service will be deprecated once we introduce component-based modals.

This work is split out from https://github.com/discourse/discourse/pull/21304

Previously merged in 80b77b2e and then reverted due to issues with the PM invite modal. This PR fixes the issue, and introduces a test which would have caught the issue.
2023-06-07 10:41:29 +01:00
Joffrey JAFFEUX
330137e7e4
FIX: Non-Interfering Backdrop Clicks (#21916)
Previously, there was an issue where closing the message actions menu on mobile would unintentionally trigger a click event on an element below it, such as a thread indicator or a reaction. With the recent fix, this problem has been resolved. Now, when you close the menu, it will no longer interfere with or activate any elements positioned underneath it.
2023-06-07 11:40:43 +02:00
dependabot[bot]
ab1bb0cfa0
Build(deps): Bump excon from 0.99.0 to 0.100.0 (#21962)
Bumps [excon](https://github.com/excon/excon) from 0.99.0 to 0.100.0.
- [Changelog](https://github.com/excon/excon/blob/master/changelog.txt)
- [Commits](https://github.com/excon/excon/compare/v0.99.0...v0.100.0)

---
updated-dependencies:
- dependency-name: excon
  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-07 10:55:21 +02:00
dependabot[bot]
e59ae0fb2e
Build(deps): Bump html-entities in /app/assets/javascripts (#21961)
Bumps [html-entities](https://github.com/mdevils/html-entities) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/mdevils/html-entities/releases)
- [Changelog](https://github.com/mdevils/html-entities/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mdevils/html-entities/commits)

---
updated-dependencies:
- dependency-name: html-entities
  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-07 10:54:20 +02:00
chapoi
86facadec1
FIX: apply chat header icon indicator style to urgent only (#21967)
* FIX: apply chat header icon indicator style to urgent only

* UX: smaller padding
2023-06-07 06:42:51 +02:00
Alan Guo Xiang Tan
9a18c8032a
UX: Don't block render of user messages secondary nav for tracking state (#21965)
Why is this change required?

Right now, we're awaiting on the promise returned by
`this.pmTopicTrackingState.startTracking()` which blocks the rendering
of the template until the promise resolves. However, this blocking of
the rendering ends up introducing yet another intermediate loading state
in the UI which we find unsightly. Instead of blocking the rendering, we
allow the promise to resolve in the background and display the
new/unread counts when the promise resolves.
2023-06-07 12:37:05 +08:00
Alan Guo Xiang Tan
fc296b9a81
UX: First pass at edit categories navigation modal for sidebar (#21963)
What this change?

We are currently not fully satisfied with the current way to edit the
categories and tags that appears in the sidebar where the user is
redirected to the tracking preferences tab in the user's profile causing
the user to lose context of the current page. In addition, the dropdown
to select categories or tags limits the amount of information we can
display.

Since editing or adding a custom categories section is already using a
modal, we have decided to switch editing the categories and tags that
appear in the sidebar to use a modal as well.

This commit ships a first pass of the edit categories modal such that we
can keep the commit small and reviewable. The incomplete nature of the
feature is also reflected in the fact that the feature is hidden behind
a new `new_edit_sidebar_categories_tags_interface_groups` site setting.
2023-06-07 12:09:30 +08:00
Alan Guo Xiang Tan
213d9dbe41
Revert "DEV: Convert modal wrapper from named outlet to component (#21932)" (#21964)
This reverts commit 80b77b2e65.

Some modal functionality has been broken like inviting an existing user
to a PM
2023-06-07 10:33:03 +08:00
chapoi
9809103ed9
UX: fix number cutoff in header chat indicator (#21946)
In the chat header indicator, expand to a pill when the number reaches
N digits, and also display 99+ if the number is over 99.
2023-06-07 11:42:08 +10:00
Alan Guo Xiang Tan
41f8bff2c3
DEV: Remove superfluous js: true metadata (#21960)
Why this change?

It is very unlikely that we need to ever JS for system tests considering
that we rely on a JS framework on the frontend.
2023-06-07 09:26:58 +08:00
Martin Brennan
44446afe58
FEATURE: Use new hashtag autocomplete system on all sites (#21788)
Followup to:

* 7c97548159
* 0b3cf83e3c
* eae47d82e2

This commit enables the no-longer-experimental hashtag autocomplete changes
for all sites. It is now at a point where it is ready to be promoted
to the only way, and following this commit all old hashtag code
will be deleted

c.f. https://meta.discourse.org/t/hashtags-are-getting-a-makeover/248866
2023-06-07 11:11:39 +10:00
Martin Brennan
69eecf92d0
FIX: Use a default hashtag icon color for user with no permission (#21825)
One user can create a post or chat message with a hashtag they
have permission to use, but then when other users look at that
post they will see an empty space next to the hashtag because they
do not have the permission to load the colors in CSS classes for
the related category.

This fixes the issue by adding a default color with a special
CSS class if the user doesn't have permission to see the linked
channel/category on the hashtag.
2023-06-07 10:15:39 +10:00
Krzysztof Kotlarek
af74cf5c77
FEATURE: new dismiss button for combined new and unread view (#21817)
Display modal for combined new and unread view with options:
- [x] Dismiss new topics
- [x] Dismiss new posts
- [ ] Stop tracking these topics so they stop appearing in my new list
2023-06-07 10:06:57 +10:00
Vinoth Kannan
899969fd5d
FIX: toggle topic pinning for user only if thumbtack icon is pressed. (#21917)
Previously, the topic is pinned/unpinned even when the bookmark icon is pressed in the topic list page. Because we didn't check the class names of topic status icons.
2023-06-07 03:53:39 +05:30
Alan Guo Xiang Tan
f682071ed0
PERF: Avoid rendering a component that isn't required most of the time (#21942)
What is this change required?

The `enable_offline_indicator` site setting is disabled by default so
there is no need for us to be rendering an extra Ember component when
the site setting is not enabled.
2023-06-07 06:23:19 +08:00
Alan Guo Xiang Tan
1cbc65ba79
DEV: Refactor GroupNotificationsButton into userPrivateMessages.group route (#21930)
Why this change?

Before this change, the `GroupNotificationsButton` is rendered in the
template of `userPrivateMessages` route based on a conditional that
checks if the `isGroup` property is true. However, the `isGroup`
property is determined based on the child route that is rendered.
However, this leads to "jankiness" in the UI because the
`GroupNotificationsButton` will be rendered once the route is entered
even if the model for the child route has not been resolved yet.

What is the solution?

In order to avoid this, we move the rendering of the
`GroupNotificationsButton` into the template of the
`userPrivateMessages.group` route and rely on the `in-element` helper to
render it into the right spot in the template of the
`userPrivateMessages` route.
2023-06-07 06:22:50 +08:00
Joshua Rosenfeld
81645a3082
UX: Improve /print rate limit description (#21959)
Previous copy was unclear if setting the site setting to 0 would disable the feature or disable the rate limit.
2023-06-06 16:57:37 -04:00
Bianca Nenciu
8e8f733c94
UX: Remove title and description block if blank (#21861)
If the description is empty then it does not make sense to keep the
quote block that contains just the title.
2023-06-06 22:13:28 +03:00
Kris
d371f3906e
FIX: restore sidebar footer background (#21956) 2023-06-06 14:46:08 -04:00
Joffrey JAFFEUX
ad0a8cccc8
FIX: attempts to exit lock-on early (#21949) 2023-06-06 16:28:06 +02:00
Discourse Translator Bot
9661a8c214
Update translations (#21950) 2023-06-06 15:36:51 +02:00
Kris
10dce46886
UX: remove sidebar background color (#21775) 2023-06-06 09:24:56 -04:00
Andrei Prigorshnev
b7a66bd6ad
DEV: Use await when sending chat messages (#21915)
This is a follow-up to d086888, I forgot to update these places in that commit.
2023-06-06 13:58:15 +04:00
chapoi
8c4cbd748d
UX: fix greyed out add button in chat composer when focussed (#21947) 2023-06-06 11:18:50 +02:00
David Taylor
80b77b2e65
DEV: Convert modal wrapper from named outlet to component (#21932)
This removes the modal container named-outlet/controller/template and replaces it with a component. Named outlets will be removed in Ember 4.x, so this change is part of that upgrade project.

Smaller changes include:
- update some of the computed values to be getters rather than calculated during `show()`.
- update tests which were previously depending on the modal class persisting after the modal was closed

Much of the logic in the service will be deprecated once we introduce component-based modals.

This work is split out from https://github.com/discourse/discourse/pull/21304
2023-06-06 10:14:07 +01:00
Alan Guo Xiang Tan
7ef2eaa892
DEV: Fix system test assertion to avoid stale element reference error (#21944)
What is this change required?

We were seeing this error on CI

```
  1) Fast edit when editing text that has strange characters saves when paragraph contains apostrophe
     Failure/Error:
       expect(find("#{topic_page.post_by_number_selector(2)} .cooked p")).to have_content(
         "It ‘twas a great’ “day”!",
       )

     Selenium::WebDriver::Error::StaleElementReferenceError:
       stale element reference: stale element not found
         (Session info: chrome=114.0.5735.90)
```

I believe this is because the element that is "found" using `find` is
eventually re-rendered before the `have_content` matcher is called on
it.
2023-06-06 15:43:49 +08:00
Alan Guo Xiang Tan
5af2f4b888
DEV: Skip flaky network disconnected test (#21945)
Follow up to c574d7c555. Skipping the
entire file because both tests are flaky.
2023-06-06 15:39:18 +08:00