mirror of
https://github.com/wassname/talk.git
synced 2026-07-29 11:28:24 +08:00
[CORL-380] Duplicate Email Error (#2320)
* fix: throw duplicate email error during signup * fix: Coral.Coral.* -> Coral.* * fix: tests
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<h1 style="text-align: center">Coral 5.0 – Embed Stream</h1>
|
||||
<div id="coralStreamEmbed" style="max-width: 640px; margin: 0 auto"></div>
|
||||
<script>
|
||||
const CoralStreamEmbed = Coral.Coral.createStreamEmbed({
|
||||
const CoralStreamEmbed = Coral.createStreamEmbed({
|
||||
id: "coralStreamEmbed",
|
||||
});
|
||||
window.CoralStreamEmbed = CoralStreamEmbed;
|
||||
|
||||
@@ -14,7 +14,7 @@ describe("Basic integration test", () => {
|
||||
});
|
||||
it("should render iframe", () => {
|
||||
mockConsole();
|
||||
const CoralEmbedStream = Coral.Coral.createStreamEmbed({
|
||||
const CoralEmbedStream = Coral.createStreamEmbed({
|
||||
id: "basic-integration-test-id",
|
||||
});
|
||||
CoralEmbedStream.render();
|
||||
@@ -28,7 +28,7 @@ describe("Basic integration test", () => {
|
||||
link.rel = "canonical";
|
||||
link.href = "http://localhost/canonical";
|
||||
document.head!.appendChild(link);
|
||||
const CoralEmbedStream = Coral.Coral.createStreamEmbed({
|
||||
const CoralEmbedStream = Coral.createStreamEmbed({
|
||||
id: "basic-integration-test-id",
|
||||
});
|
||||
CoralEmbedStream.render();
|
||||
@@ -39,7 +39,7 @@ describe("Basic integration test", () => {
|
||||
});
|
||||
it("should remove iframe", () => {
|
||||
mockConsole();
|
||||
const CoralEmbedStream = Coral.Coral.createStreamEmbed({
|
||||
const CoralEmbedStream = Coral.createStreamEmbed({
|
||||
id: "basic-integration-test-id",
|
||||
});
|
||||
CoralEmbedStream.render();
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
import * as CoralImport from "./Coral";
|
||||
export const Coral = CoralImport;
|
||||
export * from "./Coral";
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
</p>
|
||||
<div id="coralStreamEmbed" style="max-width: 640px; margin: 0 auto"></div>
|
||||
<script>
|
||||
const CoralStreamEmbed = Coral.Coral.createStreamEmbed({
|
||||
const CoralStreamEmbed = Coral.createStreamEmbed({
|
||||
id: "coralStreamEmbed",
|
||||
autoRender: true,
|
||||
});
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<button id="showComments">Show Comments</button>
|
||||
</div>
|
||||
<script>
|
||||
const CoralStreamEmbed = Coral.Coral.createStreamEmbed({
|
||||
const CoralStreamEmbed = Coral.createStreamEmbed({
|
||||
id: "coralStreamEmbed",
|
||||
});
|
||||
window.CoralStreamEmbed = CoralStreamEmbed;
|
||||
|
||||
@@ -403,6 +403,10 @@ export async function insertUser(
|
||||
// Evaluate the error, if it is in regards to violating the unique index,
|
||||
// then return a duplicate Story error.
|
||||
if (err instanceof MongoError && err.code === 11000) {
|
||||
// Check if duplicate index was about the email.
|
||||
if (err.errmsg && err.errmsg.includes("tenantID_1_email_1")) {
|
||||
throw new DuplicateEmailError(input.email!);
|
||||
}
|
||||
throw new DuplicateUserError();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user