Don't show byline if card posted by author themselves

This commit is contained in:
Lim Chee Aun 2024-09-22 13:53:18 +08:00
parent bbe276e18c
commit fd5e574e70
2 changed files with 11 additions and 5 deletions

View file

@ -1991,9 +1991,11 @@ a.card:is(:hover, :focus):visited {
flex-direction: column-reverse;
}
.card-byline-author {
display: inline-block;
display: inline-flex;
gap: 4px;
color: var(--text-insignificant-color);
padding: 0 8px;
padding: 2px 8px;
align-items: center;
.avatar {
width: 16px !important;

View file

@ -2152,6 +2152,9 @@ function Status({
selfReferential={
card?.url === status.url || card?.url === status.uri
}
selfAuthor={card?.authors?.some(
(a) => a.account?.url === accountURL,
)}
instance={currentInstance}
/>
)}
@ -2564,7 +2567,8 @@ function isCardPost(domain) {
return ['x.com', 'twitter.com', 'threads.net', 'bsky.app'].includes(domain);
}
function Byline({ authors, children }) {
function Byline({ authors, hidden, children }) {
if (hidden) return children;
if (!authors?.[0]?.account?.id) return children;
const author = authors[0].account;
@ -2583,7 +2587,7 @@ function Byline({ authors, children }) {
);
}
function Card({ card, selfReferential, instance }) {
function Card({ card, selfReferential, selfAuthor, instance }) {
const snapStates = useSnapshot(states);
const {
blurhash,
@ -2697,7 +2701,7 @@ function Card({ card, selfReferential, instance }) {
const isPost = isCardPost(domain);
return (
<Byline authors={authors}>
<Byline hidden={!!selfAuthor} authors={authors}>
<a
href={cardStatusURL || url}
target={cardStatusURL ? null : '_blank'}