Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

refactor(post): remove now-dead PostAction::AlreadyPublished

Paulo Castellanoedec58af81c9
diff --git a/app/Enums/Post/Action.php b/app/Enums/Post/Action.php
index b781b03f4..521c99d3e 100644
--- a/app/Enums/Post/Action.php
+++ b/app/Enums/Post/Action.php
@@ -6,7 +6,6 @@ namespace App\Enums\Post;
enum Action: string
{
- case AlreadyPublished = 'already_published';
case Finalized = 'finalized';
case Publishing = 'publishing';
case Scheduled = 'scheduled';
diff --git a/app/Http/Controllers/Api/PostController.php b/app/Http/Controllers/Api/PostController.php
index 23296b92a..c662d53d8 100644
--- a/app/Http/Controllers/Api/PostController.php
+++ b/app/Http/Controllers/Api/PostController.php
@@ -67,7 +67,7 @@ class PostController extends Controller
$result = UpdatePost::execute($request->user()->currentWorkspace, $post, $request->validated());
- if (in_array(data_get($result, 'action'), [PostAction::AlreadyPublished, PostAction::Finalized], true)) {
+ if (data_get($result, 'action') === PostAction::Finalized) {
return response()->json(
['message' => 'Cannot edit a published post.'],
Response::HTTP_UNPROCESSABLE_ENTITY
diff --git a/app/Http/Controllers/App/PostController.php b/app/Http/Controllers/App/PostController.php
index 051b38658..e02dbe953 100644
--- a/app/Http/Controllers/App/PostController.php
+++ b/app/Http/Controllers/App/PostController.php
@@ -282,13 +282,6 @@ class PostController extends Controller
$action = data_get($result, 'action');
- if ($action === PostAction::AlreadyPublished) {
- session()->flash('flash.banner', __('posts.flash.cannot_edit_published'));
- session()->flash('flash.bannerStyle', 'danger');
-
- return back();
- }
-
if ($action === PostAction::Finalized) {
session()->flash('flash.banner', __('posts.flash.cannot_edit_finalized'));
session()->flash('flash.bannerStyle', 'danger');
diff --git a/app/Mcp/Tools/Post/PublishPostTool.php b/app/Mcp/Tools/Post/PublishPostTool.php
index d69904d9a..993fb434d 100644
--- a/app/Mcp/Tools/Post/PublishPostTool.php
+++ b/app/Mcp/Tools/Post/PublishPostTool.php
@@ -47,7 +47,7 @@ class PublishPostTool extends Tool
'scheduled_at' => $scheduledAt,
]);
- if (in_array(data_get($result, 'action'), [PostAction::AlreadyPublished, PostAction::Finalized], true)) {
+ if (data_get($result, 'action') === PostAction::Finalized) {
return Response::error('Post is already published or in a terminal state.');
}
diff --git a/app/Mcp/Tools/Post/UpdatePostTool.php b/app/Mcp/Tools/Post/UpdatePostTool.php
index b36f16135..6062a7227 100644
--- a/app/Mcp/Tools/Post/UpdatePostTool.php
+++ b/app/Mcp/Tools/Post/UpdatePostTool.php
@@ -54,7 +54,7 @@ class UpdatePostTool extends Tool
$result = UpdatePost::execute($workspace, $post, $payload);
- if (in_array(data_get($result, 'action'), [PostAction::AlreadyPublished, PostAction::Finalized], true)) {
+ if (data_get($result, 'action') === PostAction::Finalized) {
return Response::error('Cannot edit a published post.');
}