From ee0eb548d8817bc3deb1a6401972913457887afd Mon Sep 17 00:00:00 2001 From: Mikhail Wahib <112858669+MikhailWahib@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:27:38 +0300 Subject: [PATCH] Feature: Create an activity when resending an invite email (#4680) ## Because When I resend an invite to an admin team member, I want an activity to be created. ## Issue Closes #4663 ## Pull Request Requirements - [x] I have thoroughly read and understand [The Odin Project Contributing Guide](https://github.com/TheOdinProject/theodinproject/blob/main/CONTRIBUTING.md) - [x] The title of this PR follows the `keyword: brief description of change` format, using one of the following keywords: - `Feature` - adds new or amends existing user-facing behavior - `Chore` - changes that have no user-facing value, refactors, dependency bumps, etc - `Fix` - bug fixes - [x] The `Because` section summarizes the reason for this PR - [ ] The `This PR` section has a bullet point list describing the changes in this PR - [x] I have verified all tests and linters pass after making these changes. - [x] If this PR addresses an open issue, it is linked in the `Issue` section - [ ] If applicable, this PR includes new or updated automated tests --- .../admin_v2/team_members/resend_invitation_controller.rb | 2 ++ app/views/public_activity/admin_user/_reinvited.html.erb | 1 + 2 files changed, 3 insertions(+) create mode 100644 app/views/public_activity/admin_user/_reinvited.html.erb diff --git a/app/controllers/admin_v2/team_members/resend_invitation_controller.rb b/app/controllers/admin_v2/team_members/resend_invitation_controller.rb index 3a9828bdb7..9c45a4242a 100644 --- a/app/controllers/admin_v2/team_members/resend_invitation_controller.rb +++ b/app/controllers/admin_v2/team_members/resend_invitation_controller.rb @@ -8,6 +8,8 @@ def create if team_member.awaiting_activation? team_member.invite!(current_admin_user) redirect_to admin_v2_team_path, notice: "Invite sent to #{team_member.name}" + team_member.create_activity(key: 'admin_user.reinvited', owner: current_admin_user, + params: { name: team_member.name }) else redirect_to admin_v2_team_path, alert: "#{team_member.name} has already accepted the invitation" end diff --git a/app/views/public_activity/admin_user/_reinvited.html.erb b/app/views/public_activity/admin_user/_reinvited.html.erb new file mode 100644 index 0000000000..0ee345f135 --- /dev/null +++ b/app/views/public_activity/admin_user/_reinvited.html.erb @@ -0,0 +1 @@ +<%= activity.owner.name %> re-invited <%= activity.parameters.fetch('name') %>