I encountered a bug, not sure if it's caused by this extension:

reproduce:
save the draft of a post with tags and subtags.
refresh the browser, then the draft will encounter error and sub tags will disappear.

The error log in the console:

forum.js?v=9d1a9396:1 TypeError: Cannot read properties of undefined (reading 'isQnA')
    at forum.js?v=9d1a9396:454:239931
    at Array.some (<anonymous>)
    at e.<anonymous> (forum.js?v=9d1a9396:454:239904)
    at Wr.forEach.t.<computed> (forum.js?v=9d1a9396:1:363194)
    at Wr.forEach.t.<computed> [as headerItems] (forum.js?v=9d1a9396:1:363164)
    at n.view (forum.js?v=9d1a9396:1:204942)
    at Wr.forEach.t.<computed> [as view] (forum.js?v=9d1a9396:1:363164)
    at Function.a (forum.js?v=9d1a9396:1:145079)
    at forum.js?v=9d1a9396:1:151518
    at p (forum.js?v=9d1a9396:1:151905)
    a month later

    Hey, I don't think anyone has asked or at least I can't find it in the search, the option "Use 'onOneServer()' directive for the task scheduler (requires Redis/Memcache)" what does it do?

    If I use Redis is it advisable to enable it, is there any benefit?

      18 days later

      1.2.0

      🩹 🐛 This is a bug squashing release

      Updating
      composer require fof/drafts
      php flarum cache:clear

      Darkle the option "Use 'onOneServer()' directive for the task scheduler (requires Redis/Memcache)" what does it do?

      When Flarum is running in a vertically scaled environment, this option will ensure only one Flarum instance publishes any pending drafts, rather than potentially two or more publishing the same content at the same time.

      For single instance Flarum installations, this option will do nothing..

      lichengkun135 reproduce:
      save the draft of a post with tags and subtags.
      refresh the browser, then the draft will encounter error and sub tags will disappear.

      The error log in the console:

      Thanks for the latest update! Unfortunately, this problem seems persists

      • IanM replied to this.

        IanM I tested again after clearing the cache, seems working now 😄 Thanks for the efforts!

          Hi, the draft saving works perfectly for me when creating a new discussion, but during saving replying as a draft in a discussion, there will be errors like this:

          [2022-12-03 01:11:42] flarum.ERROR: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null in /www/wwwroot/xxxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117
          Stack trace:
          #0 /www/wwwroot/xxxx/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(117): PDOStatement->execute()
          #1 /www/wwwroot/xxxx/vendor/illuminate/database/Connection.php(501): Doctrine\DBAL\Driver\PDOStatement->execute()
          #2 /www/wwwroot/xxxx/vendor/illuminate/database/Connection.php(705): Illuminate\Database\Connection->Illuminate\Database\{closure}()
          #3 /www/wwwroot/xxxx/vendor/illuminate/database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback()
          #4 /www/wwwroot/xxxx/vendor/illuminate/database/Connection.php(502): Illuminate\Database\Connection->run()
          #5 /www/wwwroot/xxxx/vendor/illuminate/database/Connection.php(454): Illuminate\Database\Connection->statement()
          #6 /www/wwwroot/xxxx/vendor/illuminate/database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert()
          #7 /www/wwwroot/xxxx/vendor/illuminate/database/Query/Builder.php(3028): Illuminate\Database\Query\Processors\Processor->processInsertGetId()
          #8 /www/wwwroot/xxxx/vendor/illuminate/database/Eloquent/Builder.php(1657): Illuminate\Database\Query\Builder->insertGetId()
          #9 /www/wwwroot/xxxx/vendor/illuminate/database/Eloquent/Model.php(1188): Illuminate\Database\Eloquent\Builder->__call()
          #10 /www/wwwroot/xxxx/vendor/illuminate/database/Eloquent/Model.php(1153): Illuminate\Database\Eloquent\Model->insertAndSetId()
          #11 /www/wwwroot/xxxx/vendor/illuminate/database/Eloquent/Model.php(994): Illuminate\Database\Eloquent\Model->performInsert()
          ...

            lichengkun135 Same problem on my forum those days (it's a freeflarum, in case it changes something)

            • IanM replied to this.

              1.2.2

              Fixes saving of draft replies issue introduced in 1.2.0 TB54 lichengkun135

              Updating
              composer update fof/drafts
              php flarum migrate
              php flarum cache:clear
              2 months later

              Very useful extension, but it seems to have a bug.

              1. start new discussion, fill in everything but don't assign any tags
              2. save as draft
              3. reload page and open created draft
              4. click on "Post Discussion"
              5. the overlay to assign tags to the discussion appears. If you now close and cancel, for example to change some text in the draft, you lose the entire draft.
              2 months later

              Saw this log in draft-publish log.
              How to fix it.
              thanks

              Starting...
              PHP Warning:  Undefined array key "discussion" in /var/www/flarum/vendor/fof/drafts/src/Console/PublishDrafts.php on line 64
              PHP Warning:  Trying to access array offset on value of type null in /var/www/flarum/vendor/fof/drafts/src/Console/PublishDrafts.php on line 64
              PHP Warning:  Trying to access array offset on value of type null in /var/www/flarum/vendor/fof/drafts/src/Console/PublishDrafts.php on line 64
              Publishing draft reply for discussion 
              PHP Warning:  Undefined property: Flarum\Discussion\Event\Saving::$user in /var/www/flarum/vendor/ziiven/flarum-pay-to-see/src/Listeners/AddPayToSee.php on line 24
              Published draft discussion: 936
              PHP Warning:  Undefined array key "discussion" in /var/www/flarum/vendor/fof/drafts/src/Console/PublishDrafts.php on line 64
              PHP Warning:  Trying to access array offset on value of type null in /var/www/flarum/vendor/fof/drafts/src/Console/PublishDrafts.php on line 64
              PHP Warning:  Trying to access array offset on value of type null in /var/www/flarum/vendor/fof/drafts/src/Console/PublishDrafts.php on line 64
              Publishing draft reply for discussion 

                kebindong there's nothing in there you need to worry about. Those are messages for the extension developers but don't prevent the program from working as expected.

                It's recommended to hide PHP warnings in php.ini in production.

                Is there any issue with drafts not publishing correctly ?

                  This extension can be installed, but it cannot be enabled. Once enabled, it will be automatically closed

                    clarkwinkelmann I tried enabling debug mode, but no errors were displayed, and the plugin could not be uninstalled with the command

                    assets/admin.js?v=993aa371 500 error ,, but there is no problem opening this url directly, is it a cross-domain problem

                      xiahuan710 make sure you are accessing your forum with the URL defined in config.php . You should configure HTTP redirects to enforce using the correct URL if you haven't already.

                      Any plan to apply Draft also when editing a post?
                      Sometimes a edit can be big, will be problematic support also draft during the editing of a post or comment?