Commit cf129d6f authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '6-6-3-patch' into '6-6-stable'

6.6.3 Patch

Fixes 500 error when try to edit own user via admin area
parents 4ef83692 98f4665e
......@@ -68,7 +68,9 @@ class Admin::UsersController < Admin::ApplicationController
params[:user].delete(:password_confirmation)
end
user.admin = (admin && admin.to_i > 0)
if admin.present?
user.admin = !admin.to_i.zero?
end
respond_to do |format|
if user.update_attributes(params[:user], as: :admin)
......
......@@ -11,6 +11,7 @@ class UsersController < ApplicationController
end
@events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
@title = @user.name
@groups = @projects.map(&:group).compact.uniq
end
def determine_layout
......
......@@ -14,7 +14,7 @@
%small member since #{@user.created_at.stamp("Nov 12, 2031")}
.clearfix
%h4 Groups:
= render 'groups', groups: @user.groups
= render 'groups', groups: @groups
%hr
%h4 User Activity:
= render @events
......
......@@ -14,3 +14,9 @@ Feature: Admin Users
And Click save
Then See username error message
And Not changed form action url
Scenario: Edit my user attributes
Given I visit admin users page
And click edit on my user
When I submit modified user
Then I see user attributes changed
......@@ -31,4 +31,17 @@ class AdminUsers < Spinach::FeatureSteps
And 'Not changed form action url' do
page.should have_selector %(form[action="/admin/users/#{@user.username}"])
end
step 'I submit modified user' do
check :user_can_create_group
click_button 'Save'
end
step 'I see user attributes changed' do
page.should have_content 'Can create groups: Yes'
end
step 'click edit on my user' do
find("#edit_user_#{current_user.id}").click
end
end
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