@7365admin1/layer-common 4.97.1-staging.721 → 4.97.1-staging.722
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -175,6 +175,7 @@ import useRole from '../composables/useRole';
|
|
|
175
175
|
import useSite from '../composables/useSite';
|
|
176
176
|
import { inviteRoleOptions } from '../utils/invite-role-options';
|
|
177
177
|
import { roleSiteFor } from '../utils/invite-sites';
|
|
178
|
+
import { inviteNotEmailedNotice } from '../utils/invite-email-notice';
|
|
178
179
|
import useUser from '../composables/useUser';
|
|
179
180
|
import useUtils from '../composables/useUtils';
|
|
180
181
|
|
|
@@ -260,7 +261,7 @@ const props = defineProps({
|
|
|
260
261
|
}
|
|
261
262
|
});
|
|
262
263
|
|
|
263
|
-
const emit = defineEmits(["cancel", "success", "success:create-more"]);
|
|
264
|
+
const emit = defineEmits(["cancel", "success", "success:create-more", "email-not-sent"]);
|
|
264
265
|
|
|
265
266
|
const validForm = ref(false);
|
|
266
267
|
const form = ref<HTMLFormElement | null>(null);
|
|
@@ -586,11 +587,15 @@ async function submit() {
|
|
|
586
587
|
loading.submittingForm = true;
|
|
587
588
|
|
|
588
589
|
try {
|
|
589
|
-
|
|
590
|
-
await inviteMemberClient(invite.value)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
590
|
+
const res = props.inviteMember
|
|
591
|
+
? await inviteMemberClient(invite.value)
|
|
592
|
+
: await inviteUser(invite.value);
|
|
593
|
+
|
|
594
|
+
// Saved, but its e-mail did not go out (#1416): still a success - the
|
|
595
|
+
// invitation is listed and can be re-sent - so close as usual and let the
|
|
596
|
+
// page warn.
|
|
597
|
+
const notice = inviteNotEmailedNotice(res);
|
|
598
|
+
if (notice) emit("email-not-sent", notice);
|
|
594
599
|
|
|
595
600
|
if (createMore.value) {
|
|
596
601
|
form.value?.reset();
|
|
@@ -187,6 +187,7 @@
|
|
|
187
187
|
:invite-member="true"
|
|
188
188
|
@cancel="dialogMember = false"
|
|
189
189
|
@success="handleSuccess"
|
|
190
|
+
@email-not-sent="showMessage($event, 'warning')"
|
|
190
191
|
@invited="getVerifications()"
|
|
191
192
|
:app="props.app"
|
|
192
193
|
/>
|
|
@@ -198,6 +199,7 @@
|
|
|
198
199
|
<script setup lang="ts">
|
|
199
200
|
// Relative import: this layer's `utils/` is not auto-imported into consumers.
|
|
200
201
|
import { invitationsEmptyText } from "../utils/invitations-empty-text";
|
|
202
|
+
import { inviteNotEmailedNotice } from "../utils/invite-email-notice";
|
|
201
203
|
import {
|
|
202
204
|
groupIds,
|
|
203
205
|
resendArgs,
|
|
@@ -432,8 +434,11 @@ async function onResend(item: any) {
|
|
|
432
434
|
if (resending.value) return;
|
|
433
435
|
resending.value = true;
|
|
434
436
|
try {
|
|
435
|
-
await inviteMemberClient(args);
|
|
436
|
-
|
|
437
|
+
const res = await inviteMemberClient(args);
|
|
438
|
+
// The invitation is re-issued either way; say when its e-mail failed (#1416).
|
|
439
|
+
const notice = inviteNotEmailedNotice(res);
|
|
440
|
+
if (notice) showMessage(notice, "warning");
|
|
441
|
+
else showMessage("Invitation re-sent (one e-mail).", "success");
|
|
437
442
|
await getVerifications();
|
|
438
443
|
} catch (error: any) {
|
|
439
444
|
showMessage(error?.data?.message || error?.message || "Failed to resend invitation", "error");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.722",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace #1416: Invite member / Resend used to get a 500 when the
|
|
3
|
+
* invitation was saved but its e-mail failed, so the dialog stayed open over
|
|
4
|
+
* an invitation that already existed. The API now answers 201 with
|
|
5
|
+
* `emailSent: false` and a message; this is the warning to show, or "" when
|
|
6
|
+
* the e-mail went out (or the API is older and does not say).
|
|
7
|
+
*/
|
|
8
|
+
export function inviteNotEmailedNotice(
|
|
9
|
+
res: { message?: string; emailSent?: boolean } | null | undefined,
|
|
10
|
+
): string {
|
|
11
|
+
if (res?.emailSent !== false) return "";
|
|
12
|
+
return (
|
|
13
|
+
res.message ||
|
|
14
|
+
"Invitation created, but the email could not be sent. Use Resend on the invitation to try again."
|
|
15
|
+
);
|
|
16
|
+
}
|