codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
385 stars 69 forks source link

add check for wiki status when deciding whether to show 'suggest edit' or 'edit' #1242

Closed cellio closed 9 months ago

cellio commented 9 months ago

https://meta.codidact.com/posts/288743

Wiki posts -- specifically, post types that are "freely editable" per the configuration -- are incorrectly showing "suggest edit" as the name of the edit action to users who do not have the Edit ability. We were failing to check for the "freely editable" property in this case. This fixes that.

I tested this locally by creating a Wiki post type matching that used in production, creating a post as one user, and then editing it as another (regular, unprivileged) user.

I think I've got the indentation right in this code but if I've failed to follow our coding standards, please educate me.