Members can change their username and email: in-place profile card replaces the separate alert-email opt-in for signed-in owners
The first-time gate cannot be dismissed; editing later can. The 'Email me my alerts' card becomes 'Your member profile' for a signed-in owner, showing the username and confirmed email with Change buttons, so the verified address is the one source of truth for both messaging and payout alerts. Visitors and non-owners keep the original opt-in form unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -622,6 +622,28 @@
|
||||
async function renderAlerts(d){
|
||||
const el=document.getElementById('dAlerts');
|
||||
if(!el)return;
|
||||
// A signed-in owner manages ONE identity here: the verified profile email is
|
||||
// the alert address, and both it and the username are editable in place.
|
||||
// Everyone else keeps the original opt-in form, so nothing existing breaks.
|
||||
try{
|
||||
const pr=window.RMCProfile?await window.RMCProfile.status():null;
|
||||
if(pr&&pr.signedIn!==false&&Number(pr.id)===Number(d.id)&&pr.profile&&pr.profile.complete){
|
||||
const hd=document.getElementById('dAlertsHead'),intro=document.getElementById('dAlertsIntro');
|
||||
if(hd)hd.textContent='Your member profile';
|
||||
if(intro)intro.innerHTML='How your team leader reaches you, and where your payout alerts go. Your email is never shown to other members and never sold.';
|
||||
el.innerHTML=`<div style="display:flex;flex-wrap:wrap;gap:10px 22px;align-items:center;margin:0 0 12px">`+
|
||||
`<div><div class="micro" style="color:var(--muted)">Username</div><div style="font-weight:700">@${esc(pr.profile.username)}</div></div>`+
|
||||
`<div><div class="micro" style="color:var(--muted)">Email <span style="color:var(--ok)">✓ confirmed</span></div><div style="font-weight:700">${esc(pr.profile.email)}</div></div>`+
|
||||
`</div><button id="pgEditUser" class="btn btn-secondary btn-sm">Change username</button> `+
|
||||
`<button id="pgEditMail" class="btn btn-secondary btn-sm" style="margin-left:6px">Change email</button>`+
|
||||
`<p class="micro" style="margin:10px 0 0;color:var(--muted)">Payout alerts go to this address. Changing it here changes both.</p>`;
|
||||
const again=()=>renderAlerts(d);
|
||||
const bu=document.getElementById('pgEditUser'),bm=document.getElementById('pgEditMail');
|
||||
if(bu)bu.addEventListener('click',async()=>{await window.RMCProfile.edit('username');again();});
|
||||
if(bm)bm.addEventListener('click',async()=>{await window.RMCProfile.edit('email');again();});
|
||||
return;
|
||||
}
|
||||
}catch(e){}
|
||||
let st={subscribed:false};
|
||||
try{st=await (await fetch('/api/public/alert-status?id='+d.id)).json();}catch(e){}
|
||||
function subscribedView(email){
|
||||
|
||||
Reference in New Issue
Block a user