1 files changed, 14 insertions, 1 deletions
diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index 46a3758d..32bd715e 100644
--- a/src/util/entities/Message.ts
+++ b/src/util/entities/Message.ts
@@ -16,7 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import type { APNote } from "activitypub-types";
+import type { APAnnounce, APNote } from "activitypub-types";
import {
Column,
CreateDateColumn,
@@ -243,6 +243,19 @@ export class Message extends BaseClass {
};
}
+ toAnnounceAP(): APAnnounce {
+ const { webDomain } = Config.get().federation;
+
+ return {
+ id: `https://${webDomain}/fed/channel/${this.channel_id}/messages/${this.id}`,
+ type: "Announce",
+ actor: `https://${webDomain}/fed/user/${this.author_id}`,
+ published: this.timestamp,
+ to: `https://${webDomain}/fed/channel/${this.channel_id}`,
+ object: this.toAP(),
+ };
+ }
+
toAP(): APNote {
const { webDomain } = Config.get().federation;
|