From 287c55722e6fd23ca2cf2aab4807536db3fa892a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 18 Nov 2019 19:52:00 +0100 Subject: [PATCH] Show title for posts with attached pages --- src/Protocol/Diaspora.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index e8c576a94c..6d9860471c 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -3584,6 +3584,14 @@ class Diaspora $title = $item["title"]; $body = $item["body"]; + // Fetch the title from an attached link - if there is one + if (empty($item["title"])) { + $page_data = BBCode::getAttachmentData($item['body']); + if (!empty($page_data['type']) && !empty($page_data['title']) && ($page_data['type'] == 'link')) { + $title = $page_data['title']; + } + } + if ($item['author-link'] != $item['owner-link']) { require_once 'mod/share.php'; $body = share_header($item['author-name'], $item['author-link'], $item['author-avatar'], @@ -3595,7 +3603,7 @@ class Diaspora // Adding the title if (strlen($title)) { - $body = "## ".html_entity_decode($title)."\n\n".$body; + $body = "### ".html_entity_decode($title)."\n\n".$body; } if ($item["attach"]) {