diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-14 16:16:00 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-14 16:16:00 +0300 |
commit | cb5362e7ce0496e4fa7bec4ae629fd24e93d721e (patch) | |
tree | 4375ae5e99f11d51032559a95c12f1491bcd9e1f /app | |
parent | 0013ea5130494326f37fb1d6988a369fa2c91d22 (diff) |
Follow newline guidelines.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/invites_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/projects/project_members_controller.rb | 1 | ||||
-rw-r--r-- | app/mailers/emails/groups.rb | 7 | ||||
-rw-r--r-- | app/mailers/emails/projects.rb | 6 | ||||
-rw-r--r-- | app/models/members/project_member.rb | 1 |
6 files changed, 25 insertions, 4 deletions
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 359eeb4d27a..265cf4f0f4a 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -48,13 +48,16 @@ class Groups::GroupMembersController < Groups::ApplicationController end def resend_invite + redirect_path = group_group_members_path(@group) + @group_member = @group.group_members.find(params[:id]) + if @group_member.invite? @group_member.resend_invite - redirect_to group_group_members_path(@group), notice: 'The invitation was successfully resent.' + redirect_to redirect_path, notice: 'The invitation was successfully resent.' else - redirect_to group_group_members_path(@group), alert: 'The invitation has already been accepted.' + redirect_to redirect_path, alert: 'The invitation has already been accepted.' end end diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 3ac8654fcce..1f97ff16c55 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -43,10 +43,13 @@ class InvitesController < ApplicationController return @member if defined?(@member) @token = params[:id] - @member = Member.find_by_invite_token(@token) - render_404 unless @member + unless @member + render_404 and return + end + + @member end def authenticate_user! diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 3da44cbc9d6..72967a26ff1 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -62,6 +62,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController 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 diff --git a/app/mailers/emails/groups.rb b/app/mailers/emails/groups.rb index 07b8f6d735a..1c43f95dc8c 100644 --- a/app/mailers/emails/groups.rb +++ b/app/mailers/emails/groups.rb @@ -3,8 +3,10 @@ module Emails def group_access_granted_email(group_member_id) @group_member = GroupMember.find(group_member_id) @group = @group_member.group + @target_url = group_url(@group) @current_user = @group_member.user + mail(to: @group_member.user.notification_email, subject: subject("Access to group was granted")) end @@ -13,8 +15,10 @@ module Emails @group_member = GroupMember.find group_member_id @group = @group_member.group @token = token + @target_url = group_url(@group) @current_user = @group_member.user + mail(to: @group_member.invite_email, subject: "Invitation to join group #{@group.name}") end @@ -24,8 +28,10 @@ module Emails return if @group_member.created_by.nil? @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("Invitation accepted")) end @@ -37,6 +43,7 @@ module Emails @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("Invitation declined")) diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index 7baeead3fb5..2584e9d48b1 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -3,8 +3,10 @@ module Emails def project_access_granted_email(project_member_id) @project_member = ProjectMember.find project_member_id @project = @project_member.project + @target_url = namespace_project_url(@project.namespace, @project) @current_user = @project_member.user + mail(to: @project_member.user.notification_email, subject: subject("Access to project was granted")) end @@ -13,8 +15,10 @@ module Emails @project_member = ProjectMember.find project_member_id @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: "Invitation to join project #{@project.name_with_namespace}") end @@ -24,6 +28,7 @@ module Emails return if @project_member.created_by.nil? @project = @project_member.project + @target_url = namespace_project_url(@project.namespace, @project) @current_user = @project_member.created_by @@ -38,6 +43,7 @@ module Emails @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, diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index ce704a60d63..0a3b4d2182b 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -80,6 +80,7 @@ class ProjectMember < Member def truncate_teams(project_ids) ProjectMember.transaction do members = ProjectMember.where(source_id: project_ids) + members.each do |member| member.destroy end |