plezanje-net / api

NestJS GraphQL web server
GNU General Public License v3.0
7 stars 2 forks source link

Fix bug where comments are not shown if not logged in. #162

Closed salamca closed 1 year ago

salamca commented 1 year ago

Comments were not being shown for guest users at all (except on home page). Comment previews were also not being loaded on route list.

There was a bug introduced with https://github.com/plezanje-net/api/pull/147 (linked to: https://github.com/plezanje-net/web/pull/439)

I am not sure why the condition in comments service: if (!currentUser) { options.relations = { crag: true, }; options.where['crag'] = { isHidden: false, }; } was even added as comments can only be accessed via crag, via route, via latestComments query, which all already take care of publish status and isHidden status. (even if we kept this condition it is wrong, as it only takes crag comments into account and fails for route comments --> bug symptom)

Removed some other related unnecessary code.

Might have missed something though, so pls test :)