mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-04 05:43:10 +00:00
fix: author verification
This commit is contained in:
parent
c8aa4878ca
commit
1d5015d7d6
@ -9,13 +9,16 @@ interface LinkRendererProps {
|
|||||||
* Component that renders text with clickable links
|
* Component that renders text with clickable links
|
||||||
* Detects URLs and converts them to clickable <a> tags
|
* Detects URLs and converts them to clickable <a> tags
|
||||||
*/
|
*/
|
||||||
export const LinkRenderer: React.FC<LinkRendererProps> = ({ text, className }) => {
|
export const LinkRenderer: React.FC<LinkRendererProps> = ({
|
||||||
|
text,
|
||||||
|
className,
|
||||||
|
}) => {
|
||||||
// URL regex pattern that matches http/https URLs
|
// URL regex pattern that matches http/https URLs
|
||||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||||
|
|
||||||
// Split text by URLs and create array of text segments and URLs
|
// Split text by URLs and create array of text segments and URLs
|
||||||
const parts = text.split(urlRegex);
|
const parts = text.split(urlRegex);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={className}>
|
<span className={className}>
|
||||||
{parts.map((part, index) => {
|
{parts.map((part, index) => {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import {
|
|||||||
import { localDatabase } from '@/lib/database/LocalDatabase';
|
import { localDatabase } from '@/lib/database/LocalDatabase';
|
||||||
import { useAppKitAccount, useDisconnect, modal } from '@reown/appkit/react';
|
import { useAppKitAccount, useDisconnect, modal } from '@reown/appkit/react';
|
||||||
|
|
||||||
// Removed VerificationStatus type - using EVerificationStatus enum directly
|
|
||||||
|
|
||||||
interface AuthContextType {
|
interface AuthContextType {
|
||||||
currentUser: User | null;
|
currentUser: User | null;
|
||||||
|
|||||||
@ -284,18 +284,12 @@ export class RelevanceCalculator {
|
|||||||
return { bonus: 0, isVerified: false };
|
return { bonus: 0, isVerified: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply different bonuses based on verification level
|
// Apply different bonuses based on verification signals from UserVerificationStatus
|
||||||
|
// Full bonus if author owns ENS or Ordinal. Otherwise, if merely verified (wallet connected), apply basic bonus
|
||||||
let bonus = 0;
|
let bonus = 0;
|
||||||
if (
|
if (authorStatus?.hasENS || authorStatus?.hasOrdinal) {
|
||||||
authorStatus?.verificationStatus ===
|
|
||||||
EVerificationStatus.ENS_ORDINAL_VERIFIED
|
|
||||||
) {
|
|
||||||
// Full bonus for ENS/Ordinal owners
|
|
||||||
bonus = score * (RelevanceCalculator.VERIFICATION_BONUS - 1);
|
bonus = score * (RelevanceCalculator.VERIFICATION_BONUS - 1);
|
||||||
} else if (
|
} else if (authorStatus?.isVerified) {
|
||||||
authorStatus?.verificationStatus === EVerificationStatus.WALLET_CONNECTED
|
|
||||||
) {
|
|
||||||
// Lower bonus for basic verified users
|
|
||||||
bonus = score * (RelevanceCalculator.BASIC_VERIFICATION_BONUS - 1);
|
bonus = score * (RelevanceCalculator.BASIC_VERIFICATION_BONUS - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,9 @@ export default function ProfilePage() {
|
|||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
const [callSign, setCallSign] = useState('');
|
const [callSign, setCallSign] = useState('');
|
||||||
const [displayPreference, setDisplayPreference] = useState(EDisplayPreference.WALLET_ADDRESS);
|
const [displayPreference, setDisplayPreference] = useState(
|
||||||
|
EDisplayPreference.WALLET_ADDRESS
|
||||||
|
);
|
||||||
const [walletWizardOpen, setWalletWizardOpen] = useState(false);
|
const [walletWizardOpen, setWalletWizardOpen] = useState(false);
|
||||||
|
|
||||||
// Initialize and update local state when user data changes
|
// Initialize and update local state when user data changes
|
||||||
@ -67,8 +69,11 @@ export default function ProfilePage() {
|
|||||||
if (currentUser) {
|
if (currentUser) {
|
||||||
// Use the same data source as the display (userInfo) for consistency
|
// Use the same data source as the display (userInfo) for consistency
|
||||||
const currentCallSign = userInfo.callSign || currentUser.callSign || '';
|
const currentCallSign = userInfo.callSign || currentUser.callSign || '';
|
||||||
const currentDisplayPreference = userInfo.displayPreference || currentUser.displayPreference || EDisplayPreference.WALLET_ADDRESS;
|
const currentDisplayPreference =
|
||||||
|
userInfo.displayPreference ||
|
||||||
|
currentUser.displayPreference ||
|
||||||
|
EDisplayPreference.WALLET_ADDRESS;
|
||||||
|
|
||||||
setCallSign(currentCallSign);
|
setCallSign(currentCallSign);
|
||||||
setDisplayPreference(currentDisplayPreference);
|
setDisplayPreference(currentDisplayPreference);
|
||||||
}
|
}
|
||||||
@ -174,8 +179,11 @@ export default function ProfilePage() {
|
|||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
// Reset to the same data source as display for consistency
|
// Reset to the same data source as display for consistency
|
||||||
const currentCallSign = userInfo.callSign || currentUser.callSign || '';
|
const currentCallSign = userInfo.callSign || currentUser.callSign || '';
|
||||||
const currentDisplayPreference = userInfo.displayPreference || currentUser.displayPreference || EDisplayPreference.WALLET_ADDRESS;
|
const currentDisplayPreference =
|
||||||
|
userInfo.displayPreference ||
|
||||||
|
currentUser.displayPreference ||
|
||||||
|
EDisplayPreference.WALLET_ADDRESS;
|
||||||
|
|
||||||
setCallSign(currentCallSign);
|
setCallSign(currentCallSign);
|
||||||
setDisplayPreference(currentDisplayPreference);
|
setDisplayPreference(currentDisplayPreference);
|
||||||
setIsEditing(false);
|
setIsEditing(false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user