diff options
author | Vitaly Takmazov | 2019-04-09 22:55:20 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-04-09 22:55:20 +0300 |
commit | 0880615c6211f7e0f3d54f3e9247772b69b09267 (patch) | |
tree | ccff3a4d1d836fa9f91b4167dd6c16ebd1c5972f /src/main/java/com/juick | |
parent | 1b8b8b3d34157e5a8c034f9f9dbba3771048ec51 (diff) |
ActivityPub: Object id must be valid URI
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r-- | src/main/java/com/juick/server/api/activity/model/Activity.java | 8 |
1 files changed, 4 insertions, 4 deletions
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() { |