nostr events added

This commit is contained in:
HolgerHatGarKeineNode
2023-02-24 11:13:43 +01:00
parent 5fbef7d4aa
commit 235ce774f9
10 changed files with 119 additions and 105 deletions

View File

@@ -20,19 +20,14 @@ class LibraryItemObserver
try {
$libraryItem->setStatus('published');
$libraryItemName = $libraryItem->name;
$libraryItemName .= ' von '.$libraryItem->lecturer->name;
$from = $libraryItem->name;
$from .= ' von '.$libraryItem->lecturer->name;
if ($libraryItem->type !== LibraryItemType::MarkdownArticle()) {
if ($libraryItem->whereDoesntHave('libraries',
fn($query) => $query->where('libraries.is_public', false))
->exists()) {
$text = sprintf("Es gibt was Neues zum Lesen oder Anhören:\n\n%s\n\n%s\n\n#Bitcoin #Wissen #Einundzwanzig #gesundesgeld",
$libraryItemName,
url()->route('article.view',
['libraryItem' => $libraryItem->slug]),
);
$this->publishOnNostr($libraryItem, $text);
$this->publishOnNostr($libraryItem, $this->getText('LibraryItem', $from));
}
}
} catch (Exception $e) {