mirror of
https://github.com/makeplane/plane.git
synced 2026-05-04 06:59:41 -05:00
refactor: improve cover image upload handling and documentation
- Updated comments in the cover image helper to clarify the upload process for local static images. - Simplified the return logic for both user and project assets, ensuring immediate UI feedback with the uploaded URL. - Enhanced clarity on how the backend auto-links assets based on the entity identifier.
This commit is contained in:
@@ -255,25 +255,21 @@ export const handleCoverImageChange = async (
|
||||
};
|
||||
}
|
||||
|
||||
// Local static image - needs upload
|
||||
// Local static image - needs upload first
|
||||
if (analysis.needsUpload) {
|
||||
const uploadedUrl = await uploadCoverImage(newImage, uploadConfig);
|
||||
|
||||
// For BOTH user assets AND project assets:
|
||||
// The backend auto-links when entity_identifier is set correctly
|
||||
// For project assets: auto-linked server-side, no payload needed
|
||||
// For user assets: return URL for immediate UI feedback
|
||||
|
||||
if (uploadConfig.isUserAsset) {
|
||||
return {
|
||||
cover_image_url: uploadedUrl,
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
// Backend auto-links the asset when entity_identifier is set correctly.
|
||||
// We still return the URL for immediate UI feedback regardless of asset type.
|
||||
return {
|
||||
cover_image_url: uploadedUrl,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
// Already an uploaded URL (e.g., from Unsplash or gallery) - just update the reference
|
||||
return {
|
||||
cover_image_url: newImage,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user