component AP gateway: use createActivity in mbdata2APitem
This commit is contained in:
parent
6e74e19c73
commit
7bd01dd06c
1 changed files with 6 additions and 10 deletions
|
|
@ -802,6 +802,7 @@ class APGateway:
|
|||
actor_id: str,
|
||||
object_: Optional[Union[str, dict]] = None,
|
||||
target: Optional[Union[str, dict]] = None,
|
||||
activity_id: Optional[str] = None,
|
||||
**kwargs,
|
||||
) -> Dict[str, Any]:
|
||||
"""Generate base data for an activity
|
||||
|
|
@ -818,7 +819,8 @@ class APGateway:
|
|||
raise exceptions.InternalError(
|
||||
f'"target" is mandatory for activity {activity!r}'
|
||||
)
|
||||
activity_id = f"{actor_id}#{activity.lower()}_{shortuuid.uuid()}"
|
||||
if activity_id is None:
|
||||
activity_id = f"{actor_id}#{activity.lower()}_{shortuuid.uuid()}"
|
||||
data: Dict[str, Any] = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"actor": actor_id,
|
||||
|
|
@ -1615,15 +1617,9 @@ class APGateway:
|
|||
mb_data
|
||||
)
|
||||
|
||||
ap_item = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"id": url_item,
|
||||
"type": "Create",
|
||||
"actor": url_actor,
|
||||
"object": ap_object
|
||||
}
|
||||
|
||||
return ap_item
|
||||
return self.createActivity(
|
||||
"Create", url_actor, ap_object, activity_id=url_item
|
||||
)
|
||||
|
||||
async def publishMessage(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Reference in a new issue