Commit Graph

2919 Commits

Author SHA1 Message Date
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
Martin Brennan ac60b9fe72
DEV: Skip chat test (#24739)
This consistently fails on core now, see
https://github.com/discourse/discourse/actions/runs/7109919490/job/19355591619?pr=24738

Error: QUnit Test Failure: Browser Id 2 - Discourse Chat | Component | chat message collapser images: escapes link
not ok 444 Chrome 120.0 - [58 ms] - Browser Id 2 - Discourse Chat | Component | chat message collapser images: escapes link
    ---
        actual: >
            false
        expected: >
            true
        stack: >

Expected value is %3Cscript%3Esomeeviltitle%3C/script%3E and actual value is
&lt;script&gt;someeviltitle&lt;/script&gt;
2023-12-06 13:58:13 +10:00
Martin Brennan 9057272ee2
FIX: Use Guardian.basic_user instead of new (anon) (#24705)
c.f. de983796e1

There will soon be additional login_required checks
for Guardian, and the intent of many checks by automated
systems is better fulfilled by using BasicUser, which
simulates a logged in TL0 forum user, rather than an
anon user.

In some cases the use of anon still makes sense (e.g.
anonymous_cache), and in that case the more explicit
`Guardian.anon_user` is used
2023-12-06 11:56:21 +10:00
Discourse Translator Bot cae2b83af8
Update translations (#24716) 2023-12-05 14:39:08 +01:00
chapoi 3d710fa0b8
UX:; scope details change (#24715) 2023-12-05 13:56:17 +01:00
Joffrey JAFFEUX c5aa6b5e16
FIX: correctly update replies_count on chat_threads (#24711)
The previous query would look at the existing messages, count them, and update the associated thread.

But, if for some reason messages were **ALL** deleted without updating the `replies_count`, then the query wouldn't find any message, and wouldn't update any thread's `replies_count`.
2023-12-05 13:46:58 +01:00
chapoi 707acbe696
UX: details tag background colour (#24710) 2023-12-05 12:52:00 +01:00
Joffrey JAFFEUX 094d597ec8
FIX: increments message version when processed (#24713)
Incrementing version, ensures the message will re-play decorators.

Also removes a debugging line which had been forgotten.
2023-12-05 12:34:19 +01:00
Ted Johansson c7667f791e
DEV: Fix chat notifier deprecation warnings from job arguments (#24708)
We're seeing some deprecation warnings in production. This is because we're passing a raw Ruby timestamp, which gets stringified implicitly when written to Redis. As per #15842, this conversion needs to be done explicitly.
2023-12-05 18:03:30 +08:00
Joffrey JAFFEUX c805bcc7ba
DEV: adds a chat-join-channel-button outlet (#24698)
This outlet allows to redefine the button displayed when asking the user to join a channel.

The following outletArgs are sent to the outlet:

```
onJoinChannel
channel
icon
title
label
disabled
```
2023-12-04 18:11:33 +01:00
Jan Cernik 0af8bbd378
FIX: Multiple nested threads and duplicated messages in chat transcripts (#24685) 2023-12-04 12:43:04 -03:00
David Taylor d636ff216a
DEV: Resolve transitionTo deprecation in chat-channel route (#24668) 2023-12-01 16:01:59 +00:00
Joffrey JAFFEUX bcca1692c6
FIX: disables tooltip on desktop message menu’s reaction (#24650) 2023-11-30 19:41:28 +01:00
Joffrey JAFFEUX a7a7d8e41e
DEV: correctly uses link to message endpoint in spec (#24652)
- correctly uses link to message endpoint in spec
- correctly uses "chat with"
2023-11-30 19:33:41 +01:00
Joffrey JAFFEUX 4fa1b0e978
FIX: show leave channel notice only on group channels (#24653) 2023-11-30 19:24:14 +01:00
Joffrey JAFFEUX a1ae9f6ab0
FIX: correctly show "chat with" and not "chat in" for users (#24651)
Prior to this fix direct message would always show "Chat in ..." when hovering the channel even if you were hovering a direct message channel with another user (or yourself).

We will now correctly show:

- `Chat in ...` for group channels
- `Chat with ...` for direct message channels
2023-11-30 19:02:19 +01:00
Joffrey JAFFEUX a1690e0401
DEV: removes dead code (message_link) (#24648)
Linking to a message ID is now handled by the frontend router: `chat.channel.near-message`
2023-11-30 11:13:37 +01:00
Joffrey JAFFEUX 0b65aa8b77
DEV: ensures we have error message before message check (#24647)
Previously the spec could be flakey as the long message could show on the screen while we await for processing. Now we will first check to have the error message on screen, at this point the erroneous message should never be visible.
2023-11-30 10:55:05 +01:00
chapoi 1b022457ad
UX: chat leave info (#24645)
* UX: add info-warning to leave button

* Scope to groupchat

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2023-11-30 10:13:37 +01:00
Martin Brennan dc8a727b3f
COPY: secure media -> secure uploads (#24643)
Fixing up the last few holdouts
2023-11-30 14:58:55 +10:00
Krzysztof Kotlarek 7e013b2120
DEV: add recurrence rule parameter to downloadCalendar API (#24404)
Add option to create recurrent calendar events. Recurrence rule parameter follows rfc5545 specification: https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10
2023-11-30 13:56:22 +11:00
Joffrey JAFFEUX 384a8b17a1
FIX: leaving a group channel should destroy membership (#24631)
In other kind of channels we will only unfollow but for group channels we don't want people to keep appearing in members list.

This commit also creates appropriate services:
- `Chat::LeaveChannel`
- `Chat::UnfollowChannel`

And dedicated endpoint for unfollow: `DELETE /chat/api/channels/:id/memberships/me/follows`
2023-11-29 17:48:14 +01:00
Jarek Radosz 7cac167928
DEV: Fix "ember/no-empty-glimmer-component-classes" lint (#24629) 2023-11-29 15:14:30 +01:00
Discourse Translator Bot c90772fd3a
Update translations (#24599) 2023-11-29 10:41:27 +01:00
Sam b09422428d
DEV: update syntax tree to latest (#24623)
update format to latest syntax tree
2023-11-29 16:38:07 +11:00
Joffrey JAFFEUX ee5bdb3436
DEV: refactor flag message (#24604)
- Uses a chat service: `Chat::FlatMessage`
- Moves logic inside chat api controllers
- Create a javascript chat api helper: `chatApi.flagMessage(...)`
2023-11-28 18:24:09 +01:00
Jan Cernik de0c761516
DEV: Skip flaky chat transcript specs (#24607) 2023-11-28 14:13:25 -03:00
Blake Erickson 21d614215b
DEV: Use staged user check instead (#24578)
This change refactors the check `user.groups.any?` and instead uses
`user.staged?` to check if the user is staged or not.

Also fixes several tests to ensure the users have their auto trust level
groups created.

Follow up to:

- 8a45f84277
- 447d9b2105
- c89edd9e86
2023-11-28 07:34:02 -07:00
Jarek Radosz e9356c2ec9
DEV: Fix "no-empty" lint (#24588) 2023-11-28 10:55:02 +01:00
Jarek Radosz 916e1371b3
DEV: Fix "ember/no-global-jquery" lint (#24586) 2023-11-28 10:53:38 +01:00
Jarek Radosz 22210a9c15
DEV: Fix "no-setter-return" lint (#24585) 2023-11-28 10:49:49 +01:00
Jarek Radosz cfa7dcaf0a
DEV: Remove unnecessary `await settled()` (#24584) 2023-11-28 10:45:20 +01:00
Jarek Radosz b2dfc320aa
DEV: Fix `super` calls in native chat classes (#24583) 2023-11-28 10:44:47 +01:00
Jarek Radosz a80e32fe75
DEV: Fix `no-extra-boolean-cast` lint (#24582) 2023-11-28 10:37:23 +01:00
Jarek Radosz 103fab37e3
DEV: Fix `no-unnecessary-curly-strings` lint rule (#24580) 2023-11-28 10:35:09 +01:00
Jan Cernik ac9e804dbe
FEATURE: Add threads support to chat archives (#24325)
This PR introduces thread support for channel archives. Now, threaded messages are rendered inside a `details` HTML tag in posts.

The transcript markdown rules now support two new attributes: `threadId` and `threadTitle`.

- If `threadId` is present, all nested `chat` tags are rendered inside the first one.
- `threadTitle` (optional) defines the summary content.

```
[chat threadId=19 ... ]
thread OM

  [chat ... ]
  thread reply
  [/chat]

[/chat]
```

If threads are split across multiple posts when archiving, the range of messages in each part will be displayed alongside the thread title. For example: `(message 1 to 16 of 20)` and `(message 17 to 20 of 20)`.
2023-11-27 15:47:35 +01:00
Renato Atilio 856ccb34e1
UX: fix new group chat cancel i18n label (#24554) 2023-11-25 16:54:07 -03:00
Jarek Radosz 68960b26be
DEV: Consistently use kebab-case in service lookups (#24552) 2023-11-25 18:10:10 +01:00
Joffrey JAFFEUX 2befff5101
FIX: nullifies target message id when not readable (#24540)
This bug was very reproducible when your last read was a message you didn't read and an admin would delete it. When coming back to the channel you would get a not found, in this case we will now reset last read and present you the last message of the channel.

We could be more fancy and  try to detect the next readable message but that would be more code and complexity for such a rare case.
2023-11-24 11:46:00 +01:00
chapoi 0b352ce7fb
UX: fix date time modal on mobile (#24531)
* UX: fix date time modal
2023-11-24 10:28:46 +01:00