phloo if you don't find the permission for it, it's maybe not implemented. It's been a while since I worked on this extension so I don't remember, I would have to review the code

@clarkwinkelmann there is one option but I assume its for marking every post as offtopic.
I cannot test it cause I only have an admin account. Guess there should be a second option to collapse "own posts".

    phloo the challenge is that since you can configure multiple collapse reasons, you might need to only allow self-setting specific reasons. Then you might want to allow of not allow changing or removing the collapse. And finally since the original use case was for marking groups of off-topic content, it wouldn't be very useful if you cannot also hide the content of other users that must be collapsed together with your own post.

    In conclusion that wasn't part of the original use case. But this could certainly be added as a sponsored feature.

      clarkwinkelmann I understand. Thanks for the explanation.

      In our old forum, we had a custom function to mark an own reply as "irrelevant/offtopic".
      That's where my request comes from. It's nothing we necessarily need - it's more of a "fun feature".
      Mods and admins could always mark a reply as offtopic but yeah, we do not have mods anymore (little community).

      6 months later
      17 days later

      My problem: I marked several (following) posts as offtopic.
      It says "6 posts were marked ...", when I click the button it loads the first one and then an error message without any details pops up. The rest of the posts are not visible/missing. So I am even unable to remove the collapse setting or view them when they should be loaded.

        phloo can you try to obtain an error message? https://docs.flarum.org/troubleshoot

        If the frontend breaks, it might be a javascript error. Take a look at the browser javascript console.

        In any case, verify if there's anything in the PHP log.

        You could also try again with debug mode enabled to see if anything else is displayed in the frontend.

        If you need to restore some posts urgently you can edit the value in the collapse related columns on the posts table in the database. Set to null to un-collapse.

          clarkwinkelmann
          here is the console error (500):

          XHRGET
          https://XXXX.XXX/api/collapsed-posts?filter[discussion]=849&page[after]=22
          [HTTP/2 500  284ms]

          And here is the PHP error log

          [22-Feb-2024 13:12:27] WARNING: [pool www] child 1746 said into stderr: "[22-Feb-2024 12:12:27 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in /XXX/html/vendor/clarkwinkelmann/flarum-ext-collapsible-posts/src/Visibility/PostScope.php on line 14"
          [22-Feb-2024 13:12:27] WARNING: [pool www] child 1746 said into stderr: "[22-Feb-2024 12:12:27 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in /XXX/html/vendor/clarkwinkelmann/flarum-ext-collapsible-posts/src/Visibility/PostScope.php on line 14"
          [22-Feb-2024 13:12:27] WARNING: [pool www] child 1746 said into stderr: "[22-Feb-2024 12:12:27 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in /XXX/html/vendor/clarkwinkelmann/flarum-ext-collapsible-posts/src/Visibility/PostScope.php on line 14"
          [22-Feb-2024 13:12:28] WARNING: [pool www] child 31857 said into stderr: "[22-Feb-2024 12:12:28 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in/XXX/html/vendor/clarkwinkelmann/flarum-ext-collapsible-posts/src/Visibility/PostScope.php on line 14"
          [22-Feb-2024 13:12:28] WARNING: [pool www] child 31857 said into stderr: "[22-Feb-2024 12:12:28 UTC] PHP Warning:  foreach() argument must be of type array|object, null given in /XXX/html/vendor/clarkwinkelmann/flarum-ext-collapsible-posts/src/Visibility/PostScope.php on line 14

            phloo thanks, can you share your php flarum info as well?

            It seems odd that the code could receive an invalid value at that particular place. Maybe the Scope is being invoked elsewhere in a context I didn't expect. If I can't figure it out I'll add a proper check and error in the code so you can get a backtrace if you try again.

              clarkwinkelmann

              Flarum core: 1.8.5
              PHP version: 8.1.27
              MySQL version: 10.6.17-MariaDB
              Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, readline, Reflection, SPL, session, standard, restrictdocroot, bcmath, bz2, calendar, ctype, curl, dba, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, imap, intl, ldap, exif, mysqlnd, PDO, pgsql, Phar, posix, shmop, SimpleXML, soap, sockets, sodium, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlwriter, xsl, mcrypt, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, xmlreader, xmlrpc, zip, amqp, apcu, decimal, gnupg, igbinary, imagick, mailparse, msgpack, yaml, mongodb, redis, Zend OPcache
              +--------------------------------------+------------+------------------------------------------+
              | Flarum Extensions | | |
              +--------------------------------------+------------+------------------------------------------+
              | ID | Version | Commit |
              +--------------------------------------+------------+------------------------------------------+
              | flarum-flags | v1.8.0 | |
              | flarum-approval | v1.8.1 | |
              | flarum-tags | v1.8.0 | |
              | flarum-suspend | v1.8.1 | |
              | flarum-markdown | v1.8.0 | |
              | fof-byobu | 1.3.5 | |
              | flarum-mentions | v1.8.3 | |
              | flarum-subscriptions | v1.8.0 | |
              | flarum-likes | v1.8.0 | |
              | therealsujitk-gifs | v4.1.1 | |
              | matteocontrini-imgur-upload | v3.9.1 | |
              | ianm-log-viewer | 0.1.1 | |
              | fof-user-directory | 1.3.3 | |
              | fof-user-bio | 1.3.2 | |
              | fof-terms | 1.3.0 | |
              | fof-subscribed | 1.1.4 | |
              | fof-split | 1.1.1 | |
              | fof-reactions | 1.4.0 | |
              | fof-polls | 2.1.2 | |
              | fof-pages | 1.0.8 | |
              | fof-nightmode | 1.5.3 | |
              | fof-merge-discussions | 1.4.1 | |
              | fof-linguist | 1.1.2 | |
              | fof-ignore-users | 1.2.1 | |
              | fof-formatting | 1.0.3 | |
              | fof-follow-tags | 1.2.2 | a4b36e0c056439b2784b026b5570c2e828924f91 |
              | fof-doorman | 1.1.4 | |
              | fof-bbcode-details | 1.1.2 | |
              | fof-anti-spam | 1.1.2 | |
              | flarum-sticky | v1.8.0 | |
              | flarum-statistics | v1.8.0 | |
              | flarum-pusher | v1.8.0 | |
              | flarum-lock | v1.8.0 | |
              | flarum-lang-german | 1.8.3 | |
              | flarum-lang-english | v1.8.0 | |
              | flarum-bbcode | v1.8.0 | |
              | datlechin-add-like-controls | v1.0.6 | |
              | clarkwinkelmann-selective-mediaembed | 1.0.1 | |
              | clarkwinkelmann-post-bookmarks | 1.0.0 | |
              | clarkwinkelmann-likes-received | 1.0.2 | |
              | clarkwinkelmann-collapsible-posts | 1.0.0 | |
              | clarkwinkelmann-author-change | 1.0.3 | |
              | cadiducho-bbcode | 1.1 | |
              +--------------------------------------+------------+------------------------------------------+
              Base URL: https://XXX.XXX
              Installation path: /XXX/html
              Queue driver: sync
              Session driver: file
              Scheduler status: Aktiv
              Mail driver: smtp
              Debug mode: off


              edit: just updated to the latest version and the error is gone 🙂
              clarkwinkelmann/flarum-ext-collapsible-posts 1.0.0 1.0.1 Collapse unimportant posts

                Unfortunately, it also gives me an error. I collapsed the post and it completely disappeared. Can't even open it.

                  phloo edit: just updated to the latest version and the error is gone

                  ah, so it might not have been the warning from the log after all. I still need to fix that properly at some point.

                  Boss81 can you also look at your log files and browser console for any hint, and include your php flarum info output? Make sure you are on the latest version of both Flarum and my extension.

                  5 months later

                  How do i un-collapse the first post of a discussion? It just disappeared, so i turned off the extension.

                    Version 1.0.2

                    • Fix collapsed thread becoming inaccessible if it includes the first post of the discussion. You need to collapse or collapse any post in the discussion to fix existing broken discussions
                    • Fix collapsed thread becoming temporarily inaccessible when permanently deleting the first post of the thread

                    sdgsdgsd that was a bug, I had never tried collapsing the first post. It doesn't make much sense to do so, but it definitely shouldn't make the content inaccessible 😅 Just collapse or un-collapse any post in the discussion after updating and you will see the missing posts again.

                    22 days later

                    phloo

                    I had to adjust the following for class PostScope because I always had messages in the logs:

                    class PostScope
                    {
                        public function __invoke(User $actor, Builder $query)
                        {   
                            $getQuery_columns = $query->getQuery()->columns;
                            
                            if($getQuery_columns) {
                                foreach ($getQuery_columns as $column) {
                                    // This is a way for us to bypass the logic from below
                                    // By adding this column to the SELECT clause, it will have no impact on the output, but we can read it here
                                    if ($column instanceof Expression && $column->getValue() === "'1' as collapsed_include_hidden") {
                                        return;
                                    }
                                }
                            }
                    ...

                    Log warning:

                    PHP Warning: foreach() argument must be of type array|object, null given in .../vendor/clarkwinkelmann/flarum-ext-collapsible-posts/src/Visibility/PostScope.php on line 14