disappearing interface after link safe
This commit is contained in:
@@ -76,7 +76,12 @@ def create_link_endpoint(payload: LinkCreate, response: Response, authorization:
|
||||
mark_mastodon_posted(record['id'], info['user_id'], mastodon_result.get('post_id'))
|
||||
if any(result.get('status') == 'failed' for result in plugin_results):
|
||||
logger.warning('One or more plugins failed for link_id=%s results=%s', record['id'], plugin_results)
|
||||
return {**record, 'duplicate': duplicate}
|
||||
plugin_errors = [
|
||||
{'plugin': result.get('plugin', 'unknown'), 'reason': result.get('reason', 'Plugin failed')}
|
||||
for result in plugin_results
|
||||
if result.get('status') == 'failed'
|
||||
]
|
||||
return {**record, 'duplicate': duplicate, 'plugin_errors': plugin_errors}
|
||||
|
||||
|
||||
@router.put('/links/{link_id}')
|
||||
|
||||
@@ -454,6 +454,18 @@ def test_duplicate_link_check_is_authenticated_and_detects_existing_entry():
|
||||
assert check.json()['exists'] is True
|
||||
|
||||
|
||||
def test_link_save_reports_plugin_posting_errors():
|
||||
with patch('backend.app.api.links.plugin_manager.dispatch', return_value=[
|
||||
{'status': 'failed', 'plugin': 'mastodon', 'reason': 'HTTP 503: unavailable'},
|
||||
]):
|
||||
response = client.post('/api/links', headers=login_headers(), json={
|
||||
'title': 'Plugin error report',
|
||||
'url': 'https://example.com/plugin-error-report',
|
||||
})
|
||||
assert response.status_code == 201
|
||||
assert response.json()['plugin_errors'] == [{'plugin': 'mastodon', 'reason': 'HTTP 503: unavailable'}]
|
||||
|
||||
|
||||
def test_links_support_tags_and_tag_filtering():
|
||||
headers = login_headers()
|
||||
response = client.post('/api/links', headers=headers, json={
|
||||
|
||||
Reference in New Issue
Block a user