diff --git a/index.php b/index.php
index cad10c7..47a84b5 100644
--- a/index.php
+++ b/index.php
@@ -1289,14 +1289,41 @@ HTML;
$replyTo = "";
}
- // Check to see if there is a Content Warning
+ // Has the user has been specifically CC'd?
+ if ( isset( $object["cc"] ) ) {
+ $reply = in_array( "https://{$server}/{$username}", $object["cc"] );
+ } else {
+ $reply = false;
+ }
+
+ // Is there is a Content Warning?
if ( isset( $object["summary"] ) ) {
$summary = $object["summary"];
$summary = strip_tags( $summary, $allowed_elements );
$content = "{$summary}
{$content} ";
}
-
+
+ // Is there a poll?
+ // ActivityPub specification - https://www.w3.org/TR/activitystreams-vocabulary/#questions
+ // Mastodon documentation - https://docs.joinmastodon.org/spec/activitypub/#Question
+ if ( isset( $object["oneOf"] ) ) {
+ foreach ( $object["oneOf"] as $pollOption ) {
+ $pollOptionName = $pollOption["name"];
+ $pollOptionValue = $pollOption["replies"]["totalItems"];
+
+ $content .= "
{$pollOptionName}: $pollOptionValue";
+ }
+ }
+ if ( isset( $object["anyOf"] ) ) {
+ foreach ( $object["anyOf"] as $pollOption ) {
+ $pollOptionName = htmlspecialchars( $pollOption["name"] );
+ $pollOptionValue = $pollOption["replies"]["totalItems"];
+
+ $content .= "
{$pollOptionName}: $pollOptionValue";
+ }
+ }
+
// Add any images
if ( isset( $object["attachment"] ) ) {
foreach ( $object["attachment"] as $attachment ) {
@@ -1318,13 +1345,6 @@ HTML;
}
}
- // Check to see if the user has been specifically CC'd
- if ( isset( $object["cc"] ) ) {
- $reply = in_array( "https://{$server}/{$username}", $object["cc"] );
- } else {
- $reply = false;
- }
-
// What sort of message is this?
"Create" == $type ? $verb = "wrote" : $verb = "updated";
if ( $reply ) {