Add verification questions, claim flow and scam warnings

- post form: up to 3 verification questions (loss and found) and a
  "how not to get scammed" note; sent as verificationQuestions JSON
- feed card: "I found it" / "It's mine" instead of "Write" for posts with
  questions; phone shows "after check" until the author approves
- chat draft shows ClaimForm; VerificationPanel lets the author approve or
  reject answers and locks the claimant's input until approval, then offers
  the author's phone
- messages: claim answers card, verification system line, fraudSignal
  warnings for the recipient; ChatSafetyNotice with new-account mark
- tests, README

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
SlimusMinus
2026-11-11 01:04:55 +03:00
parent 133becd255
commit 3dd174afa5
20 changed files with 811 additions and 23 deletions

View File

@@ -115,7 +115,13 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
// своего объявления тоже, чтобы видеть то же, что покупатель.
// У закрытого объявления номер не показывается: вещь уже вернулась.
const shownPhone = ad.phone || phoneReveal.phone;
const canRevealPhone = !shownPhone && ad.phoneVisible && !isClosed;
// Объявление с контрольными вопросами: написать — только ответив на них, а номер
// открывается заявителю после подтверждения ответов (в чате). Автор свой номер видит.
// У потери это отсекает «нашёл, оплатите доставку», у находки — «это моё» по фото.
const needsVerification = !isOwnAd
&& Array.isArray(ad.verificationQuestions) && ad.verificationQuestions.length > 0;
const canRevealPhone = !shownPhone && ad.phoneVisible && !isClosed && !needsVerification;
const phoneAfterVerification = !shownPhone && ad.phoneVisible && !isClosed && needsVerification;
const headAccentClass = ad.type === "found" ? " f-head-found" : " f-head-loss";
@@ -321,16 +327,29 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
{!compact && (
<div className="f-card-meta">
{rewardButton}
{needsVerification && !isClosed && (
<span className="f-card-verify-pill" title={t('postCard.phoneAfterVerificationHint')}>
🛡️ {t('postCard.verifiedClaims')}
</span>
)}
</div>
)}
<div className="f-card-foot">
<div className="f-card-foot-left">
{shownPhone ? (
<a className="f-card-phone" href={`tel:${shownPhone}`}
onClick={e => e.stopPropagation()}>
<PhoneIcon/> {shownPhone}
</a>
<div className="f-card-phone-wrap">
<a className="f-card-phone" href={`tel:${shownPhone}`}
onClick={e => e.stopPropagation()}>
<PhoneIcon/> {shownPhone}
</a>
{/* Номер открыл не автор — напоминаем о главной схеме мошенников */}
{!ad.phone && <span className="f-card-phone-hint">{t('postCard.phoneSafetyHint')}</span>}
</div>
) : phoneAfterVerification ? (
<span className="f-card-phone f-card-phone-locked" title={t('postCard.phoneAfterVerificationHint')}>
<PhoneIcon/> {t('postCard.phoneAfterVerification')}
</span>
) : canRevealPhone && (
<button type="button" className="f-card-phone f-card-phone-reveal"
disabled={phoneReveal.loading}
@@ -349,7 +368,8 @@ export default function PostOnFeed({ ad, onEdit, onDelete, onMarkFound, onReopen
) : !hideContact && (
<button type="button" className="f-card-contact"
onClick={handleContact}>
{t('postCard.write')}
{!needsVerification ? t('postCard.write')
: ad.type === "found" ? t('postCard.claimItem') : t('postCard.claimFound')}
</button>
)}
</div>