Remove Twitter POSSE support

This commit is contained in:
Jonny Barnes 2023-04-08 11:54:24 +01:00
parent 52b1220068
commit 88e1246f8b
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
15 changed files with 1 additions and 365 deletions

View file

@ -279,50 +279,6 @@ class Note extends Model
return $oEmbed;
}
/**
* Show a specific form of the note for twitter.
*
* That is we swap the contacts names for their known Twitter handles.
*/
public function getTwitterContentAttribute(): string
{
$this->getContacts();
// check for contacts
if ($this->contacts === null || count($this->contacts) === 0) {
return '';
}
// here we check the matched contact from the note corresponds to a contact
// in the database
if (
count(array_unique(array_values($this->contacts))) === 1
&& array_unique(array_values($this->contacts))[0] === null
) {
return '';
}
// swap in Twitter usernames
$swapped = preg_replace_callback(
self::USERNAMES_REGEX,
function ($matches) {
if (is_null($this->contacts[$matches[1]])) {
return $matches[0];
}
$contact = $this->contacts[$matches[1]];
if ($contact->twitter) {
return '@' . $contact->twitter;
}
return $contact->name;
},
$this->getRawOriginal('note')
);
return $this->convertMarkdown($swapped);
}
/**
* Scope a query to select a note via a NewBase60 id.
*/