summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin/users_controller.rb5
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--app/views/admin/users/show.html.haml22
-rw-r--r--app/views/dashboard/projects.html.haml4
-rw-r--r--spec/factories.rb1
-rw-r--r--spec/features/admin/admin_users_spec.rb14
-rw-r--r--spec/models/user_spec.rb8
7 files changed, 7 insertions, 49 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index ec3209fdfe2..36c6f3af41c 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -9,11 +9,6 @@ class Admin::UsersController < Admin::ApplicationController
end
def show
- # Projects user can be added to
- @not_in_projects = Project.scoped
- @not_in_projects = @not_in_projects.without_user(admin_user) if admin_user.authorized_projects.present?
-
- # Projects he already own or joined
@projects = admin_user.authorized_projects
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 028af8ff59f..4947c33f959 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -3,7 +3,7 @@ class UsersController < ApplicationController
def show
@user = User.find_by_username!(params[:username])
- @projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id)).order('namespace_id DESC')
+ @projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id))
@events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
@title = @user.name
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index b8fa41898d5..a95bc819a4d 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -63,28 +63,6 @@
%strong
= link_to @admin_user.created_by.name, [:admin, @admin_user.created_by]
- %hr
- %h5
- Add User to Projects
- %small
- Read more about project permissions
- %strong= link_to "here", help_permissions_path, class: "vlink"
- %br
- = form_tag team_update_admin_user_path(@admin_user), class: "bulk_import", method: :put do
- .control-group
- = label_tag :project_ids, "Projects", class: 'control-label'
- .controls
- = select_tag :project_ids, options_from_collection_for_select(@not_in_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span3'
- .control-group
- = label_tag :project_access, "Project Access", class: 'control-label'
- .controls
- = select_tag :project_access, options_for_select(Project.access_options), class: "project-access-select chosen span3"
-
- .form-actions
- = submit_tag 'Add', class: "btn btn-create"
- .pull-right
- %br
-
- if @admin_user.owned_groups.present?
.ui-box
%h5.title Owned groups:
diff --git a/app/views/dashboard/projects.html.haml b/app/views/dashboard/projects.html.haml
index 683052eadaa..5c5fa528fab 100644
--- a/app/views/dashboard/projects.html.haml
+++ b/app/views/dashboard/projects.html.haml
@@ -24,6 +24,8 @@
.ui-box
%h5.title
Projects (#{@projects.total_count})
+ .pull-right.light
+ %small Last activity
%ul.well-list
- @projects.each do |project|
%li
@@ -39,7 +41,7 @@
= truncate project.description, length: 80
.pull-right.light
- %small Last activity #{project_last_activity(project)}
+ %small #{project_last_activity(project)}
- if @projects.blank?
%li
diff --git a/spec/factories.rb b/spec/factories.rb
index b596f80fa9e..b6ef87d4c2a 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -27,6 +27,7 @@ FactoryGirl.define do
sequence(:name) { |n| "project#{n}" }
path { name.downcase.gsub(/\s/, '_') }
creator
+ namespace { creator.namespace }
end
factory :redmine_project, parent: :project do
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb
index 15de101a17a..2aaa4e97340 100644
--- a/spec/features/admin/admin_users_spec.rb
+++ b/spec/features/admin/admin_users_spec.rb
@@ -109,18 +109,4 @@ describe "Admin::Users" do
end
end
end
-
- describe "Add new project" do
- before do
- @new_project = create(:project)
- visit admin_user_path(@user)
- end
-
- it "should create new user" do
- select @new_project.name, from: "project_ids"
- expect { click_button "Add" }.to change { UsersProject.count }.by(1)
- page.should have_content @new_project.name
- current_path.should == admin_user_path(@user)
- end
- end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index f8b788a5f63..92a371ede05 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -111,12 +111,8 @@ describe User do
@project_2 = create :project # Grant MASTER access to the user
@project_3 = create :project # Grant DEVELOPER access to the user
- UsersProject.add_users_into_projects(
- [@project_2.id], [@user.id], UsersProject::MASTER
- )
- UsersProject.add_users_into_projects(
- [@project_3.id], [@user.id], UsersProject::DEVELOPER
- )
+ @project_2.team << [@user, :master]
+ @project_3.team << [@user, :developer]
end
it { @user.authorized_projects.should include(@project) }