Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default intentional mentions #11602

Merged
merged 5 commits into from Sep 14, 2023
Merged

Conversation

Johennes
Copy link
Contributor

@Johennes Johennes commented Sep 12, 2023

As discussed with @clokep it should be safe for us to include the m.mentions field regardless of whether the home server supports it or not as servers that don't support it should simply ignore it.

This is as far as I could get in-between other things. It will still require more work as there are three remaining test failures.

 FAIL  test/components/views/rooms/EditMessageComposer-test.tsx
  <EditMessageComposer/>
    ✓ should edit a simple message (105 ms)
    ✓ should throw when room for message is not found (40 ms)
    createEditContent
      ✓ sends plaintext messages correctly (1 ms)
      ✓ sends markdown messages correctly (10 ms)
      ✓ strips /me from messages and marks them as m.emote accordingly (2 ms)
      ✓ allows emoting with non-text parts (1 ms)
      ✓ allows sending double-slash escaped slash commands correctly (1 ms)
    when message is not a reply
      ✓ should attach an empty mentions object for a message with no mentions (48 ms)
      ✓ should retain mentions in the original message that are not removed by the edit (45 ms)
      ✓ should remove mentions that are removed by the edit (85 ms)
      ✕ should add mentions that were added in the edit (51 ms)
      ✕ should add and remove mentions from the edit (54 ms)
    when message is replying
      ✓ should retain parent event sender in mentions when editing with plain text (37 ms)
      ✕ should retain parent event sender in mentions when adding a mention (47 ms)
      ✓ should retain parent event sender in mentions when removing all mentions from content (55 ms)
      ✓ should retain parent event sender in mentions when removing mention of said user (54 ms)

  ● <EditMessageComposer/> › when message is not a reply › should add mentions that were added in the edit

    expect(received).toEqual(expected) // deep equality

    - Expected  - 5
    + Received  + 1

    - Object {
    -   "user_ids": Array [
    -     "@dan:server.org",
    -   ],
    - }
    + Object {}

      354 |
      355 |             // new mention in the edit
    > 356 |             expect(messageContent["m.mentions"]).toEqual({
          |                                                  ^
      357 |                 user_ids: ["@dan:server.org"],
      358 |             });
      359 |             expect(messageContent["m.new_content"]["m.mentions"]).toEqual({

      at Object.<anonymous> (test/components/views/rooms/EditMessageComposer-test.tsx:356:50)

  ● <EditMessageComposer/> › when message is not a reply › should add and remove mentions from the edit

    expect(received).toEqual(expected) // deep equality

    - Expected  - 5
    + Received  + 1

    - Object {
    -   "user_ids": Array [
    -     "@dan:server.org",
    -   ],
    - }
    + Object {}

      377 |
      378 |             // new mention in the edit
    > 379 |             expect(messageContent["m.mentions"]).toEqual({
          |                                                  ^
      380 |                 user_ids: ["@dan:server.org"],
      381 |             });
      382 |             // all mentions in the edited version of the event

      at Object.<anonymous> (test/components/views/rooms/EditMessageComposer-test.tsx:379:50)

  ● <EditMessageComposer/> › when message is replying › should retain parent event sender in mentions when adding a mention

    expect(received).toEqual(expected) // deep equality

    - Expected  - 5
    + Received  + 1

    - Object {
    -   "user_ids": Array [
    -     "@dan:server.org",
    -   ],
    - }
    + Object {}

      473 |
      474 |             // new mention in edit
    > 475 |             expect(messageContent["m.mentions"]).toEqual({
          |                                                  ^
      476 |                 user_ids: ["@dan:server.org"],
      477 |             });
      478 |             // edited reply still mentions the parent event sender

      at Object.<anonymous> (test/components/views/rooms/EditMessageComposer-test.tsx:475:50)

Test Suites: 1 failed, 1 total
Tests:       3 failed, 13 passed, 16 total
Snapshots:   0 total
Time:        2.574 s, estimated 4 s

I'm probably just too dense to quickly understand what's happening here. I suspect something is wrong with the completion setup but I didn't have time yet to look into it further.

  console.error
    Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
        at BasicMessageEditor (/Users/jm/Code/matrix-react-sdk/src/components/views/rooms/BasicMessageComposer.tsx:144:9)
        at div
        at EditMessageComposer (/Users/jm/Code/matrix-react-sdk/src/components/views/rooms/EditMessageComposer.tsx:135:9)
        at /Users/jm/Code/matrix-react-sdk/src/contexts/MatrixClientContext.tsx:56:34
        at wrapper (/Users/jm/Code/matrix-react-sdk/test/components/views/rooms/EditMessageComposer-test.tsx:87:25)

      685 |     private onAutoCompleteSelectionChange = (completionIndex: number): void => {
      686 |         this.modifiedFlag = true;
    > 687 |         this.setState({ completionIndex });
          |              ^
      688 |     };
      689 |
      690 |     private configureUseMarkdown = (): void => {
``

<!-- CHANGELOG_PREVIEW_START -->
---
Here's what your changelog entry will look like:

## ✨ Features
 * Default intentional mentions ([\#11602](https://github.com/matrix-org/matrix-react-sdk/pull/11602)).<!-- CHANGELOG_PREVIEW_END -->

@Johennes Johennes added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Sep 12, 2023
@Johennes
Copy link
Contributor Author

Thanks @kerryarchibald for working your magic to fix the composer tests! 🙏

The remaining failures appear unrelated to the change here to me. Might be flakes? 🤔

FAIL test/components/views/settings/JoinRuleSettings-test.tsx (7548 ms)
FAIL test/components/views/right_panel/VerificationPanel-test.tsx (6.095 s)

@Johennes Johennes marked this pull request as ready for review September 14, 2023 07:17
@Johennes Johennes requested a review from a team as a code owner September 14, 2023 07:17
@weeman1337
Copy link
Contributor

Thanks @kerryarchibald for working your magic to fix the composer tests! 🙏

The remaining failures appear unrelated to the change here to me. Might be flakes? 🤔

FAIL test/components/views/settings/JoinRuleSettings-test.tsx (7548 ms)
FAIL test/components/views/right_panel/VerificationPanel-test.tsx (6.095 s)

An issue for JoinRuleSettings-test does already exist: element-hq/element-web#25625

Can you create one for the VerificationPanel-test ?

Copy link
Contributor

@weeman1337 weeman1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@Johennes
Copy link
Contributor Author

Can you create one for the VerificationPanel-test ?

Thanks, have opened element-hq/element-web#26166. I didn't manage to find the failed test result anymore though. They don't appear to show up in https://github.com/matrix-org/matrix-react-sdk/actions/workflows/tests.yml?query=branch%3Ajohannes%2Fdefault-intentional-mentions. 🤔

@Johennes Johennes added this pull request to the merge queue Sep 14, 2023
Merged via the queue into develop with commit 3608d52 Sep 14, 2023
76 checks passed
@Johennes Johennes deleted the johannes/default-intentional-mentions branch September 14, 2023 12:07
@clokep
Copy link
Contributor

clokep commented Sep 14, 2023

So excited to see this land! Thanks for finishing it up! 🎉

@Johennes
Copy link
Contributor Author

Nothing compared to the groundworks you and Kerry did. 😉

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 30, 2023
Changes in [1.11.45](https://github.com/vector-im/element-web/releases/tag/v1.11.45) (2023-09-29)
=================================================================================================

## 🐛 Bug Fixes
 * Fix Emoji font on Safari 17 ([\#11673](matrix-org/matrix-react-sdk#11673)).

Changes in [1.11.44](https://github.com/vector-im/element-web/releases/tag/v1.11.44) (2023-09-26)
=================================================================================================

## ✨ Features
 * Make video & voice call buttons pin conference widget if unpinned ([\#11576](matrix-org/matrix-react-sdk#11576)). Fixes vector-im/customer-retainer#72.
 * OIDC: persist refresh token ([\#11249](matrix-org/matrix-react-sdk#11249)). Contributed by @kerryarchibald.
 * ElementR: Cross user verification ([\#11364](matrix-org/matrix-react-sdk#11364)). Fixes #25752. Contributed by @florianduros.
 * Default intentional mentions ([\#11602](matrix-org/matrix-react-sdk#11602)).
 * Notify users about denied access on ask-to-join  rooms ([\#11480](matrix-org/matrix-react-sdk#11480)). Contributed by @nurjinjafar.
 * Allow setting knock room directory visibility ([\#11529](matrix-org/matrix-react-sdk#11529)). Contributed by @charlynguyen.

## 🐛 Bug Fixes
 * Revert "Fix regression around FacePile with overflow (#11527)" ([\#11634](matrix-org/matrix-react-sdk#11634)). Fixes #26209.
 * Escape placeholder before injecting it into the style ([\#11607](matrix-org/matrix-react-sdk#11607)).
 * Move ViewUser action callback to RoomView ([\#11495](matrix-org/matrix-react-sdk#11495)). Fixes #26040.
 * Fix room timeline search toggling behaviour edge case ([\#11605](matrix-org/matrix-react-sdk#11605)). Fixes #26105.
 * Avoid rendering view-message link in RoomKnocksBar unnecessarily ([\#11598](matrix-org/matrix-react-sdk#11598)). Contributed by @charlynguyen.
 * Use knock rooms sync to reflect the knock state ([\#11596](matrix-org/matrix-react-sdk#11596)). Fixes #26043 and #26044. Contributed by @charlynguyen.
 * Fix avatar in right panel not using the correct font ([\#11593](matrix-org/matrix-react-sdk#11593)). Fixes #26061. Contributed by @MidhunSureshR.
 * Add waits in Spotlight Cypress tests, hoping this unflakes them ([\#11590](matrix-org/matrix-react-sdk#11590)). Fixes #26053, #26140 #26139 and #26138. Contributed by @andybalaam.
 * Fix vertical alignment of default avatar font ([\#11582](matrix-org/matrix-react-sdk#11582)). Fixes #26081.
 * Fix avatars in public room & space search being flex shrunk ([\#11580](matrix-org/matrix-react-sdk#11580)). Fixes #26133.
 * Fix EventTile avatars being rendered with a size of 0 instead of hidden ([\#11558](matrix-org/matrix-react-sdk#11558)). Fixes #26075.

Changes in [1.11.43](https://github.com/vector-im/element-web/releases/tag/v1.11.43) (2023-09-15)
=================================================================================================

(No changes - bumping the version number for an element-desktop release.)

Changes in [1.11.42](https://github.com/vector-im/element-web/releases/tag/v1.11.42) (2023-09-13)
=================================================================================================

## 🐛 Bug Fixes
 * Update Compound to fix Firefox-specific avatar regression ([\#11604](matrix-org/matrix-react-sdk#11604)). Fixes #26155.

Changes in [1.11.41](https://github.com/vector-im/element-web/releases/tag/v1.11.41) (2023-09-12)
=================================================================================================

## 🦖 Deprecations
 * Deprecate customisations in favour of Module API ([\#25736](element-hq/element-web#25736)). Fixes #25733.

## ✨ Features
 * Make SVGR icons use forward ref ([\#26082](element-hq/element-web#26082)).
 * Add support for rendering a custom wrapper around Element ([\#25537](element-hq/element-web#25537)). Contributed by @maheichyk.
 * Allow creating public knock rooms ([\#11481](matrix-org/matrix-react-sdk#11481)). Contributed by @charlynguyen.
 * Render custom images in reactions according to MSC4027 ([\#11087](matrix-org/matrix-react-sdk#11087)). Contributed by @sumnerevans.
 * Introduce room knocks bar ([\#11475](matrix-org/matrix-react-sdk#11475)). Contributed by @charlynguyen.
 * Room header UI updates ([\#11507](matrix-org/matrix-react-sdk#11507)). Fixes #25892.
 * Remove green "verified" bar for encrypted events ([\#11496](matrix-org/matrix-react-sdk#11496)).
 * Update member count on room summary update ([\#11488](matrix-org/matrix-react-sdk#11488)).
 * Support for E2EE in Element Call  ([\#11492](matrix-org/matrix-react-sdk#11492)).
 * Allow requesting to join knock rooms via spotlight ([\#11482](matrix-org/matrix-react-sdk#11482)). Contributed by @charlynguyen.
 * Lock out the first tab if Element is opened in a second tab. ([\#11425](matrix-org/matrix-react-sdk#11425)). Fixes #25157.
 * Change avatar to use Compound implementation ([\#11448](matrix-org/matrix-react-sdk#11448)).

## 🐛 Bug Fixes
 * Fix vertical alignment of default avatar font ([\#11582](matrix-org/matrix-react-sdk#11582)). Fixes #26081.
 * Fix avatars in public room & space search being flex shrunk ([\#11580](matrix-org/matrix-react-sdk#11580)). Fixes #26133.
 * Fix EventTile avatars being rendered with a size of 0 instead of hidden ([\#11558](matrix-org/matrix-react-sdk#11558)). Fixes #26075.
 * Fix compound external assets path in bundle ([\#26069](element-hq/element-web#26069)).
 * Use RoomStateEvent.Update for knocks ([\#11516](matrix-org/matrix-react-sdk#11516)). Contributed by @charlynguyen.
 * Prevent event propagation when clicking icon buttons ([\#11515](matrix-org/matrix-react-sdk#11515)).
 * Only display RoomKnocksBar when feature flag is enabled ([\#11513](matrix-org/matrix-react-sdk#11513)). Contributed by @andybalaam.
 * Fix avatars of knock members for people tab of room settings ([\#11506](matrix-org/matrix-react-sdk#11506)). Fixes #26083. Contributed by @charlynguyen.
 * Fixes read receipt avatar offset ([\#11483](matrix-org/matrix-react-sdk#11483)). Fixes #26067, #26064 #26059 and #26061.
 * Fix avatar defects ([\#11473](matrix-org/matrix-react-sdk#11473)). Fixes #26051 and #26046.
 * Fix consistent avatar output for Percy ([\#11472](matrix-org/matrix-react-sdk#11472)). Fixes #26049 and #26052.
 * Fix colour of avatar and colour matching with username ([\#11470](matrix-org/matrix-react-sdk#11470)). Fixes #26042.
 * Fix incompatibility of Soft Logout with Element-R ([\#11468](matrix-org/matrix-react-sdk#11468)).
 * Fix instances of double translation and guard translation calls using typescript ([\#11443](matrix-org/matrix-react-sdk#11443)).
estellecomment added a commit to tchapgouv/tchap-web-v4 that referenced this pull request Oct 9, 2023
…xed, not tried running yet

* Make video & voice call buttons pin conference widget if unpinned ([\#11576](matrix-org/matrix-react-sdk#11576)). Fixes vector-im/customer-retainer#72.
* OIDC: persist refresh token ([\#11249](matrix-org/matrix-react-sdk#11249)). Contributed by @kerryarchibald.
* ElementR: Cross user verification ([\#11364](matrix-org/matrix-react-sdk#11364)). Fixes #25752. Contributed by @florianduros.
* Default intentional mentions ([\#11602](matrix-org/matrix-react-sdk#11602)).
* Notify users about denied access on ask-to-join  rooms ([\#11480](matrix-org/matrix-react-sdk#11480)). Contributed by @nurjinjafar.
* Allow setting knock room directory visibility ([\#11529](matrix-org/matrix-react-sdk#11529)). Contributed by @charlynguyen.
* Revert "Fix regression around FacePile with overflow (#11527)" ([\#11634](matrix-org/matrix-react-sdk#11634)). Fixes #26209.
* Escape placeholder before injecting it into the style ([\#11607](matrix-org/matrix-react-sdk#11607)).
* Move ViewUser action callback to RoomView ([\#11495](matrix-org/matrix-react-sdk#11495)). Fixes #26040.
* Fix room timeline search toggling behaviour edge case ([\#11605](matrix-org/matrix-react-sdk#11605)). Fixes #26105.
* Avoid rendering view-message link in RoomKnocksBar unnecessarily ([\#11598](matrix-org/matrix-react-sdk#11598)). Contributed by @charlynguyen.
* Use knock rooms sync to reflect the knock state ([\#11596](matrix-org/matrix-react-sdk#11596)). Fixes #26043 and #26044. Contributed by @charlynguyen.
* Fix avatar in right panel not using the correct font ([\#11593](matrix-org/matrix-react-sdk#11593)). Fixes #26061. Contributed by @MidhunSureshR.
* Add waits in Spotlight Cypress tests, hoping this unflakes them ([\#11590](matrix-org/matrix-react-sdk#11590)). Fixes #26053, #26140 #26139 and #26138. Contributed by @andybalaam.
* Fix vertical alignment of default avatar font ([\#11582](matrix-org/matrix-react-sdk#11582)). Fixes #26081.
* Fix avatars in public room & space search being flex shrunk ([\#11580](matrix-org/matrix-react-sdk#11580)). Fixes #26133.
* Fix EventTile avatars being rendered with a size of 0 instead of hidden ([\#11558](matrix-org/matrix-react-sdk#11558)). Fixes #26075.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants