diff options
author | Vitaly Takmazov | 2021-08-20 12:20:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2021-08-20 12:20:03 +0300 |
commit | 6bd8371f8629bba8edaeb10e2648a5cf0177cd2b (patch) | |
tree | e2b9dc3d47bd2e1b922f0a481127c2373487d63c /src/main/java | |
parent | bab10770a77f5f756a58c4ca6f19dd51e1b492ee (diff) |
ActivityPub: Handle Flag activity
Diffstat (limited to 'src/main/java')
3 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java index e261c2e8..72cc849e 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -30,6 +30,7 @@ import com.juick.www.api.activity.model.Context; import com.juick.www.api.activity.model.activities.Announce; import com.juick.www.api.activity.model.activities.Create; import com.juick.www.api.activity.model.activities.Delete; +import com.juick.www.api.activity.model.activities.Flag; import com.juick.www.api.activity.model.activities.Follow; import com.juick.www.api.activity.model.activities.Like; import com.juick.www.api.activity.model.activities.Undo; @@ -401,6 +402,11 @@ public class Profile { applicationEventPublisher.publishEvent(new AnnounceEvent(this, activity.getActor(), messageUri)); return new ResponseEntity<>(CommandResult.fromString("Like/announce request accepted"), HttpStatus.OK); } + if (activity instanceof Flag) { + URI actor = URI.create(activity.getActor()); + logger.info("{} flag some objects: {}", actor, activity.getObject()); + return new ResponseEntity<>(CommandResult.fromString("Report accepted"), HttpStatus.ACCEPTED); + } logger.warn("Unknown activity: {}", jsonMapper.writeValueAsString(activity)); return new ResponseEntity<>(CommandResult.fromString("Unknown activity"), HttpStatus.NOT_IMPLEMENTED); } diff --git a/src/main/java/com/juick/www/api/activity/model/Context.java b/src/main/java/com/juick/www/api/activity/model/Context.java index e75f2440..5d945749 100644 --- a/src/main/java/com/juick/www/api/activity/model/Context.java +++ b/src/main/java/com/juick/www/api/activity/model/Context.java @@ -35,6 +35,7 @@ import java.util.List; @JsonSubTypes.Type(value = Create.class, name = "Create"), @JsonSubTypes.Type(value = Update.class, name = "Update"), @JsonSubTypes.Type(value = Delete.class, name = "Delete"), + @JsonSubTypes.Type(value = Flag.class, name = "Flag"), @JsonSubTypes.Type(value = Follow.class, name = "Follow"), @JsonSubTypes.Type(value = Accept.class, name = "Accept"), @JsonSubTypes.Type(value = Undo.class, name = "Undo"), diff --git a/src/main/java/com/juick/www/api/activity/model/activities/Flag.java b/src/main/java/com/juick/www/api/activity/model/activities/Flag.java new file mode 100644 index 00000000..2c61d344 --- /dev/null +++ b/src/main/java/com/juick/www/api/activity/model/activities/Flag.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2008-2021, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package com.juick.www.api.activity.model.activities; + +import com.juick.www.api.activity.model.Activity; + +public class Flag extends Activity { + +} |