Squashed commit of the following:
commit 63912e4c20fc9b3d49670a0f547137d59aaa2ef4 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Oct 12 19:18:21 2018 +0100 Remove facebook syndication code
This commit is contained in:
parent
7c559860dc
commit
151072cd1b
10 changed files with 1 additions and 314 deletions
|
@ -400,50 +400,6 @@ class Note extends Model
|
|||
return $this->convertMarkdown($swapped);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a specific form of the note for Facebook.
|
||||
*
|
||||
* That is we swap the contacts names for their known Facebook usernames.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFacebookContentAttribute(): ?string
|
||||
{
|
||||
if ($this->contacts === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (count($this->contacts) === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (count(array_unique(array_values($this->contacts))) === 1
|
||||
&& array_unique(array_values($this->contacts))[0] === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// swap in facebook 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->facebook) {
|
||||
return '<a class="u-category h-card" href="https://facebook.com/'
|
||||
. $contact->facebook . '">' . $contact->name . '</a>';
|
||||
}
|
||||
|
||||
return $contact->name;
|
||||
},
|
||||
$this->getOriginal('note')
|
||||
);
|
||||
|
||||
return $this->convertMarkdown($swapped);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to select a note via a NewBase60 id.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue