FEATURE: Allow List for PMs (PR #10270)

This feature adds a new user setting that is disabled by default that allows them to specify a list of users that are allowed to send them private messages. This way they don’t have to maintain a large list of users they don’t want to here from and instead just list the people they know they do want. Staff will still always be able to send messages to the user.

GitHub

This pull request introduces 1 alert when merging 4db9fc217df36d0681a38e211e5bc99cf29ef2ec into 7ab565846264bc9e769e4ea421b9b33fe1c2849c - view on LGTM.com

new alerts:

  • 1 for Overwritten property
      DB.exec(<<~SQL, now: Time.zone.now, user_id: user.id, desired_ids: desired_ids)

This looks good! I’ve only suggested some minor changes.

It took me a minute to figure out that the logic for staff bypassing it was already present in the PostCreator which skips username checks.

          .where("allowed_pm_users.allowed_pm_user_id" => @user.id.to_i)

I think the above syntax works and means you needn’t bother with string interpolation which is riskier.

This file can be removed.

Thanks!

already present in the PostCreator which skips username checks.

Yep, that’s correct.

This pull request introduces 1 alert when merging 5090efa11a854cc3e2b4ad604ed7382e8651286f into 98eb7a3f0013dfc1b1161d4e3a74f627c9413905 - view on LGTM.com

new alerts:

  • 1 for Overwritten property