From 9cbc4a7355027cf7b4e2d7439edcefe04e1c18c2 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 Jan 2018 06:22:09 +0000 Subject: [PATCH] Basic forum support for Diaspora --- include/bbcode.php | 3 ++- src/Worker/Delivery.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index fd7bcbf9b..20631818a 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -997,8 +997,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa if ((!$tryoembed || $simplehtml) && !in_array($simplehtml, [3, 7])) { $Text = preg_replace("/([#@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text); } elseif ($simplehtml == 3) { + // The ! is converted to @ since Diaspora only understands the @ $Text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", - '$1$3', + '@$3', $Text); } elseif ($simplehtml == 7) { $Text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 5b03a10ec..e8d432cc7 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -133,7 +133,8 @@ class Delivery { return; } - $walltowall = (($top_level && ($owner['id'] != $items[0]['contact-id'])) ? true : false); + // We don't treat Forum posts as "wall-to-wall" to be able to post them via Diaspora + $walltowall = $top_level && ($owner['id'] != $items[0]['contact-id']) & ($owner['account-type'] != ACCOUNT_TYPE_COMMUNITY); $public_message = true;