diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-24 18:52:02 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-03-24 18:52:02 +0300 |
commit | 515e9d51df5a890887248e74b7a96d47a5d0722c (patch) | |
tree | 7e53ad46d17204fdfc7e3822f74667b46887d506 /app | |
parent | 2953e0d19b46a937ee9d84139adbc263c8e89757 (diff) |
Make sure issue assignee is properly reset.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/project_users_select.js.coffee | 7 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 13 | ||||
-rw-r--r-- | app/services/issues/bulk_update_service.rb | 6 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 3 | ||||
-rw-r--r-- | app/services/merge_requests/update_service.rb | 3 |
5 files changed, 12 insertions, 20 deletions
diff --git a/app/assets/javascripts/project_users_select.js.coffee b/app/assets/javascripts/project_users_select.js.coffee index e22c7c11f1c..80ab1a61ab9 100644 --- a/app/assets/javascripts/project_users_select.js.coffee +++ b/app/assets/javascripts/project_users_select.js.coffee @@ -25,7 +25,7 @@ class @ProjectUsersSelect initSelection: (element, callback) -> id = $(element).val() - if id isnt "" + if id != "" && id != "-1" Api.user(id, callback) @@ -44,10 +44,7 @@ class @ProjectUsersSelect else avatar = gon.default_avatar_url - if user.id == '' - avatarMarkup = '' - else - avatarMarkup = "<div class='user-image'><img class='avatar s24' src='#{avatar}'></div>" + avatarMarkup = "<div class='user-image'><img class='avatar s24' src='#{avatar}'></div>" "<div class='user-result'> #{avatarMarkup} diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 15c5dcb6a25..a4bd4d30215 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -58,22 +58,11 @@ module IssuesHelper end def bulk_update_milestone_options - options_for_select(['None (backlog)']) + + options_for_select([['None (backlog)', -1]]) + options_from_collection_for_select(project_active_milestones, 'id', 'title', params[:milestone_id]) end - def bulk_update_assignee_options(project = @project) - options_for_select(['None (unassigned)']) + - options_from_collection_for_select(project.team.members, 'id', - 'name', params[:assignee_id]) - end - - def assignee_options(object, project = @project) - options_from_collection_for_select(project.team.members.sort_by(&:name), - 'id', 'name', object.assignee_id) - end - def milestone_options(object) options_from_collection_for_select(object.project.milestones.active, 'id', 'title', object.milestone_id) diff --git a/app/services/issues/bulk_update_service.rb b/app/services/issues/bulk_update_service.rb index c7cd20b6b60..eb07413ee94 100644 --- a/app/services/issues/bulk_update_service.rb +++ b/app/services/issues/bulk_update_service.rb @@ -4,9 +4,9 @@ module Issues issues_ids = params.delete(:issues_ids).split(",") issue_params = params - issue_params.delete(:state_event) unless issue_params[:state_event].present? - issue_params.delete(:milestone_id) unless issue_params[:milestone_id].present? - issue_params.delete(:assignee_id) unless issue_params[:assignee_id].present? + issue_params.delete(:state_event) unless issue_params[:state_event].present? + issue_params.delete(:milestone_id) unless issue_params[:milestone_id].present? + issue_params.delete(:assignee_id) unless issue_params[:assignee_id].present? issues = Issue.where(id: issues_ids) issues.each do |issue| diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index c61d67a7893..3371fe7d5ef 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -14,6 +14,9 @@ module Issues issue.update_nth_task(params[:task_num].to_i, false) end + params[:assignee_id] = "" if params[:assignee_id] == "-1" + params[:milestone_id] = "" if params[:milestone_id] == "-1" + old_labels = issue.labels.to_a if params.present? && issue.update_attributes(params.except(:state_event, diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index 870b50bb60d..0ac6dfea6fd 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -23,6 +23,9 @@ module MergeRequests merge_request.update_nth_task(params[:task_num].to_i, false) end + params[:assignee_id] = "" if params[:assignee_id] == "-1" + params[:milestone_id] = "" if params[:milestone_id] == "-1" + old_labels = merge_request.labels.to_a if params.present? && merge_request.update_attributes( |