Skip to content

Conversation

@rsmithlal
Copy link
Member

@rsmithlal rsmithlal commented Aug 8, 2025

This pull request introduces an opt-in mechanism for platform members to receive direct messages, tightening permissions around who can be added as participants in new or updated conversations. It centralizes participant permission logic, updates error handling and feedback, and adds localization for new messaging rules. The changes affect controller logic, model preferences, policy enforcement, user interface, and translations, ensuring members have explicit control over their messaging privacy.

Messaging Permissions & Participant Filtering:

  • Added a receive_messages_from_members preference to BetterTogether::Person, defaulting to false, allowing members to opt in to receive messages from non-managers.
  • Centralized participant permission logic in ConversationPolicy#permitted_participants, restricting regular members to only message platform managers or opted-in members.
  • Updated controller logic in ConversationsController#create and #update to filter participant IDs using the new policy and provide error feedback if only disallowed participants are submitted. [1] [2] [3] [4]

User Interface & Feedback:

  • Added toggle switch to the person form for opting in to receive messages from platform members, with explanatory text.
  • Improved error display in the conversation form and added conditional messaging button to person profiles based on permissions. [1] [2]

Localization & Error Messaging:

Testing:

  • Added model and policy specs to verify opt-in preference behavior and participant filtering. [1] [2]

…olicy, people form, and en.yml conflicts keeping both message opt-in and conversation details toggles
…ipants for create/update; update request specs
…ing templates, improve participant filtering, and update localization for permitted participants.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

## Summary
- raise `ActiveRecord::RecordNotFound` when accessing conversations not
belonging to the current user
- add request spec to ensure non-participants receive a 404 response

## Testing
- `bin/dc-run bundle exec rubocop` *(fails: docker: command not found)*
- `bin/codex_style_guard` *(fails: bundler: command not found: rubocop)*
- `bin/dc-run bundle exec brakeman --quiet --no-pager` *(fails: docker:
command not found)*
- `bin/dc-run bundle exec bundler-audit --update` *(fails: docker:
command not found)*
- `bin/dc-run bin/i18n` *(fails: docker: command not found)*
- `bin/dc-run bin/ci` *(fails: docker: command not found)*

------
https://chatgpt.com/codex/tasks/task_e_68b1f69223b88321bb27a78b2da20f6d
@rsmithlal rsmithlal merged commit db15e3c into main Aug 29, 2025
11 of 12 checks passed
@rsmithlal rsmithlal deleted the feature/message-opt-in branch August 29, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants