Browse Source

Editor error fix

imwald
Nuša Pukšič 4 months ago
parent
commit
fc5067ebeb
  1. 6
      src/Controller/ArticleController.php
  2. 3
      templates/pages/editor.html.twig

6
src/Controller/ArticleController.php

@ -164,8 +164,10 @@ class ArticleController extends AbstractController
if ($article->getPubkey() === null) { if ($article->getPubkey() === null) {
$user = $this->getUser(); $user = $this->getUser();
$key = new Key(); $key = new Key();
$currentPubkey = $key->convertToHex($user->getUserIdentifier()); if (!!$user) {
$article->setPubkey($currentPubkey); $currentPubkey = $key->convertToHex($user->getUserIdentifier());
$article->setPubkey($currentPubkey);
}
} }
$form = $this->createForm(EditorType::class, $article, ['action' => $formAction]); $form = $this->createForm(EditorType::class, $article, ['action' => $formAction]);

3
templates/pages/editor.html.twig

@ -13,6 +13,9 @@
{% block body %} {% block body %}
<div class="w-container"> <div class="w-container">
<div class="notice">
Log in is required to post articles.
</div>
<div {{ stimulus_controller('nostr-publish', { <div {{ stimulus_controller('nostr-publish', {
publishUrl: path('api-article-publish'), publishUrl: path('api-article-publish'),
csrfToken: csrf_token('nostr_publish') csrfToken: csrf_token('nostr_publish')

Loading…
Cancel
Save