feat: stateless federated identity resolver + federation UX improvements
Add identity.ts with isSelf() and resolveDisplayIdentity() — pure stateless functions that detect replicated-self using the immutable (username, homeInstance) composite key. No store lookups, no data mutation. Fixes wrong avatar gradient and missing edit/delete on own messages in remote channels. Also includes: optimistic message dedup fix for cross-instance messages (content-only matching), federation toast notifications, Username component with @domain display, invite parser, and deploy script simplification.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Tooltip } from './Tooltip';
|
||||
|
||||
interface UsernameProps {
|
||||
username: string;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
|
||||
export function Username({ username, className, style }: UsernameProps) {
|
||||
const atIndex = username.indexOf('@');
|
||||
if (atIndex === -1) {
|
||||
return <span className={className} style={style}>{username}</span>;
|
||||
}
|
||||
const name = username.slice(0, atIndex);
|
||||
const domain = username.slice(atIndex + 1);
|
||||
return (
|
||||
<Tooltip content={username} position="top">
|
||||
<span className={className} style={style}>
|
||||
{name}
|
||||
<span className="text-txt-tertiary text-[0.8em] ml-0.5 font-normal">@{domain}</span>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user