From 1b5c483d89d9a20a92e98fc37879389ee2c8dd00 Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@gitlab.com>
Date: Tue, 14 Apr 2015 12:25:16 +0200
Subject: [PATCH] Consistently use "invitation" rather than "invite" in text.

---
 app/controllers/groups/group_members_controller.rb    |  4 ++--
 app/controllers/invites_controller.rb                 |  6 +++---
 .../projects/project_members_controller.rb            |  8 ++++----
 app/helpers/groups_helper.rb                          |  2 +-
 app/helpers/projects_helper.rb                        |  2 +-
 app/mailers/emails/groups.rb                          | 11 ++++++-----
 app/mailers/emails/projects.rb                        | 11 +++++++----
 7 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb
index 0018cd34bbe..359eeb4d27a 100644
--- a/app/controllers/groups/group_members_controller.rb
+++ b/app/controllers/groups/group_members_controller.rb
@@ -52,9 +52,9 @@ class Groups::GroupMembersController < Groups::ApplicationController
     if @group_member.invite?
       @group_member.resend_invite
 
-      redirect_to group_group_members_path(@group), notice: 'Invite was successfully resent.'
+      redirect_to group_group_members_path(@group), notice: 'The invitation was successfully resent.'
     else
-      redirect_to group_group_members_path(@group), alert: 'The invite has already been accepted.'
+      redirect_to group_group_members_path(@group), alert: 'The invitation has already been accepted.'
     end
   end
 
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb
index 1b236a48e90..00d274a7f1d 100644
--- a/app/controllers/invites_controller.rb
+++ b/app/controllers/invites_controller.rb
@@ -28,7 +28,7 @@ class InvitesController < ApplicationController
 
       redirect_to path, notice: "You have been granted #{member.human_access} access to #{source}."
     else
-      redirect_to :back, alert: "The invite could not be accepted."
+      redirect_to :back, alert: "The invitation could not be accepted."
     end
   end
 
@@ -52,9 +52,9 @@ class InvitesController < ApplicationController
           new_user_session_path
         end
 
-      redirect_to path, notice: "You have declined the invite to join #{source}."
+      redirect_to path, notice: "You have declined the invitation to join #{label}."
     else
-      redirect_to :back, alert: "The invite could not be declined."
+      redirect_to :back, alert: "The invitation could not be declined."
     end
   end
 
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb
index e55e8e4c504..9831a2089be 100644
--- a/app/controllers/projects/project_members_controller.rb
+++ b/app/controllers/projects/project_members_controller.rb
@@ -60,15 +60,15 @@ class Projects::ProjectMembersController < Projects::ApplicationController
   end
 
   def resend_invite
+    redirect_path = namespace_project_project_members_path(@project.namespace, @project)
+
     @project_member = @project.project_members.find(params[:id])
     if @project_member.invite?
       @project_member.resend_invite
 
-      redirect_to namespace_project_project_members_path(@project.namespace,
-                                                        @project), notice: 'Invite was successfully resent.'
+      redirect_to redirect_path, notice: 'The invitation was successfully resent.'
     else
-      redirect_to namespace_project_project_members_path(@project.namespace,
-                                                        @project), alert: 'The invite has already been accepted.'
+      redirect_to redirect_path, alert: 'The invitation has already been accepted.'
     end
   end
 
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 52d88133d5e..add0a776a63 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -3,7 +3,7 @@ module GroupsHelper
     if member.user
       "Are you sure you want to remove \"#{member.user.name}\" from \"#{group.name}\"?"
     else
-      "Are you sure you want to cancel invitation for \"#{member.invite_email}\" to join \"#{group.name}\"?"
+      "Are you sure you want to revoke the invitation for \"#{member.invite_email}\" to join \"#{group.name}\"?"
     end
   end
 
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 06e5d3b7383..c2a7732e6f0 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -3,7 +3,7 @@ module ProjectsHelper
     if member.user
       "You are going to remove #{member.user.name} from #{project.name} project team. Are you sure?"
     else
-      "You are going to cancel invitation for #{member.invite_email} to join #{project.name} project team. Are you sure?"
+      "You are going to revoke the invitation for #{member.invite_email} to join #{project.name} project team. Are you sure?"
     end
   end
 
diff --git a/app/mailers/emails/groups.rb b/app/mailers/emails/groups.rb
index f3da3990c5f..07b8f6d735a 100644
--- a/app/mailers/emails/groups.rb
+++ b/app/mailers/emails/groups.rb
@@ -14,8 +14,9 @@ module Emails
       @group = @group_member.group
       @token = token
       @target_url = group_url(@group)
+      @current_user = @group_member.user
       mail(to: @group_member.invite_email,
-           subject: "Invite to join group #{@group.name}")
+           subject: "Invitation to join group #{@group.name}")
     end
 
     def group_invite_accepted_email(group_member_id)
@@ -24,21 +25,21 @@ module Emails
 
       @group = @group_member.group
       @target_url = group_url(@group)
+      @current_user = @group_member.created_by
       mail(to: @group_member.created_by.notification_email,
-           subject: subject("Invite accepted"))
+           subject: subject("Invitation accepted"))
     end
 
     def group_invite_declined_email(group_id, invite_email, access_level, created_by_id)
       return if created_by_id.nil?
 
       @group = Group.find(group_id)
-      @created_by = User.find(created_by_id)
+      @current_user = @created_by = User.find(created_by_id)
       @access_level = access_level
       @invite_email = invite_email
       @target_url = group_url(@group)
-
       mail(to: @created_by.notification_email,
-           subject: subject("Invite declined"))
+           subject: subject("Invitation declined"))
     end
   end
 end
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb
index bbfb7a3e409..7baeead3fb5 100644
--- a/app/mailers/emails/projects.rb
+++ b/app/mailers/emails/projects.rb
@@ -14,8 +14,9 @@ module Emails
       @project = @project_member.project
       @token = token
       @target_url = namespace_project_url(@project.namespace, @project)
+      @current_user = @project_member.user
       mail(to: @project_member.invite_email,
-           subject: "Invite to join project #{@project.name_with_namespace}")
+           subject: "Invitation to join project #{@project.name_with_namespace}")
     end
 
     def project_invite_accepted_email(project_member_id)
@@ -24,21 +25,23 @@ module Emails
 
       @project = @project_member.project
       @target_url = namespace_project_url(@project.namespace, @project)
+      @current_user = @project_member.created_by
+
       mail(to: @project_member.created_by.notification_email,
-           subject: subject("Invite accepted"))
+           subject: subject("Invitation accepted"))
     end
 
     def project_invite_declined_email(project_id, invite_email, access_level, created_by_id)
       return if created_by_id.nil?
 
       @project = Project.find(project_id)
-      @created_by = User.find(created_by_id)
+      @current_user = @created_by = User.find(created_by_id)
       @access_level = access_level
       @invite_email = invite_email
       @target_url = namespace_project_url(@project.namespace, @project)
 
       mail(to: @created_by.notification_email,
-           subject: subject("Invite declined"))
+           subject: subject("Invitation declined"))
     end
 
     def project_was_moved_email(project_id, user_id)
-- 
GitLab