FIX: Missing category edit icon. (PR #13540)

Follow-up to 0e4b8c5318569ef7e7a111563709699e3b9ce219

GitHub

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

Approving, just wondering why we are changing from the OpenStruct? Also was can_edit just lost along the way in refactors?

@martin-brennan Since can_edit is cached in Site, the initial cache has an anon guardian so it is always false. Therefore, we need to set the field again. Slightly more complicated but the optimisation is worth it here for the extra trouble we have to go through.

Also I threw the open struct away because it was just making the code easier to work with by turning the json into an object. However, it was unnecessary so I removed it here.

@tgxworld thanks for explaining. I think that would have been good to add to the PR description :slight_smile: