mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-20 14:32:57 +00:00
Fix google transfer ownership popup priority
Only show alertOwnershipToTransfer if: 1) current user is logged in 2) brew actually has authors 3) current user is not author[0] In all other cases, it should prompt to log in with a google account instead.
This commit is contained in:
@@ -160,7 +160,7 @@ const EditPage = (props)=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleGoogleClick = ()=>{
|
const handleGoogleClick = ()=>{
|
||||||
if(global.account !== currentBrew.authors[0]) {
|
if(currentBrew.authors.length > 0 && global.account?.username !== currentBrew.authors[0]) {
|
||||||
setAlertOwnershipToTransfer(true);
|
setAlertOwnershipToTransfer(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -264,12 +264,11 @@ const EditPage = (props)=>{
|
|||||||
<Nav.item className='googleDriveStorage' onClick={handleGoogleClick}>
|
<Nav.item className='googleDriveStorage' onClick={handleGoogleClick}>
|
||||||
<img src={googleDriveIcon} className={saveGoogle ? '' : 'inactive'} alt='Google Drive icon' />
|
<img src={googleDriveIcon} className={saveGoogle ? '' : 'inactive'} alt='Google Drive icon' />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{alertOwnershipToTransfer && (
|
{alertOwnershipToTransfer && (
|
||||||
<div className='errorContainer'>
|
<div className='errorContainer'>
|
||||||
You must be the Owner to transfer between the Homebrewery and Google Drive!
|
You must be the Owner to transfer between the Homebrewery and Google Drive!
|
||||||
The owner of this file is {currentBrew.authors[0]}
|
The owner of this file is {currentBrew.authors[0]}.
|
||||||
|
<br></br>
|
||||||
<div className='confirm' onClick={closeAlerts}> Okay </div>
|
<div className='confirm' onClick={closeAlerts}> Okay </div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user