Commit b3ef63a0a547610ba8ac6435674eabc5a2130c3d
1 parent
cf8b465c
Exists in
master
and in
4 other branches
Migrate global project taks. Removed more teams related functionality
Showing
12 changed files
with
7 additions
and
98 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -95,14 +95,6 @@ class ApplicationController < ActionController::Base |
95 | 95 | return access_denied! unless can?(current_user, :create_team, nil) |
96 | 96 | end |
97 | 97 | |
98 | - def authorize_manage_user_team! | |
99 | - return access_denied! unless user_team.present? && can?(current_user, :manage_user_team, user_team) | |
100 | - end | |
101 | - | |
102 | - def authorize_admin_user_team! | |
103 | - return access_denied! unless user_team.present? && can?(current_user, :admin_user_team, user_team) | |
104 | - end | |
105 | - | |
106 | 98 | def access_denied! |
107 | 99 | render "errors/access_denied", layout: "errors", status: 404 |
108 | 100 | end | ... | ... |
app/helpers/admin/teams/members_helper.rb
app/helpers/admin/teams/projects_helper.rb
app/helpers/namespaces_helper.rb
app/models/concerns/issuable.rb
... | ... | @@ -21,7 +21,6 @@ module Issuable |
21 | 21 | scope :opened, -> { with_state(:opened) } |
22 | 22 | scope :closed, -> { with_state(:closed) } |
23 | 23 | scope :of_group, ->(group) { where(project_id: group.project_ids) } |
24 | - scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } | |
25 | 24 | scope :assigned_to, ->(u) { where(assignee_id: u.id)} |
26 | 25 | scope :recent, -> { order("created_at DESC") } |
27 | 26 | scope :assigned, -> { where("assignee_id IS NOT NULL") } | ... | ... |
app/models/project.rb
... | ... | @@ -61,12 +61,6 @@ class Project < ActiveRecord::Base |
61 | 61 | has_many :snippets, dependent: :destroy, class_name: "ProjectSnippet" |
62 | 62 | has_many :hooks, dependent: :destroy, class_name: "ProjectHook" |
63 | 63 | has_many :protected_branches, dependent: :destroy |
64 | - has_many :user_team_project_relationships, dependent: :destroy | |
65 | - | |
66 | - has_many :users, through: :users_projects | |
67 | - has_many :user_teams, through: :user_team_project_relationships | |
68 | - has_many :user_team_user_relationships, through: :user_teams | |
69 | - has_many :user_teams_members, through: :user_team_user_relationships | |
70 | 64 | |
71 | 65 | has_many :deploy_keys_projects, dependent: :destroy |
72 | 66 | has_many :deploy_keys, through: :deploy_keys_projects | ... | ... |
app/views/dashboard/_teams.html.haml
... | ... | @@ -1,23 +0,0 @@ |
1 | -.ui-box.teams-box | |
2 | - %h5.title | |
3 | - Teams | |
4 | - %span.light | |
5 | - (#{teams.count}) | |
6 | - %span.pull-right | |
7 | - = link_to new_team_path, class: "btn btn-small" do | |
8 | - %i.icon-plus | |
9 | - New Team | |
10 | - %ul.well-list | |
11 | - - teams.each do |team| | |
12 | - %li | |
13 | - = link_to team_path(id: team.path), class: dom_class(team) do | |
14 | - %strong.well-title= truncate(team.name, length: 35) | |
15 | - %span.pull-right.light | |
16 | - - if team.owner == current_user | |
17 | - %i.icon-wrench | |
18 | - - tm = current_user.user_team_user_relationships.find_by_user_team_id(team.id) | |
19 | - - if tm | |
20 | - = tm.access_human | |
21 | - - if teams.blank? | |
22 | - %li | |
23 | - %h3.nothing_here_message You have no teams yet. |
app/views/layouts/nav/_team.html.haml
... | ... | @@ -1,25 +0,0 @@ |
1 | -%ul | |
2 | - = nav_link(path: 'teams#show', html_options: {class: 'home'}) do | |
3 | - = link_to team_path(@team), title: "Home" do | |
4 | - %i.icon-home | |
5 | - | |
6 | - = nav_link(path: 'teams#issues') do | |
7 | - = link_to issues_team_path(@team) do | |
8 | - Issues | |
9 | - %span.count= Issue.opened.of_user_team(@team).count | |
10 | - | |
11 | - = nav_link(path: 'teams#merge_requests') do | |
12 | - = link_to merge_requests_team_path(@team) do | |
13 | - Merge Requests | |
14 | - %span.count= MergeRequest.opened.of_user_team(@team).count | |
15 | - | |
16 | - = nav_link(controller: [:members]) do | |
17 | - = link_to team_members_path(@team), class: "team-tab tab" do | |
18 | - Members | |
19 | - %span.count= @team.members.count | |
20 | - | |
21 | - - if can? current_user, :manage_user_team, @team | |
22 | - = nav_link(path: 'teams#edit') do | |
23 | - = link_to edit_team_path(@team), class: "stat-tab tab " do | |
24 | - Settings | |
25 | - |
app/views/team_members/_assigned_team.html.haml
... | ... | @@ -1,10 +0,0 @@ |
1 | -%li{id: dom_id(team), class: "user_team_row team_#{team.id}"} | |
2 | - .pull-right | |
3 | - - if can?(current_user, :admin_team_member, @project) | |
4 | - = link_to resign_project_team_path(@project, team), method: :delete, confirm: "Are you sure?", class: "btn btn-remove btn-tiny" do | |
5 | - %i.icon-minus.icon-white | |
6 | - | |
7 | - %strong= link_to team.name, team_path(team), title: team.name, class: "dark" | |
8 | - %br | |
9 | - %small.cgray Members: #{team.members.count} | |
10 | - %small.cgray Max access: #{team_relation.human_max_access} |
app/views/team_members/_assigned_teams.html.haml
app/views/team_members/index.html.haml
... | ... | @@ -24,10 +24,3 @@ |
24 | 24 | |
25 | 25 | - else |
26 | 26 | = render "team_members/team", members: @users_projects |
27 | - | |
28 | -- if @assigned_teams.present? | |
29 | - %h5 | |
30 | - Assigned teams | |
31 | - (#{@project.user_teams.count}) | |
32 | - %div | |
33 | - = render "team_members/assigned_teams", assigned_teams: @assigned_teams | ... | ... |
lib/tasks/migrate/migrate_global_projects.rake
... | ... | @@ -4,9 +4,13 @@ task migrate_global_projects: :environment do |
4 | 4 | ask_to_continue |
5 | 5 | |
6 | 6 | Project.where(namespace_id: nil).find_each(batch_size: 20) do |project| |
7 | - | |
8 | - # TODO: transfer code here | |
9 | - print '.' | |
7 | + begin | |
8 | + project.transfer(project.owner.namespace) | |
9 | + print '.' | |
10 | + rescue => ex | |
11 | + puts ex.message | |
12 | + print 'F' | |
13 | + end | |
10 | 14 | end |
11 | 15 | end |
12 | 16 | ... | ... |