FEATURE: Allow group moderators to add/remove staff notes (PR #10252)

Note: I had mentioned adding logging to these new Group Moderator features - I will do that as a separate PR

GitHub

I think these tests are not required since can_edit_staff_notes? is just an alias to the can_perform_action_available_to_group_moderators? method. I feel like your request specs are sufficient in this case.

Just curious, why do we need this assertion?

Can this be moved into fab!?

QUnit.test("Enter as a anon user", async assert => {
  assert.ok(exists(".add-notice"), "The add notice button was rendered");
  assert.ok(exists(".add-notice"), "The add notice button was rendered");

Does the attributes of the user matter on the client side? It looks like whether the post admin menu is shown or not is based on the can_edit_staff_notes attribute.

Since can_edit_staff_notes is just an alias of can_close_topic and can_archive_topic, we should memoize the results so that in the worst case we don’t have to run GroupUser.where(group_id: topic.category.reviewable_by_group_id, user_id: @user.id).exists? 3 times.

@jbrw Aside from some minor comments, the PR looks good to me :+1:

I think that was remnants of some dev work. You’re right - it should be there. Removing.

Agreed, memoization here is a good idea!

You’re right. I had a misunderstanding about how moderator, admin and staff all related to each other.

I think we need to update include_can_archive_topic? and include_can_close_topic? to call include_can_edit_staff_notes? instead.