Commit Graph

2958 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
cdd66b24ec
Revert "UX: typo (#24971)" (#24979)
This reverts commit b8a36dd870.

Commit is breaking the build
2023-12-20 13:20:34 +08:00
Alan Guo Xiang Tan
68a3f7783e
DEV: Remove the use of Capybara::Session#quit (#24978)
Why this change?

This is what `Capybara::Session#quit` does:

```
    def quit
      @driver.quit if @driver.respond_to? :quit
      @document = @driver = nil
      @touched = false
      @server&.reset_error!
    end
```

One notable thing is that it resets server errors which means that any
server errors encountered by a session is cleared. That is not what we
want since it hides errors even though `Capybara.raise_server_errors`
has been set to `true`.
2023-12-20 13:20:14 +08:00
Discourse Translator Bot
032bfa3d51
Update translations (#24968) 2023-12-19 22:45:27 +01:00
chapoi
63b217c2bc
UX: chat navbar header specific case (#24972) 2023-12-19 16:37:16 +01:00
chapoi
70f0cb610a
UX: Chat info area back button + styling tweaks (#24966)
## Back button to navigate out of add-member area

Currently on mobile, once you're in the member area, there is no easy to return to the general settings area, except exiting the settings altogether, which isn't very user friendly. A go-back link solves the problem.

## Styling tweaks

* Removed the background from the leave button
* Added more spacing between the sections on desktop and removed the fixed height for rows

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-12-19 16:28:07 +01:00
chapoi
b8a36dd870
UX: typo (#24971) 2023-12-19 16:26:47 +01:00
Andrei Prigorshnev
fbd24fa6ae
DEV: Allow chat mentions to have several notifications (#24874)
This PR is a reworked version of https://github.com/discourse/discourse/pull/24670.

In chat, we need the ability to have several notifications per `chat_mention`. 
Currently, we have one_to_one relationship between `chat_mentions` and `notifications`:

d7a09fb08d/plugins/chat/app/models/chat/mention.rb (L9)

We want to have one_to_many relationship. This PR implements that by introducing 
a join table between `chat_mentions` and `notifications`.

The main motivation for this is that we want to solve some performance problems 
with mentions that we're having now. Let's say a user sends a message with @ all 
in a channel with 50 members, we do two things in this case at the moment:

- create 50 chat_mentions
- create 50 notifications

We don't want to change how notifications work in core, but we want to be more 
efficient in chat, and create only 1 `chat_mention` which would link to 50 notifications. 
Also note, that on the side of notifications, having a lot of notifications is not so 
big problem, because notifications processing can be queued.

Apart from improving performance, this change will make the code design better.

Note that I've marked the old `chat_mention.notification_id` column as ignored, but 
I'm not deleting it in this PR. We'll delete it later in https://github.com/discourse/discourse/pull/24800.
2023-12-19 18:53:00 +04:00
chapoi
558c709fef
UX: align navbar and composer uploads (#24970) 2023-12-19 15:41:51 +01:00
chapoi
9f4fbd0279
UX: use same colour for thread icon as for indicator when unread (#24967) 2023-12-19 12:09:09 +01:00
David Battersby
8ed7f46ce3
FIX: add gallery to lightbox for images in the same chat message (#24962)
When multiple chat images are uploaded to a single message they can use the lightbox gallery.
2023-12-19 17:21:15 +08:00
Joffrey JAFFEUX
c467af97ac
DEV: skip two flakey specs (#24965) 2023-12-19 09:27:09 +01:00
chapoi
dce5e811ef
UX: chat channel info area > classname changes (#24954) 2023-12-18 22:09:47 +01:00
Joffrey JAFFEUX
608ce620fb
FIX: chat navbar followups (#24953)
- displays title on threads screen on one line instead of two on mobile

- ensures chat is not overflowing the screen width
2023-12-18 21:39:36 +01:00
Joffrey JAFFEUX
2ed59266a9
FIX: chat navbar follow-ups (#24951)
- correctly accounts for navbar height on ipad and when keyboard is open
- fixes an incorrect I18n key
2023-12-18 20:22:13 +01:00
Joffrey JAFFEUX
53b96638c5
DEV: implements <Chat::Navbar /> (#24917)
This new navbar component is used for every navbar in chat, full page or drawer, and any screen.

This commit also uses this opportunity to correctly decouple drawer-routes from full page routes. This will avoid having this kind of properties in components: `@includeHeader={{false}}`. The header is now defined in the parent template using a navbar. Each route has now its own template wrapped in a div of the name of the route, eg: `<div class="c-routes-threads">..</div>`.

The navbar API:

```gjs
<Navbar as |navbar|>
 <navbar.BackButton />
 <navbar.Title @title="Foo" />
 <navbar.ChannelTitle @channel={{@channel}} />
 <navbar.Actions as |action|>
   <action.CloseThreadButton />
 </navbar.Actions>
</navbar>
```

The full list of components is listed in `plugins/chat/assets/javascripts/discourse/components/navbar/index.gjs` and `plugins/chat/assets/javascripts/discourse/components/navbar/actions.gjs`.

Visually the header is not changing much, only in drawer mode the background has been removed.

This commit also introduces a `<List />` component to facilitate rendering lists in chat plugin.
2023-12-18 17:49:58 +01:00
Krzysztof Kotlarek
1f72152e47
DEV: Remove usage of min_trust_to_create_topic SiteSetting (#24887)
Using min_trust_to_create_topic and create_topic_allowed_groups together was part of #24740

Now, when plugins specs are fixed, we can safely remove that part of logic.
2023-12-18 13:39:53 +11:00
Kelv
2477bcc32e
DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
Penar Musaraj
8a4ab79be2
DEV: Improve header offset calculation (#24910) 2023-12-15 15:29:17 +01:00
Jan Cernik
437c2c5552
FIX: Do not display chat replies as threads in transcripts (#24768)
* FIX: Do not display chat replies as threads in transcripts

* specs
2023-12-15 09:50:43 -03:00
Jan Cernik
ca3792221a
FIX: Do not notify users for quoted mentions in chat (#24902) 2023-12-14 15:39:28 -03:00
chapoi
7da33ad6ba
UX: user threads styling tweaks 2023-12-13 14:10:52 +01:00
Ted Johansson
294febf3c4
DEV: Convert min_trust_to_flag_posts setting to groups (#24864)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_to_flag_posts site setting to flag_post_allowed_groups.

Note: In the original setting, "posts" is plural. I have changed this to "post" singular in the new setting to match others.
2023-12-13 17:18:42 +08:00
Discourse Translator Bot
7d0562f10e
Update translations (#24848) 2023-12-12 14:23:51 +01:00
Joffrey JAFFEUX
875966cc9e
FIX: ensures border and shadow of header is visible (#24847) 2023-12-12 14:18:36 +01:00
Jarek Radosz
41942357ed
DEV: Use class attribute instead of @class arg (#24804) 2023-12-12 13:09:05 +01:00
Joffrey JAFFEUX
fca67117ee
FIX: incorrect spacing with my threads on ios (#24843)
- sticky doesn't work well with overflow: hidden parents. These overflows were used to hide other issues which shouldn't exist anyways. If it causes issues we should fix the root cause.

- our `--header-offset` is changing a lot on safari while scrolling, sometimes with very unexpected value like: negative or very high value, which causes the navbar to appear at unexpected positions for few ms, this commit is using the value of the header on insert and not changing it after, it shouldn't cause any issue.
2023-12-12 11:32:36 +01:00
David Battersby
22d8978eb4
FIX: increase default max length of chat message excerpts (#24842)
Increases the default max length of message excerpts to allow for longer titles in threads index.
2023-12-12 18:24:07 +08:00
Krzysztof Kotlarek
7dd150bc95
DEV: Convert min_trust_to_edit_wiki_post to groups (#24766)
This change converts the min_trust_to_edit_wiki_post site setting to edit_wiki_post_allowed_groups.

See: https://meta.discourse.org/t/283408

Hides the old setting
Adds the new site setting
Add a deprecation warning
Updates to use the new setting
Adds a migration to fill in the new setting if the old setting was changed
Adds an entry to the site_setting.keywords section
Updates tests to account for the new change
After a couple of months, we will remove the email_in_min_trust setting entirely.

Internal ref: /t/117248
2023-12-12 15:20:37 +11:00
Mark VanLandingham
223e413a6c
DEV: Render glimmer notification items for user notification list (#24802)
This removes the widget notifications list and renders the glimmer user menu notification items instead.
2023-12-11 11:04:43 -06:00
Jan Cernik
4904c2f11b
DEV: Skip chat transcript spec (#24819) 2023-12-11 13:09:22 -03:00
Joffrey JAFFEUX
dacb06842e
FIX: allow to click on thread indicator (#24821)
We can also now control tabindex, and other html attributes, which allows to lick on the thread indicator but not tab to it for example.

By default the tabindex will be 0.
2023-12-11 16:35:29 +01:00
Joffrey JAFFEUX
a7a4aaa6b9
FIX: ensures side panel is closed (#24822)
When navigating to /chat/threads we were not closing the side panel. It would not show as the route doesn't support it, but after if we would open a channel from the sidebar it would open the channel with an empty opened sidepanel .
2023-12-11 16:35:18 +01:00
Joffrey JAFFEUX
2e25e95ce1
UI: ensures emojis are correctly aligned in reactions (#24814)
Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2023-12-11 14:29:16 +01:00
Jan Cernik
72872297f5
FIX: Allow quoting thread's original message (#24773) 2023-12-11 09:58:00 -03:00
Joffrey JAFFEUX
54724f7c09
UX: allow users to click thread title to open it (#24816) 2023-12-11 13:54:00 +01:00
Jan Cernik
549513e25d
DEV: Unskip chat transcript spec (#24778) 2023-12-11 09:46:46 -03:00
Jan Cernik
cf9bef0499
FIX: Navigating out of thread shows other unread threads (#24693)
* FIX: Navigating out of thread shows other unread threads

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-12-11 09:44:50 -03:00
chapoi
8e373bc167
UX: prevent chat channel avatar from getting squished (#24815) 2023-12-11 09:52:12 +01:00
Joffrey JAFFEUX
09277bc543
FEATURE: my threads page (#24771)
This commit adds a new "My threads" link in sidebar and drawer. This link will open the "/chat/threads" page which contains all threads where the current user is a member. It's ordered by activity (unread and then last message created).

Moreover, the threads list of a channel page is now showing every threads of a channel, and not just the ones where you are a member.
2023-12-11 07:38:07 +01:00
Jarek Radosz
694b5f108b
DEV: Fix various rubocop lints (#24749)
These (21 + 3 from previous PRs) are soon to be enabled in rubocop-discourse:

Capybara/VisibilityMatcher
Lint/DeprecatedOpenSSLConstant
Lint/DisjunctiveAssignmentInConstructor
Lint/EmptyConditionalBody
Lint/EmptyEnsure
Lint/LiteralInInterpolation
Lint/NonLocalExitFromIterator
Lint/ParenthesesAsGroupedExpression
Lint/RedundantCopDisableDirective
Lint/RedundantRequireStatement
Lint/RedundantSafeNavigation
Lint/RedundantStringCoercion
Lint/RedundantWithIndex
Lint/RedundantWithObject
Lint/SafeNavigationChain
Lint/SafeNavigationConsistency
Lint/SelfAssignment
Lint/UnreachableCode
Lint/UselessMethodDefinition
Lint/Void

Previous PRs:
Lint/ShadowedArgument
Lint/DuplicateMethods
Lint/BooleanSymbol
RSpec/SpecFilePathSuffix
2023-12-06 23:25:00 +01:00
Jarek Radosz
8623631a06
DEV: Fix random typos (#24756) 2023-12-06 22:25:26 +01:00
Jarek Radosz
6eb1cadb73
DEV: Fix RSpec/SpecFilePathSuffix / enable 3 chat spec files (#24750)
* RSpec/SpecFilePathSuffix
* removes failing specs
* More specific selectors?

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-12-06 22:25:11 +01:00
Kris
22bb1c8951
UX: improve poll text wrap (#24732) 2023-12-06 10:58:06 -05:00
Jarek Radosz
6a66dc1cfb
DEV: Fix Lint/BooleanSymbol (#24747) 2023-12-06 13:19:09 +01:00
Jarek Radosz
138bf486d3
DEV: Fix Lint/DuplicateMethods (#24746) 2023-12-06 13:18:34 +01:00
Jarek Radosz
4280c01153
DEV: Fix Lint/ShadowedArgument (#24733) 2023-12-06 13:16:10 +01:00
David Battersby
78c2f116e0
DEV: skip flaky upload spec for large image thumbnails (#24745) 2023-12-06 19:08:56 +08:00
David Battersby
6dd4937b69
update matchers to improve test suite perf for upload specs (#24744)
This change speeds up our upload specs by avoiding Capybara's default_max_wait_time.
2023-12-06 18:02:55 +08:00
David Battersby
8b46dc8bb5
FEATURE: Add thumbnails for chat image uploads (#24328)
Introduces the concept of image thumbnails in chat, prior to this we uploaded and used full size chat images within channels and direct messages.

The following changes are covered:
- Post processing of image uploads to create the thumbnail within Chat::MessageProcessor
- Extract responsive image ratios into CookedProcessorMixin (used for creating upload variations)
- Add thumbnail to upload serializer from plugin.rb
- Convert chat upload template to glimmer component using .gjs format
- Use thumbnail image within chat upload component (stores full size img in orig-src data attribute)
- Old uploads which don't have thumbnails will fallback to full size images in channels/DMs
- Update Magnific lightbox to use full size image when clicked
- Update Glimmer lightbox to use full size image (enables zooming for chat images)
2023-12-06 14:59:18 +08:00
Martin Brennan
30d5e752d7
DEV: Revert guardian changes (#24742)
I took the wrong approach here, need to rethink.

* Revert "FIX: Use Guardian.basic_user instead of new (anon) (#24705)"

This reverts commit 9057272ee2.

* Revert "DEV: Remove unnecessary method_missing from GuardianUser (#24735)"

This reverts commit a5d4bf6dd2.

* Revert "DEV: Improve Guardian devex (#24706)"

This reverts commit 77b6a038ba.

* Revert "FIX: Introduce Guardian::BasicUser for oneboxing checks (#24681)"

This reverts commit de983796e1.
2023-12-06 16:37:32 +10:00