Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into justjanne/fix/24243-threads-timestamp-ove…
Browse files Browse the repository at this point in the history
…rflow
  • Loading branch information
justjanne authored Jan 18, 2023
2 parents 9c6c8e5 + dacbf76 commit 7c853f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions cypress/e2e/composer/composer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ describe("Composer", () => {
cy.contains(".mx_EventTile_body", "my message 1");
});

it("sends only one message when you press Enter multiple times", () => {
// Type a message
cy.get("div[contenteditable=true]").type("my message 0");
// It has not been sent yet
cy.contains(".mx_EventTile_body", "my message 0").should("not.exist");

// Click send
cy.get("div[contenteditable=true]").type("{enter}");
cy.get("div[contenteditable=true]").type("{enter}");
cy.get("div[contenteditable=true]").type("{enter}");
// It has been sent
cy.contains(".mx_EventTile_body", "my message 0");
cy.get(".mx_EventTile_body").should("have.length", 1);
});

it("can write formatted text", () => {
cy.get("div[contenteditable=true]").type("my {ctrl+b}bold{ctrl+b} message");
cy.get('div[aria-label="Send message"]').click();
Expand Down
5 changes: 3 additions & 2 deletions src/components/views/rooms/MessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,16 @@ export class MessageComposer extends React.Component<IProps, IState> {

if (this.state.isWysiwygLabEnabled) {
const { permalinkCreator, relation, replyToEvent } = this.props;
await sendMessage(this.state.composerContent, this.state.isRichTextEnabled, {
const composerContent = this.state.composerContent;
this.setState({ composerContent: "", initialComposerContent: "" });
await sendMessage(composerContent, this.state.isRichTextEnabled, {
mxClient: this.props.mxClient,
roomContext: this.context,
permalinkCreator,
relation,
replyToEvent,
});
dis.dispatch({ action: Action.ClearAndFocusSendMessageComposer });
this.setState({ composerContent: "", initialComposerContent: "" });
}
};

Expand Down

0 comments on commit 7c853f9

Please sign in to comment.