0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-19 07:42:42 +00:00

hide usernames with emails

This commit is contained in:
Víctor Losada Hernández
2024-08-31 23:12:24 +02:00
parent bb08aed1a8
commit 47d8bb20d2
2 changed files with 32 additions and 21 deletions

View File

@@ -141,11 +141,17 @@ const BrewItem = createClass({
</> : <></> </> : <></>
} }
<span title={`Authors:\n${brew.authors?.join('\n')}`}> <span title={`Authors:\n${brew.authors?.join('\n')}`}>
<i className='fas fa-user'/> {brew.authors?.map((author, index)=>( <i className='fas fa-user'/>
<> {brew.authors?.map((author, index) => (
<a key={index} href={`/user/${author}`}>{author}</a> <React.Fragment key={index}>
{author === 'hidden' ? (
<span>{author}</span> // Render as plain text if the author's name is "hidden"
) : (
<a href={`/user/${author}`}>{author}</a> // Render as a link if not "hidden"
)}
{index < brew.authors.length - 1 && ', '} {index < brew.authors.length - 1 && ', '}
</>))} </React.Fragment>
))}
</span> </span>
<br /> <br />
<span title={`Last viewed: ${moment(brew.lastViewed).local().format(dateFormatString)}`}> <span title={`Last viewed: ${moment(brew.lastViewed).local().format(dateFormatString)}`}>

View File

@@ -440,13 +440,18 @@ const VaultPage = (props) => {
{`Brews found: `} {`Brews found: `}
<span>{totalBrews}</span> <span>{totalBrews}</span>
</span> </span>
{brewCollection.map((brew, index) => ( {brewCollection.map((brew, index) => {
const processedAuthors = brew.authors.map(author =>
author.includes('@') ? 'hidden' : author
);
return (
<BrewItem <BrewItem
brew={brew} brew={{ ...brew, authors: processedAuthors }}
key={index} key={index}
reportError={props.reportError} reportError={props.reportError}
/> />
))} );
})}
{renderPaginationControls()} {renderPaginationControls()}
</div> </div>
); );