-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/share?msg=foo endpoint using forward message dialog #29874
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
Open
ara4n
wants to merge
13
commits into
develop
Choose a base branch
from
matthew/share
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0948475
basic implementation of an /share?msg=foo endpoint
ara4n 21e7971
SharePayload
ara4n 302baa0
add sharing html & md while we're at it
ara4n 0bee060
remove whitespace from imports to appease linter
ara4n 0bee6ef
lint
dbkr 46dbb81
Add unit test
dbkr 1f9ee07
Merge branch 'develop' into matthew/share
dbkr a597cd0
More tests
dbkr a713b5c
Test for showScreen
dbkr 2f72104
Use one of the typed strings
dbkr 5b99444
Test nasty tags stripped out
dbkr e121377
Add playwright test
dbkr 47d1213
Fix flake
dbkr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2025 New Vector Ltd. | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
* Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import { test, expect } from "../../element-web-test"; | ||
|
||
test.describe("share from URL", () => { | ||
test.use({ | ||
displayName: "Alice", | ||
room: async ({ app }, use) => { | ||
const roomId = await app.client.createRoom({ name: "A test room" }); | ||
await use({ roomId }); | ||
}, | ||
}); | ||
|
||
test("should share message when users navigates to share URL", async ({ page, user, room, app }) => { | ||
await page.goto("/#/share?msg=Hello+world"); | ||
// The forward message dialog doesn't update as new infomation arrives via sync, which means sometimes | ||
// this is just says, "Empty room". For the same reason, we can't reliably write a test for loading the | ||
// app straight away with a /#/share url as the room doesn't appear until the client syncs.] | ||
// Ideally we should fix the forward dialog to update and eliminate races, until then, there is only one | ||
// room so we click the first button. | ||
await page.getByRole("listitem" /*, { name: "A test room" }*/).getByRole("button", { name: "Send" }).click(); | ||
await page.keyboard.press("Escape"); | ||
await app.viewRoomByName("A test room"); | ||
const lastMessage = page.locator(".mx_RoomView_MessageList .mx_EventTile_last"); | ||
await expect(lastMessage).toBeVisible(); | ||
const lastMessageText = await lastMessage.locator(".mx_EventTile_body").innerText(); | ||
await expect(lastMessageText).toBe("Hello world"); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
Copyright 2025 New Vector Ltd. | ||
|
||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial | ||
Please see LICENSE files in the repository root for full details. | ||
*/ | ||
|
||
import { type ActionPayload } from "../payloads"; | ||
import { type Action } from "../actions"; | ||
|
||
export enum ShareFormat { | ||
Text = "text", | ||
Html = "html", | ||
Markdown = "md", | ||
} | ||
|
||
export interface SharePayload extends ActionPayload { | ||
action: Action.Share; | ||
|
||
/** | ||
* The format of message to be shared (optional) | ||
*/ | ||
format: ShareFormat; | ||
|
||
/** | ||
* The message to be shared. | ||
*/ | ||
msg: string; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.