Skip to content

Feat : promotion improvements#205

Merged
samarth30 merged 3 commits intofeat/promotionfrom
feat/promotion-improvements
Jan 9, 2026
Merged

Feat : promotion improvements#205
samarth30 merged 3 commits intofeat/promotionfrom
feat/promotion-improvements

Conversation

@samarth30
Copy link
Copy Markdown
Contributor

@samarth30 samarth30 commented Jan 9, 2026

This pull request introduces two main sets of changes: (1) it adds support for uploading and deleting promotional assets (such as images) for apps, including both backend server actions and frontend UI integration, and (2) it centralizes and standardizes automation configuration defaults across Discord, Telegram, and Twitter services. Additionally, it refines the Discord status API to distinguish between OAuth configuration and bot token presence.

Key changes include:

Promotional Asset Upload & Management

  • Adds server actions in app/actions/apps.ts for uploading and deleting promotional assets, with file validation, ownership checks, and blob storage integration.
  • Updates the AppPromote component to allow users to upload, display, and delete promotional images, including UI feedback and local state management for assets. [1] [2] [3]

Automation Configuration Standardization

  • Introduces lib/services/automation-constants.ts to centralize default configuration values and helper functions for Discord, Telegram, and Twitter automations.
  • Refactors Discord automation service to use these shared defaults and helpers, removing duplicated logic and ensuring consistency. [1] [2] [3] [4] [5]

Discord Status API Improvements

  • Refines the Discord status API endpoint to distinguish between OAuth configuration (for adding the bot to servers) and bot token presence (for sending messages), improving error messaging and status reporting. [1] [2]

These changes improve the user experience around app promotion and asset management, reduce code duplication in automation services, and clarify Discord integration status for organizations.


Note

Adds promotional asset management and standardizes automation config defaults while refining social integration status handling.

  • Promotional assets: New server actions uploadPromotionalAsset/deletePromotionalAsset with validation/blob storage; AppPromote UI to upload, preview, and delete assets with local state and toasts
  • Shared automation defaults: Introduces lib/services/automation-constants.ts and applies to Discord/Telegram services to remove duplicated default logic and use helpers
  • Discord status API: Splits OAuth availability (isOAuthConfigured) from message capability (canSendMessages) and updates /api/v1/discord/status
  • Automation services: Discord/Telegram app automation now use shared defaults; adds isAnnouncementDue to Telegram; minor improvements to promo image selection
  • Telegram status caching: Caches getConnectionStatus results with cache invalidation on credential changes

Written by Cursor Bugbot for commit ae86f83. This will update automatically on new commits. Configure here.

…nstants and improved configuration handling

- Introduced automation-constants.ts to centralize default configuration values for Discord, Telegram, and Twitter.
- Updated Discord automation service to utilize new constants and improve OAuth configuration checks.
- Enhanced Telegram automation service with configuration defaults and announcement scheduling logic.
- Improved error handling and caching mechanisms for connection status in both Discord and Telegram services.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
eliza-cloud-v2 Building Building Preview, Comment Jan 9, 2026 2:57pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 9, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@samarth30 samarth30 merged commit ce393a1 into feat/promotion Jan 9, 2026
3 of 4 checks passed
const [showPromptInput, setShowPromptInput] = useState(false);
const [isUploadingAsset, setIsUploadingAsset] = useState(false);
const [deletingAssetUrl, setDeletingAssetUrl] = useState<string | null>(null);
const [localAssets, setLocalAssets] = useState(app.promotional_assets || []);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Local assets state not synced with prop changes

Medium Severity

The localAssets state is initialized from app.promotional_assets only once when the component mounts, but there's no useEffect to synchronize it when the app prop changes. If the parent component re-renders with updated app data (e.g., after navigation, external changes, or data refetch), the UI will continue displaying stale assets instead of the current values from the prop. This can cause assets to appear present after deletion or missing after being added elsewhere.

Fix in Cursor Fix in Web

Comment thread app/actions/apps.ts

await appsService.update(appId, {
promotional_assets: updatedAssets,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition in concurrent asset operations causes data loss

Medium Severity

Both uploadPromotionalAsset and deletePromotionalAsset use a read-modify-write pattern without atomic operations. The code reads promotional_assets, modifies the array in memory, then writes the entire array back. If two requests execute concurrently (e.g., user uploads from two tabs, or rapid sequential operations), the second write overwrites the first, silently losing data. For uploads, one asset can vanish; for deletes, an asset intended for deletion may be restored while another is incorrectly removed.

Additional Locations (1)

Fix in Cursor Fix in Web

setIsUploadingAsset(false);
if (assetInputRef.current) {
assetInputRef.current.value = "";
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing try/catch leaves UI stuck in loading state

Medium Severity

The handleAssetUpload and handleAssetDelete functions set loading state (setIsUploadingAsset(true) and setDeletingAssetUrl(...)) before calling server actions but lack try/catch blocks. Unlike the existing handleGenerateAssets and handlePostNow functions which properly wrap their async calls in try/catch, these handlers will never reset their loading state if the server action throws (e.g., network failure). This leaves upload/delete buttons permanently disabled until the user refreshes the page.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant