Allow to edit access expiration date.
This commit is contained in:
parent
245f237dc8
commit
f564535579
|
@ -99,7 +99,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController
|
|||
protected
|
||||
|
||||
def member_params
|
||||
params.require(:project_member).permit(:user_id, :access_level)
|
||||
params.require(:project_member).permit(:user_id, :access_level, :expires_at)
|
||||
end
|
||||
|
||||
# MembershipActions concern
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
= button_tag icon('pencil'),
|
||||
type: 'button',
|
||||
class: 'btn inline js-toggle-button',
|
||||
title: 'Edit access level'
|
||||
title: 'Edit'
|
||||
|
||||
- if member.request?
|
||||
= link_to icon('check inverse'), polymorphic_path([:approve_access_request, member]),
|
||||
|
@ -80,5 +80,7 @@
|
|||
= form_for member, remote: true do |f|
|
||||
.prepend-top-10
|
||||
= f.select :access_level, options_for_select(member.class.access_level_roles, member.access_level), {}, class: 'form-control'
|
||||
.prepend-top-10
|
||||
= f.text_field :expires_at, class: 'form-control', placeholder: 'Access expiration date'
|
||||
.prepend-top-10
|
||||
= f.submit 'Save', class: 'btn btn-save btn-sm'
|
||||
|
|
|
@ -116,7 +116,7 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps
|
|||
member = mary_jane_member
|
||||
|
||||
page.within "#group_member_#{member.id}" do
|
||||
click_button "Edit access level"
|
||||
click_button 'Edit'
|
||||
select 'Developer', from: 'group_member_access_level'
|
||||
click_on 'Save'
|
||||
end
|
||||
|
|
|
@ -65,7 +65,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
|
|||
user = User.find_by(name: 'Dmitriy')
|
||||
project_member = project.project_members.find_by(user_id: user.id)
|
||||
page.within "#project_member_#{project_member.id}" do
|
||||
click_button "Edit access level"
|
||||
click_button 'Edit'
|
||||
select "Reporter", from: "project_member_access_level"
|
||||
click_button "Save"
|
||||
end
|
||||
|
|
|
@ -10,18 +10,31 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
|
|||
background do
|
||||
project.team << [master, :master]
|
||||
login_as(master)
|
||||
visit namespace_project_project_members_path(project.namespace, project)
|
||||
end
|
||||
|
||||
scenario 'expiration date is displayed in the members list' do
|
||||
page.within ".users-project-form" do
|
||||
select2(new_member.id, from: "#user_ids", multiple: true)
|
||||
fill_in "Access expiration date", with: 4.days.from_now
|
||||
click_on "Add users to project"
|
||||
visit namespace_project_project_members_path(project.namespace, project)
|
||||
|
||||
page.within '.users-project-form' do
|
||||
select2(new_member.id, from: '#user_ids', multiple: true)
|
||||
fill_in 'Access expiration date', with: 4.days.from_now
|
||||
click_on 'Add users to project'
|
||||
end
|
||||
|
||||
page.within ".project_member:first-child" do
|
||||
expect(page).to have_content("Expires in 4 days")
|
||||
page.within '.project_member:first-child' do
|
||||
expect(page).to have_content('Expires in 4 days')
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'change expiration date' do
|
||||
project.team.add_users([new_member.id], :developer, expires_at: 1.month.from_now)
|
||||
visit namespace_project_project_members_path(project.namespace, project)
|
||||
|
||||
page.within '.project_member:first-child' do
|
||||
click_on 'Edit'
|
||||
fill_in 'Access expiration date', with: 2.days.from_now
|
||||
click_on 'Save'
|
||||
expect(page).to have_content('Expires in 2 days')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue