Commit 2a1d4255 authored by Douwe Maan's avatar Douwe Maan

Correctly render invite members without user.

parent cee98f22
module GroupsHelper module GroupsHelper
def remove_user_from_group_message(group, user) def remove_user_from_group_message(group, member)
"Are you sure you want to remove \"#{user.name}\" from \"#{group.name}\"?" 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}\"?"
end
end end
def leave_group_message(group) def leave_group_message(group)
......
module ProjectsHelper module ProjectsHelper
def remove_from_project_team_message(project, user) def remove_from_project_team_message(project, member)
"You are going to remove #{user.name} from #{project.name} project team. Are you sure?" 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?"
end
end end
def link_to_project(project) def link_to_project(project)
......
...@@ -74,13 +74,18 @@ ...@@ -74,13 +74,18 @@
%ul.well-list.group-users-list %ul.well-list.group-users-list
- @members.each do |member| - @members.each do |member|
- user = member.user - user = member.user
%li{class: dom_class(member), id: dom_id(user)} %li{class: dom_class(member), id: (dom_id(user) if user)}
.list-item-name .list-item-name
%strong - if user
= link_to user.name, admin_user_path(user) %strong
= link_to user.name, admin_user_path(user)
- else
%strong
= member.invite_email
(invited)
%span.pull-right.light %span.pull-right.light
= member.human_access = member.human_access
= link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, user) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do = link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
%i.fa.fa-minus.fa-inverse %i.fa.fa-minus.fa-inverse
.panel-footer .panel-footer
= paginate @members, param_name: 'members_page', theme: 'gitlab' = paginate @members, param_name: 'members_page', theme: 'gitlab'
...@@ -124,14 +124,19 @@ ...@@ -124,14 +124,19 @@
- user = project_member.user - user = project_member.user
%li.project_member %li.project_member
.list-item-name .list-item-name
%strong - if user
= link_to user.name, admin_user_path(user) %strong
= link_to user.name, admin_user_path(user)
- else
%strong
= project_member.invite_email
(invited)
.pull-right .pull-right
- if project_member.owner? - if project_member.owner?
%span.light Owner %span.light Owner
- else - else
%span.light= project_member.human_access %span.light= project_member.human_access
= link_to namespace_project_project_member_path(@project.namespace, @project, project_member), data: { confirm: remove_from_project_team_message(@project, user)}, method: :delete, remote: true, class: "btn btn-sm btn-remove" do = link_to namespace_project_project_member_path(@project.namespace, @project, project_member), data: { confirm: remove_from_project_team_message(@project, project_member)}, method: :delete, remote: true, class: "btn btn-sm btn-remove" do
%i.fa.fa-times %i.fa.fa-times
.panel-footer .panel-footer
= paginate @project_members, param_name: 'project_members_page', theme: 'gitlab' = paginate @project_members, param_name: 'project_members_page', theme: 'gitlab'
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
.pull-right .pull-right
%span.light= group_member.human_access %span.light= group_member.human_access
- unless group_member.owner? - unless group_member.owner?
= link_to group_group_member_path(group, group_member), data: { confirm: remove_user_from_group_message(group, @user) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do = link_to group_group_member_path(group, group_member), data: { confirm: remove_user_from_group_message(group, group_member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
%i.fa.fa-times.fa-inverse %i.fa.fa-times.fa-inverse
- else - else
.nothing-here-block This user has no groups. .nothing-here-block This user has no groups.
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
%span.light= member.human_access %span.light= member.human_access
- if member.respond_to? :project - if member.respond_to? :project
= link_to namespace_project_project_member_path(project.namespace, project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from project' do = link_to namespace_project_project_member_path(project.namespace, project, member), data: { confirm: remove_from_project_team_message(project, member) }, remote: true, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from project' do
%i.fa.fa-times %i.fa.fa-times
#ssh-keys.tab-pane #ssh-keys.tab-pane
= render 'profiles/keys/key_table', admin: true = render 'profiles/keys/key_table', admin: true
- user = member.user - user = member.user
- return unless user - return unless user || member.invite?
- show_roles = true if show_roles.nil? - show_roles = true if show_roles.nil?
%li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)} %li{class: "#{dom_class(member)} js-toggle-container", id: dom_id(member)}
%span{class: ("list-item-name" if show_controls)} %span{class: ("list-item-name" if show_controls)}
= image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: '' - if member.user
%strong= user.name = image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: ''
%span.cgray= user.username %strong= user.name
- if user == current_user %span.cgray= user.username
%span.label.label-success It's you - if user == current_user
- if user.blocked? %span.label.label-success It's you
%label.label.label-danger - if user.blocked?
%strong Blocked %label.label.label-danger
%strong Blocked
- else
= image_tag avatar_icon(member.invite_email, 16), class: "avatar s16", alt: ''
%strong
= member.invite_email
%span.cgray
invited
- if member.created_by
by
= link_to member.created_by.name, user_path(member.created_by)
= time_ago_with_tooltip(member.created_at)
- if show_roles - if show_roles
%span.pull-right %span.pull-right
...@@ -27,7 +38,7 @@ ...@@ -27,7 +38,7 @@
= link_to leave_group_group_members_path(@group), data: { confirm: leave_group_message(@group.name)}, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from group' do = link_to leave_group_group_members_path(@group), data: { confirm: leave_group_message(@group.name)}, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
%i.fa.fa-minus.fa-inverse %i.fa.fa-minus.fa-inverse
- else - else
= link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, user) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do = link_to group_group_member_path(@group, member), data: { confirm: remove_user_from_group_message(@group, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
%i.fa.fa-minus.fa-inverse %i.fa.fa-minus.fa-inverse
.edit-member.hide.js-toggle-content .edit-member.hide.js-toggle-content
......
- user = member.user - user = member.user
- return unless user - return unless user || member.invite?
%li{class: "#{dom_class(member)} js-toggle-container project_member_row access-#{member.human_access.downcase}", id: dom_id(member)} %li{class: "#{dom_class(member)} js-toggle-container project_member_row access-#{member.human_access.downcase}", id: dom_id(member)}
%span.list-item-name %span.list-item-name
= image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: '' - if member.user
%strong= user.name = image_tag avatar_icon(user.email, 16), class: "avatar s16", alt: ''
%span.cgray= user.username %strong
- if user == current_user = link_to user.name, user_path(user)
%span.label.label-success It's you %span.cgray= user.username
- if user.blocked? - if user == current_user
%label.label.label-danger %span.label.label-success It's you
%strong Blocked - if user.blocked?
%label.label.label-danger
%strong Blocked
- else
= image_tag avatar_icon(member.invite_email, 16), class: "avatar s16", alt: ''
%strong
= member.invite_email
%span.cgray
invited
- if member.created_by
by
= link_to member.created_by.name, user_path(member.created_by)
= time_ago_with_tooltip(member.created_at)
- if current_user_can_admin_project - if current_user_can_admin_project
- unless @project.personal? && user == current_user - unless @project.personal? && user == current_user
...@@ -25,7 +37,7 @@ ...@@ -25,7 +37,7 @@
= link_to leave_namespace_project_project_members_path(@project.namespace, @project), data: { confirm: "Leave project?"}, method: :delete, class: "btn-xs btn btn-remove", title: 'Leave project' do = link_to leave_namespace_project_project_members_path(@project.namespace, @project), data: { confirm: "Leave project?"}, method: :delete, class: "btn-xs btn btn-remove", title: 'Leave project' do
%i.fa.fa-minus.fa-inverse %i.fa.fa-minus.fa-inverse
- else - else
= link_to namespace_project_project_member_path(@project.namespace, @project, member), data: { confirm: remove_from_project_team_message(@project, user) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from team' do = link_to namespace_project_project_member_path(@project.namespace, @project, member), data: { confirm: remove_from_project_team_message(@project, member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from team' do
%i.fa.fa-minus.fa-inverse %i.fa.fa-minus.fa-inverse
.edit-member.hide.js-toggle-content .edit-member.hide.js-toggle-content
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment