Report-an-ad dialog: site dialog with no default reason (was a native prompt pre-filled with "broken")

Campaign #27 (house AdRevSplit text ad) was reported "broken" with no note while the target framed
and loaded fine; the report dialog was prompt() with 'broken' as the default value, so one stray OK
filed it. Now IAP.ask with an explicit, validated reason and an optional note; common.js tag bumped
on all pages.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-16 10:21:53 -05:00
parent 69d672665c
commit 616f328db5
17 changed files with 27 additions and 21 deletions
+1 -1
View File
@@ -486,7 +486,7 @@
</div>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/admin.js?v=20260915a"></script>
</body>
</html>
+11 -5
View File
@@ -110,12 +110,18 @@ window.IAP = (function () {
}
// Render one served ad into #<elId>. Silent if no inventory.
// report an ad (auto-approved ads need a member-facing flag → admin notified)
function reportAd(campaignId) {
// 2026-09-16: was a native prompt() with 'broken' pre-filled, so a stray tap on OK filed a
// "broken" report with no note (campaign #27). Now the site dialog, no default, reason validated.
const REPORT_REASONS = ['broken', 'inappropriate', 'spam', 'scam', 'other'];
async function reportAd(campaignId) {
if (!campaignId) return;
const reason = (prompt('Report this ad. Reason: broken, inappropriate, spam, scam, or other', 'broken') || '').trim().toLowerCase();
if (!reason) return;
const note = prompt('Anything to add? (optional)') || '';
fetch('/api/report-ad', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ campaignId, reason, note }) })
const raw = await ask({ title: 'Report this ad', text: 'What is wrong with it? Type one: broken, inappropriate, spam, scam, or other.', placeholder: 'e.g. broken', ok: 'Next' });
if (raw === null) return;
const reason = String(raw || '').trim().toLowerCase();
if (!REPORT_REASONS.includes(reason)) { status('Pick one of: broken, inappropriate, spam, scam, or other.', 'bad'); return; }
const note = await ask({ title: 'Report: ' + reason, text: 'Tell the admin what you saw, so it can be fixed. Optional, but it helps.', type: 'textarea', ok: 'Send report' });
if (note === null) return;
fetch('/api/report-ad', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ campaignId, reason, note: String(note || '').slice(0, 500) }) })
.then(() => status('Thanks — this ad was reported to the admin for review.', 'ok'))
.catch(() => status('Could not send the report. Try again.', 'bad'));
}
+1 -1
View File
@@ -141,7 +141,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/contract.js?v=20260908p"></script>
<script src="/assets/chat.js?v=20260906m"></script>
</body>
+1 -1
View File
@@ -26,7 +26,7 @@
<p class="muted small">You decide whether, and how much, to spend. Never spend more than you can afford to lose.</p>
</div>
</div></section>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/legal.js?v=20260908a"></script>
</body>
</html>
+1 -1
View File
@@ -68,6 +68,6 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
</body>
</html>
+1 -1
View File
@@ -481,7 +481,7 @@
</div>
</section>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/wallet.js?v=20260909c"></script>
<script src="/assets/home.js?v=20260915b"></script>
<script src="/assets/chat.js?v=20260906m"></script>
+1 -1
View File
@@ -157,7 +157,7 @@
InstantAdPay · <a href="/contract">Contract</a> · <a href="/terms">Terms</a> · <a href="/privacy">Privacy</a> · <a href="/disclaimer">Disclaimer</a>
</div>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/join.js?v=20260914a"></script>
</body>
</html>
+1 -1
View File
@@ -104,7 +104,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/launch.js?v=20260915b"></script>
</body>
</html>
+1 -1
View File
@@ -37,7 +37,7 @@
<div>InstantAdPay · <a href="/">how it works</a> · <a id="contractLink" href="#" target="_blank" rel="noopener">contract source ↗</a></div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/ledger.js?v=20260906m"></script>
<script src="/assets/chat.js?v=20260906m"></script>
</body>
+1 -1
View File
@@ -1019,7 +1019,7 @@
</div>
</div>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20260911a"></script>
<script src="/assets/my.js?v=20260916c"></script>
+1 -1
View File
@@ -128,7 +128,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford to lose.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/partners.js?v=20260914a"></script>
</body>
</html>
+1 -1
View File
@@ -192,7 +192,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/plays.js?v=20260910b"></script>
</body>
</html>
+1 -1
View File
@@ -28,7 +28,7 @@
<p class="muted small">We use reasonable safeguards, but no system is perfectly secure. Protect your email and your wallet.</p>
</div>
</div></section>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/legal.js?v=20260908a"></script>
</body>
</html>
+1 -1
View File
@@ -36,7 +36,7 @@
<p class="muted small" style="margin-top:18px">See also the <a href="/disclaimer">Disclaimer</a> and <a href="/privacy">Privacy Policy</a>.</p>
</div>
</div></section>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/legal.js?v=20260908a"></script>
</body>
</html>
+1 -1
View File
@@ -34,7 +34,7 @@
<p><a href="/ledger">← Back to the live ledger</a> · <a href="/contract">Read the contract review</a></p>
</div>
</section>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/tx.js?v=20260906m"></script>
</body>
</html>
+1 -1
View File
@@ -47,7 +47,7 @@
</div>
</div>
</section>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/wall.js?v=20260911v"></script>
</body>
</html>
+1 -1
View File
@@ -121,7 +121,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never share your recovery phrase.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260914a"></script>
<script src="/assets/common.js?v=20260916a"></script>
<script src="/assets/wallets.js?v=20260911b"></script>
</body>
</html>