Fixed mastodon checkbox on new entry page

This commit is contained in:
2026-08-27 22:08:30 +02:00
parent 1c2d1b71ff
commit d433a305f5
10 changed files with 65 additions and 6 deletions
+6 -1
View File
@@ -24,6 +24,7 @@ class LinkCreate(BaseModel):
comment: str = ''
timestamp: str | None = None
tags: list[str] = []
post_to_mastodon: bool = True
class LinkUpdate(BaseModel):
@@ -89,7 +90,11 @@ def create_link_endpoint(payload: LinkCreate, response: Response, authorization:
raise HTTPException(status_code=422, detail=str(error)) from error
if duplicate:
response.status_code = status.HTTP_200_OK
plugin_results = plugin_manager.dispatch({'type': 'link_created', **record})
plugin_results = plugin_manager.dispatch({
'type': 'link_created',
'post_to_mastodon': payload.post_to_mastodon,
**record,
})
mastodon_result = next((result for result in plugin_results if result.get('plugin') == 'mastodon'), None)
if mastodon_result and mastodon_result.get('status') == 'posted':
mark_mastodon_posted(record['id'], info['user_id'], mastodon_result.get('post_id'))