From 0880615c6211f7e0f3d54f3e9247772b69b09267 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 9 Apr 2019 22:55:20 +0300 Subject: ActivityPub: Object id must be valid URI --- src/main/java/com/juick/server/api/activity/model/Activity.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/juick/server/api/activity/model/Activity.java b/src/main/java/com/juick/server/api/activity/model/Activity.java index d2ee712b..94e5c45e 100644 --- a/src/main/java/com/juick/server/api/activity/model/Activity.java +++ b/src/main/java/com/juick/server/api/activity/model/Activity.java @@ -2,6 +2,7 @@ package com.juick.server.api.activity.model; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.juick.server.api.activity.helpers.ActivityIdDeserializer; +import org.apache.commons.lang3.StringUtils; import java.util.UUID; @@ -11,16 +12,15 @@ public abstract class Activity extends Context { private String actor; private Object object; - public Activity() { - setId(UUID.randomUUID().toString()); - } - public String getActor() { return actor; } public void setActor(String actor) { this.actor = actor; + if (StringUtils.isEmpty(getId())) { + setId(String.format("%s#%s", this.actor, UUID.randomUUID().toString())); + } } public Object getObject() { -- cgit v1.2.3