Moderator Extension

@Flower_Child Upgrade the plugin and give it another go.

https://github.com/angusmcleod/discourse-moderator-extension/commit/8b620f513f7d57cb81fa7fe2b0148fe2ea4f1901

1 Like

Looks like it’s partly fixed! The moderators now appear in categories without a page reload, but when returning to the index from a category, the moderators of the last category viewed still show up on the index for me.

My site uses category view on the index as the default tab, if that’s relevant.

1 Like

Yeah, I pushed a fix for it a little after the first fix. Are you running this commit?

https://github.com/angusmcleod/discourse-moderator-extension/commit/d00b18d5bade73f1c1b79799fcaf7da69480a821

Yup, I even rebuilt the container to make sure I was fully updated and it still happens.

1 Like

Yup you were right, it’s because of that categories page :slight_smile:

This should do it:

https://github.com/angusmcleod/discourse-moderator-extension/commit/69788871c806b4a8b7921ee29072448e6370511d

3 Likes

Ahah that fixed it. Thank you for all the help! :smile:

1 Like

@angus I’ve created that account (And posted in one of the mod categories) so can can find me easily.

Thanks @Heather_Dudley :+1: I did get a chance to test it with some other folks then. This plugin has moved on a bit since that initial test. Have you had a chance to try it out on your site yet? It should be ready to go.

Sorry for the delay! I’ve asked our dev to this plugin and I’ll give it a good test run once he does! I appreciate the time you’ve taken to develop this!

1 Like

has anyone observed a bug “infinite rendering invalidation detected”
it seems to happen in random categories when “Show a list of moderators assigned” is enabled. when you first open the category, everything appears normal, except the moderator icons don’t appear on the widget. if you enter a thread and then go back to the thread list, or refresh the page, it loads forever (or loads the header and page content up until the “Moderators” text and then nothing below).

Uncaught Error: infinite rendering invalidation detected Url: https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js Line: 10 Column: 6276 Window Location: https://www.safarizone.net/c/chill-out

Error: infinite rendering invalidation detected
    at Array.d (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:10:6301)
    at p._trigger (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:21198)
    at p.end (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:21074)
    at p.run (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:22011)
    at p.join (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:22135)
    at Array.d (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:10:6368)
    at p._trigger (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:21198)
    at p.end (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:21074)
    at p.run (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:22011)
    at p.join (https://www.safarizone.net/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:22135)

I’m currently travelling. I’ll take a look at this next week.

1 Like

I’m not 100% sure why you’re seeing this as I can’t repro it, but I’ve improved the relevant code in various ways. If you could try enabling it again and let me know how it goes.

https://github.com/angusmcleod/discourse-moderator-extension/commit/2fd2973de1789edc6b34969fd6279e5573b4c0aa

1 Like

interesting… now for the affected categories it no longer breaks the page or causes an infinite rendering bug, but the moderator icons don’t display. the text does, but no icons.

I triple checked to make sure there are mods assigned to that category, tried removing and adding them back, etc, but no luck. I also have no clue why this only seems to apply to one particular category.

This is in the console now:

TypeError: Cannot read property 'username' of null
    at _plugin-third-party-14149fdb39b7ab1f2e6bffc149f051bd0c9b6003b0e6d3cf7f39a571aa228510.js:9390
    at Array.map (<anonymous>)
    at s.moderators (_plugin-third-party-14149fdb39b7ab1f2e6bffc149f051bd0c9b6003b0e6d3cf7f39a571aa228510.js:9389)
    at s.<anonymous> (_application-3f35beee529621978637f7f58174f3479eb8fb739071c410b5d5ce00e3f94877.js:83)
    at l.f.get (_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:28958)
    at Object.r [as get] (_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:33686)
    at t.compute (_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:27023)
    at t.value (_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:26898)
    at e.iterate (_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:26662)
    at e.isEmpty (_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:11199)

Clicking the top file in the stack trace it looks like it’s this bit that’s causing at least that particular problem.

moderators: function moderators(_moderators) {
      if (!_moderators) return [];
      return _moderators.map(function (m) {
        Ember.set(m, 'url', (0, _url.userPath)(m.username));
        return m;
      });
    },

oh also erm, i think whatever you did in that update also reverted the issue i mentioned before in this topic haha. going to a category and then to the categories page (my site’s index) makes the Moderators text (and icons, for categories where the ^ bug isn’t occurring) appear on the index until a page reload

This should be fixed (again).

https://github.com/angusmcleod/discourse-moderator-extension/commit/3b0752cae19697c159524d00bd1e11d8e95976c5

It sounds like you have some invalid data saved in the custom_field for that category. Try it again with this update.

https://github.com/angusmcleod/discourse-moderator-extension/commit/30995654d3c77ebd8e38718041cab506704ef5da

Thanks for your patience!

2 Likes

looks to be fixed, thank you for all the help!

1 Like

Hi Angus, my list of moderators seems to be hit and miss. For example this category has three mods but only one shows up. This one shows correct with three mods, this one shows no mods but there there should be one. Any idea what’s going on here?

@angus I also now have incorrect moderators showing in the list. The user I have set to this category’s name is Keith, but it is showing this Keith instead.

I’ll take a look today @davidkingham. Just to clarify, is it just the list displayed in the category that is incorrect? Do the category moderator assignments appear correctly in admin/users?

Correct, just in this list. Hopefully you saw my post above this as well. Thanks Angus!

image