Owner upgrade alerts go to email only, not Telegram

The private 'upgrade #N soon' owner alert was firing to both email and the
Telegram feed; Marty wants it in his inbox only. Drop the sendTelegram call
(the email on the line above already covers every owner watcher). Payout and
recruiting Telegram feeds are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-17 15:19:29 -05:00
parent 1695f712c6
commit 99378daf01
+3 -4
View File
@@ -636,8 +636,8 @@ const ALERT_SECRET = crypto.createHash('sha256').update('rmc-alerts::'+ADMIN_PAS
function unsubToken(id){ return crypto.createHmac('sha256',ALERT_SECRET).update('unsub:'+String(id)).digest('hex').slice(0,24); }
function unsubUrl(id){ return `https://rmcircle.team/unsubscribe?id=${id}&t=${unsubToken(id)}`; }
function maskEmail(e){ const i=String(e).indexOf('@'); if(i<1)return '•••'; return e[0]+'•••'+e.slice(i); }
// Upgrade-need alerts for both owner positions (email+Telegram) and any member
// who opted in via their dashboard (email only). Runs every 5 min from state.
// Upgrade-need alerts — EMAIL ONLY — for owner positions (config.ownerAlertEmail)
// and for any member who opted in via their dashboard. Runs every 5 min from state.
function checkUpgradeAlerts(){
try{
const c=getConfig();
@@ -649,7 +649,7 @@ function checkUpgradeAlerts(){
if(!ids.length) return;
const res=chain.getOwnerUpgradeNeeds(ids);
if(!res.ready) return;
const alerted=loadOwnerAlerts(); const active=new Set(); const tgDone=new Set();
const alerted=loadOwnerAlerts(); const active=new Set();
for(const n of res.needs){
const who=n.members.map(m=>'#'+m).join(', ');
const action=n.reason==='qualify'?`Position #${n.id} needs its 2 directs to catch this.`:`Upgrade position #${n.id} (now ${n.levelName}) to ${n.neededLevelName} to catch it.`;
@@ -660,7 +660,6 @@ function checkUpgradeAlerts(){
sendEmailRaw(w.email,
`RM Circle: upgrade #${n.id} to ${n.neededLevelName}${n.amountAtRisk} POL incoming`,
`Heads up — position #${n.id} has money about to arrive it can't catch yet.\n\n#${n.id} is at ${n.levelName}. ${who} ${n.members.length===1?'is':'are'} ONE upgrade away from paying #${n.id} about ${n.amountAtRisk} POL — but that only stops at #${n.id} if it's at ${n.neededLevelName} and qualified.\n\n${action}\n\nDo it before they upgrade, or the payment passes to the next eligible position above (it doesn't come back).${unsub}\n\n— RM Circle auto-watch`);
if(w.owner&&!tgDone.has(n.id+':'+n.neededLevel)){ tgDone.add(n.id+':'+n.neededLevel); sendTelegram(`⏫ UPGRADE #${n.id} SOON: ${who} one upgrade from paying ~${n.amountAtRisk} POL. #${n.id} is ${n.levelName} — needs ${n.neededLevelName}${n.reason==='qualify'?' + 2 directs':''}. Upgrade before they do.`); }
}
}
let changed=false;