mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
news twitter
This commit is contained in:
@@ -22,20 +22,31 @@ class LibraryItemObserver
|
|||||||
$libraryItem->setStatus('published');
|
$libraryItem->setStatus('published');
|
||||||
|
|
||||||
$libraryItemName = $libraryItem->name;
|
$libraryItemName = $libraryItem->name;
|
||||||
if ($libraryItem->lecturer->twitter_username) {
|
if ($libraryItem->lecturer->twitter_username && $libraryItem->type !== 'markdown_article') {
|
||||||
$libraryItemName .= ' von @'.$libraryItem->lecturer->twitter_username;
|
$libraryItemName .= ' von @'.$libraryItem->lecturer->twitter_username;
|
||||||
}
|
}
|
||||||
|
if ($libraryItem->lecturer->twitter_username && $libraryItem->type === 'markdown_article') {
|
||||||
|
$libraryItemName .= ' von '.$libraryItem->lecturer->name;
|
||||||
|
}
|
||||||
|
|
||||||
if (config('feeds.services.twitterAccountId')) {
|
if (config('feeds.services.twitterAccountId')) {
|
||||||
$this->setNewAccessToken(1);
|
$this->setNewAccessToken(1);
|
||||||
|
|
||||||
// http://localhost/de/library/library-item?l=de&table[filters][id]=2
|
// http://localhost/de/library/library-item?l=de&table[filters][id]=2
|
||||||
|
|
||||||
$text = sprintf("Es gibt was Neues zum Anschauen oder Anhören:\n\n%s\n\n%s\n\n#Bitcoin #Event #Einundzwanzig #gesundesgeld",
|
if ($libraryItem->type !== 'markdown_article') {
|
||||||
$libraryItemName,
|
$text = sprintf("Es gibt was Neues zum Anschauen oder Anhören:\n\n%s\n\n%s\n\n#Bitcoin #Event #Einundzwanzig #gesundesgeld",
|
||||||
url()->route('library.table.libraryItems',
|
$libraryItemName,
|
||||||
['country' => 'de', 'library_items' => ['filters' => ['id' => $libraryItem->id]]]),
|
url()->route('library.table.libraryItems',
|
||||||
);
|
['country' => 'de', 'library_items' => ['filters' => ['id' => $libraryItem->id]]]),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$text = sprintf("Ein neuer News-Artikel wurde verfasst:\n\n%s\n\n%s\n\n#Bitcoin #News #Einundzwanzig #gesundesgeld",
|
||||||
|
$libraryItemName,
|
||||||
|
url()->route('article.view',
|
||||||
|
['libraryItem' => $libraryItem->slug]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->postTweet($text);
|
$this->postTweet($text);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user