Fixed mastodon checkbox on new entry page
This commit is contained in:
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user