This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add better error for email invites without identity server (#10739)
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -15,7 +15,7 @@ limitations under the License. | |
*/ | ||
|
||
import { mocked } from "jest-mock"; | ||
import { MatrixClient } from "matrix-js-sdk/src/matrix"; | ||
import { MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix"; | ||
|
||
import { MatrixClientPeg } from "../../src/MatrixClientPeg"; | ||
import Modal, { ComponentType, ComponentProps } from "../../src/Modal"; | ||
|
@@ -142,5 +142,17 @@ describe("MultiInviter", () => { | |
}); | ||
}); | ||
}); | ||
|
||
it("should show sensible error when attempting 3pid invite with no identity server", async () => { | ||
client.inviteByEmail = jest.fn().mockRejectedValueOnce( | ||
new MatrixError({ | ||
errcode: "ORG.MATRIX.JSSDK_MISSING_PARAM", | ||
}), | ||
); | ||
await inviter.invite(["[email protected]"]); | ||
expect(inviter.getErrorText("[email protected]")).toMatchInlineSnapshot( | ||
`"Cannot invite user by email without an identity server. You can connect to one under "Settings"."`, | ||
); | ||
}); | ||
}); | ||
}); |