fix: address PR review feedback (round 9)
- Fix emoji clearing bug: use _UNSET sentinel in update_collective so
emoji=None sends {"emoji": null} instead of raising ValueError
- Move collectives_get_trashed_collectives to Read Tools section
- Remove redundant is_trash field from ListTrashedPagesResponse
- Add page lifecycle note to collectives_trash_page docstring
- Add unit test for clearing collective emoji via update_collective
- Add integration test for clearing collective emoji via MCP tool
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
cb16060b1b
commit
52470ea713
@@ -9,6 +9,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
API_BASE = "/ocs/v2.php/apps/collectives/api/v1.0"
|
||||
|
||||
_UNSET = object()
|
||||
"""Sentinel to distinguish 'not provided' from an explicit None."""
|
||||
|
||||
|
||||
class OCSError(Exception):
|
||||
"""Error returned in the OCS response envelope."""
|
||||
@@ -75,15 +78,18 @@ class CollectivesClient(BaseNextcloudClient):
|
||||
return data["collective"]
|
||||
|
||||
async def update_collective(
|
||||
self, collective_id: int, emoji: str | None = None
|
||||
self, collective_id: int, emoji: str | None | object = _UNSET
|
||||
) -> dict[str, Any]:
|
||||
"""Update a collective (emoji).
|
||||
|
||||
Pass emoji=None to clear the emoji. Omit emoji entirely to leave
|
||||
it unchanged.
|
||||
|
||||
Raises:
|
||||
ValueError: If no fields are provided to update.
|
||||
"""
|
||||
json_data: dict[str, Any] = {}
|
||||
if emoji is not None:
|
||||
if emoji is not _UNSET:
|
||||
json_data["emoji"] = emoji
|
||||
if not json_data:
|
||||
raise ValueError("At least one field must be provided to update")
|
||||
|
||||
Reference in New Issue
Block a user