diff --git a/server/cp/mgmt_api/topics.py b/server/cp/mgmt_api/topics.py index 08425ae..2ae4af7 100644 --- a/server/cp/mgmt_api/topics.py +++ b/server/cp/mgmt_api/topics.py @@ -1,6 +1,5 @@ import superdesk -from bson import ObjectId from flask import current_app as app from newsroom.topics.topics import TopicsResource, TopicsService @@ -30,8 +29,6 @@ def on_create(self, docs): elif not doc.get('is_global'): message = ("Please set is_global True, or provide user in the body.") raise SuperdeskApiError.badRequestError(message=message, payload=message) - if doc.get('subscribers'): - doc['subscribers'] = [ObjectId(sub) for sub in doc['subscribers']] def on_created(self, docs): super().on_created(docs) diff --git a/server/features/mgmt_api_topics.feature b/server/features/mgmt_api_topics.feature index 2d38597..0864862 100644 --- a/server/features/mgmt_api_topics.feature +++ b/server/features/mgmt_api_topics.feature @@ -27,7 +27,10 @@ Feature: Management API - Topics "topic_type": "wire", "query": "topic1", "is_global": true, - "user": "#users._id#" + "user": "#users._id#", + "subscribers": [ + {"user_id": "#users._id#"} + ] } """ Then we get response code 201 @@ -43,7 +46,10 @@ Feature: Management API - Topics "topic_type": "wire", "query": "topic1", "is_global": true, - "user": "#users._id#" + "user": "#users._id#", + "subscribers": [ + {"user_id": "#users._id#", "notification_type": "real-time"} + ] } ] }