aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/group-settings.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/group-settings.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js b/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js
index 4f55dfb..1c6ca71 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/group-settings.js
@@ -793,7 +793,21 @@ function GroupSettingsPanel({ groupId, group, token, transportRef, gekRef,
method: 'POST', token, body: {},
});
- setInviteCode({ username, code: result.code, expires: result.expires_at });
+ // Send an email notification to the invitee with the code.
+ // The hub decrypts their email server-side — the inviter never sees it.
+ let emailStatus = 'no_email';
+ try {
+ const notif = await hubFetch(`/v1/groups/${groupId}/invite-notify`, {
+ method: 'POST', token,
+ body: { username, code: result.code, group_name: group?.name || '' },
+ });
+ emailStatus = notif.status;
+ } catch { /* best effort */ }
+
+ setInviteCode({
+ username, code: result.code, expires: result.expires_at,
+ emailSent: emailStatus === 'sent',
+ });
setInviteUser('');
loadMembers();
} catch (err) {
@@ -831,6 +845,10 @@ function GroupSettingsPanel({ groupId, group, token, transportRef, gekRef,
<div class="success-msg" style="margin-bottom:8px">
<p>${t('members.invite_code_ready', { user: inviteCode.username })}</p>
<p class="code-display">${inviteCode.code}</p>
+ ${inviteCode.emailSent
+ ? html`<p style="color:var(--success)">${t('members.invite_email_sent')}</p>`
+ : html`<p style="color:var(--text-dim)">${t('members.invite_email_failed')}</p>`
+ }
<p>${t('members.invite_code_hint')}</p>
</div>
`}