Default pinned topic does not show due to policy plugin

I noticed something strange about the default welcome (pinned) topic in Uncategorized: it does not show up for anonymous requests.

There is no limit to reading it that I can tell: registration is open, this is the default Uncategorized category (with the special security features) and no setting limits viewing contents.

The JSON view shows the cooked version of the post, yet the HTML version is empty:

This behavior only happens on this forum, the master of a multi-site configuration.

https://ps.zoethical.org/t/welcome-to-p-s/8/1.json

Any idea?

There’s a reply with a policy which bugs and lacks buttons… Maybe that’s related?

Just to be complete, here’s what it looks like when I’m logged in:

It’s visible via Safe mode, so it’s a customization or plugin:

3 Likes

@hellekin I have the exact same problem. If you remove the policy post or disable the plugin in the settings the topic will appear.
Looks like there is a bug and non registered users can’t see the topic if a policy is used in a post.

Can someone help us?

I have been tracking down the culprit: discourse-policy, as @Vraag suggested. Contrary to @Vraag, the plugin affects the “disappearing” topic even when disabled: having it on the plugin list is enough for the topic to “disappear” when logged-out.

The response making use of the Policy plugin is the first response: Welcome to P.S.: - welcome - Petites Singularités
The Markdown for that post:

[policy group=trust_level_1 reminder=daily]
We do not use third-party cookies.
[/policy]

Here’s the error log:

TypeError: p is null
Url: https://ps.zoethical.org/assets/plugins/discourse-policy-60b8413b741df408ff16f757f644f9de7cb64099d24c33dc3d85ef735478d72a.js
Line: 1
Column: 3373
Window Location: https://ps.zoethical.org/t/welcome-to-p-s/8

Here’s the backtrace:

r@https://ps.zoethical.org/assets/plugins/discourse-policy-60b8413b741df408ff16f757f644f9de7cb64099d24c33dc3d85ef735478d72a.js:1:3373
m@https://ps.zoethical.org/assets/plugins/discourse-policy-60b8413b741df408ff16f757f644f9de7cb64099d24c33dc3d85ef735478d72a.js:1:5934
value/<@https://ps.zoethical.org/assets/application-e5979c62e7a903663f877b29059ee0b4707ac3d11c783460ad7d0920ed92e017.js:73:2648
value@https://ps.zoethical.org/assets/application-e5979c62e7a903663f877b29059ee0b4707ac3d11c783460ad7d0920ed92e017.js:73:2619
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10297
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10576
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10576
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10576
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10576
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10576
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:10576
u@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:12330
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:11710
o@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:13433
i@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:13297
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:11816
o@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:13433
i@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:13297
r@https://ps.zoethical.org/assets/vendor-fae393575cd14697b31e9fdbeb8c016d165a8a3af765ec8ca719a454585aedf4.js:5:13118
rerenderWidget@https://ps.zoethical.org/assets/application-e5979c62e7a903663f877b29059ee0b4707ac3d11c783460ad7d0920ed92e017.js:33:21229
y</t.invoke@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:9727
y</t.flush@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:8732
b</t.flush@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:10780
H</n._end@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:15438
H</n.end@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:12105
H</n._run@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:15973
H</n._join@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:15758
H</n.join@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:16:12813
c@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:12:3338
R/<@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:12:4903
h@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:2:9935
o/</f<@https://ps.zoethical.org/assets/ember_jquery-d430881a3fb1403871256e5a02423c4b20a78793685e92088613ca9a701baf88.js:2:10240

Note that plugin.rb loads a whole bunch of dependencies even before doing anything. Maybe the mistake comes from one of these dependencies that would expect a logged-in user.

Hi
Yes, I forgot to say you must edit the post after disabling the plugin, or it will continue to affect it

Edit the post as in?.. Removing the policy markup?

No, disable the plugin, edit the post containing the plugin (add a random letter at the start of the post for example), save it and unregistered users will be able to see the post
The markup will show as [policy][/policy] and do nothing
I wonder why just disable the plugin isn’t enough. You must edit the post after that or it will continue to have effect

1 Like

Indeed, editing the post while the plugin is disabled, even changing the contents inside the [policy] tags is enough to restore the topic view.

So it seems to be a bug in the discourse-policy plugin, @sam?

Strangely enough, re-enabling the plugin restores the situation to normal. I’m not sure what to do with this.

I guess this topic will serve for future reference, so here it is: if some topic “disappears” from anonymous view, and you have a post using the discourse-policy plugin…

  1. disable the plugin – if that does not work: remove it from the container’s YAML configuration file and rebuild.
  2. edit the post using [policy] tag so that it’s rebaked and disabled (maybe rebuild HTML is enough?)
  3. restore the plugin.

Tadaa! Some magic happened.

1 Like

What do you mean by “some magic happened”?

I did as you said, and got this:

    [policy group=testgroup reminder=daily]
Test
    [/policy]

Which does not fix the problem. More than a fix, that’s… just not using the plugin.
If I edit the post or rebuild HTML the plugin will work, but the topic will disappear for non-registered users again

edit

It is the same for you from what I can see. In your topic the second post looks like this:

[policy group=trust_level_1 reminder=daily]
    We do not use third-party cookies.
    [/policy]

So we still have no “solution”. Unless you call solution not using the plugin xD. You might as well have deleted the markup from the second post, same result.
As it is now you can only use it in private categories, so that non registered users can’t see the topic anyway.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.