diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-03-10 09:19:12 +0100 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-03-13 08:27:52 +0100 |
commit | ea70a0d674539d53e40c63a0a3cebef33d7e13b7 (patch) | |
tree | 8d4e9f1801c33ab87b7a266528f81de0a812bef1 /app | |
parent | a07e89b2751f1855e2fe4bdf05a5967fd7421778 (diff) | |
download | gitlab-ce-ea70a0d674539d53e40c63a0a3cebef33d7e13b7.tar.gz |
Rename variable
merge_request_for_resolving_discussions ->
merge_request_to_resolve_discussions_of
Diffstat (limited to 'app')
9 files changed, 26 insertions, 27 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 35d1a52b251..91fe6662164 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -65,13 +65,13 @@ class Projects::IssuesController < Projects::ApplicationController assignee_id: "" ) build_params = issue_params.merge( - merge_request_for_resolving_discussions: params[:merge_request_for_resolving_discussions], + merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of], discussion_to_resolve: params[:discussion_to_resolve] ) service = Issues::BuildService.new(project, current_user, build_params) @issue = @noteable = service.execute - @merge_request_for_resolving_discussions = service.merge_request_for_resolving_discussions + @merge_request_to_resolve_discussions_of = service.merge_request_to_resolve_discussions_of @discussion_to_resolve = service.discussions_to_resolve.first if params[:discussion_to_resolve] respond_with(@issue) @@ -102,7 +102,7 @@ class Projects::IssuesController < Projects::ApplicationController def create create_params = issue_params.merge(spammable_params).merge( - merge_request_for_resolving_discussions: params[:merge_request_for_resolving_discussions], + merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of], discussion_to_resolve: params[:discussion_to_resolve] ) @@ -248,7 +248,6 @@ class Projects::IssuesController < Projects::ApplicationController def issue_params params.require(:issue).permit( :title, :assignee_id, :position, :description, :confidential, - :discussion_to_resolve, :merge_request_for_resolving_discussions, :milestone_id, :due_date, :state_event, :task_num, :lock_version, label_ids: [] ) end diff --git a/app/services/issues/build_service.rb b/app/services/issues/build_service.rb index 3d4b6b055c4..510b32a77ab 100644 --- a/app/services/issues/build_service.rb +++ b/app/services/issues/build_service.rb @@ -8,23 +8,23 @@ module Issues end def issue_params_with_info_from_discussions - return {} unless merge_request_for_resolving_discussions + return {} unless merge_request_to_resolve_discussions_of { title: title_from_merge_request, description: description_for_discussions } end def title_from_merge_request - "Follow-up from \"#{merge_request_for_resolving_discussions.title}\"" + "Follow-up from \"#{merge_request_to_resolve_discussions_of.title}\"" end def description_for_discussions if discussions_to_resolve.empty? return "There are no unresolved discussions. "\ - "Review the conversation in #{merge_request_for_resolving_discussions.to_reference}" + "Review the conversation in #{merge_request_to_resolve_discussions_of.to_reference}" end description = "The following #{'discussion'.pluralize(discussions_to_resolve.size)} "\ - "from #{merge_request_for_resolving_discussions.to_reference} "\ + "from #{merge_request_to_resolve_discussions_of.to_reference} "\ "should be addressed:" [description, *items_for_discussions].join("\n\n") diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index 175312aed91..3cf4b82b9f2 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -29,7 +29,7 @@ module Issues return if discussions_to_resolve.empty? Discussions::ResolveService.new(project, current_user, - merge_request: merge_request_for_resolving_discussions, + merge_request: merge_request_to_resolve_discussions_of, follow_up_issue: issue). execute(discussions_to_resolve) end diff --git a/app/services/issues/resolve_discussions.rb b/app/services/issues/resolve_discussions.rb index 89105dceb5f..297c7d696c3 100644 --- a/app/services/issues/resolve_discussions.rb +++ b/app/services/issues/resolve_discussions.rb @@ -1,30 +1,30 @@ module Issues module ResolveDiscussions - attr_reader :merge_request_for_resolving_discussions_iid, :discussion_to_resolve_id + attr_reader :merge_request_to_resolve_discussions_of_iid, :discussion_to_resolve_id def filter_resolve_discussion_params - @merge_request_for_resolving_discussions_iid ||= params.delete(:merge_request_for_resolving_discussions) + @merge_request_to_resolve_discussions_of_iid ||= params.delete(:merge_request_to_resolve_discussions_of) @discussion_to_resolve_id ||= params.delete(:discussion_to_resolve) end - def merge_request_for_resolving_discussions - return @merge_request_for_resolving_discussions if defined?(@merge_request_for_resolving_discussions) + def merge_request_to_resolve_discussions_of + return @merge_request_to_resolve_discussions_of if defined?(@merge_request_to_resolve_discussions_of) - @merge_request_for_resolving_discussions = MergeRequestsFinder.new(current_user, project_id: project.id). + @merge_request_to_resolve_discussions_of = MergeRequestsFinder.new(current_user, project_id: project.id). execute. - find_by(iid: merge_request_for_resolving_discussions_iid) + find_by(iid: merge_request_to_resolve_discussions_of_iid) end def discussions_to_resolve - return [] unless merge_request_for_resolving_discussions + return [] unless merge_request_to_resolve_discussions_of @discussions_to_resolve ||= if discussion_to_resolve_id - discussion_or_nil = merge_request_for_resolving_discussions + discussion_or_nil = merge_request_to_resolve_discussions_of .find_diff_discussion(discussion_to_resolve_id) Array(discussion_or_nil) else - merge_request_for_resolving_discussions + merge_request_to_resolve_discussions_of .resolvable_discussions end end diff --git a/app/views/discussions/_new_issue_for_all_discussions.html.haml b/app/views/discussions/_new_issue_for_all_discussions.html.haml index 01c5a7b4e54..ca9e0e8728a 100644 --- a/app/views/discussions/_new_issue_for_all_discussions.html.haml +++ b/app/views/discussions/_new_issue_for_all_discussions.html.haml @@ -3,4 +3,4 @@ .btn.btn-default.discussion-create-issue-btn.has-tooltip{ title: "Resolve all discussions in new issue", "aria-label" => "Resolve all discussions in a new issue", "data-container" => "body" } - = link_to custom_icon('icon_mr_issue'), new_namespace_project_issue_path(@project.namespace, @project, merge_request_for_resolving_discussions: merge_request.iid), title: "Resolve all discussions in new issue", class: 'new-issue-for-discussion' + = link_to custom_icon('icon_mr_issue'), new_namespace_project_issue_path(@project.namespace, @project, merge_request_to_resolve_discussions_of: merge_request.iid), title: "Resolve all discussions in new issue", class: 'new-issue-for-discussion' diff --git a/app/views/discussions/_new_issue_for_discussion.html.haml b/app/views/discussions/_new_issue_for_discussion.html.haml index c21ec0ecc3d..df5546a1e32 100644 --- a/app/views/discussions/_new_issue_for_discussion.html.haml +++ b/app/views/discussions/_new_issue_for_discussion.html.haml @@ -5,4 +5,4 @@ .btn.btn-default.discussion-create-issue-btn.has-tooltip{ title: "Resolve this discussion in a new issue", "aria-label" => "Resolve this discussion in a new issue", "data-container" => "body" } - = link_to custom_icon('icon_mr_issue'), new_namespace_project_issue_path(@project.namespace, @project, merge_request_for_resolving_discussions: merge_request.iid, discussion_to_resolve: discussion.id), title: "Resolve this discussion in a new issue", class: 'new-issue-for-discussion' + = link_to custom_icon('icon_mr_issue'), new_namespace_project_issue_path(@project.namespace, @project, merge_request_to_resolve_discussions_of: merge_request.iid, discussion_to_resolve: discussion.id), title: "Resolve this discussion in a new issue", class: 'new-issue-for-discussion' diff --git a/app/views/projects/issues/verify.html.haml b/app/views/projects/issues/verify.html.haml index a3e394a0add..6da7c317f3a 100644 --- a/app/views/projects/issues/verify.html.haml +++ b/app/views/projects/issues/verify.html.haml @@ -1,5 +1,5 @@ - form = [@project.namespace.becomes(Namespace), @project, @issue] = render layout: 'layouts/recaptcha_verification', locals: { spammable: @issue, form: form } do - = hidden_field_tag(:merge_request_for_resolving_discussions, params[:merge_request_for_resolving_discussions]) + = hidden_field_tag(:merge_request_to_resolve_discussions_of, params[:merge_request_to_resolve_discussions_of]) = hidden_field_tag(:discussion_to_resolve, params[:discussion_to_resolve]) diff --git a/app/views/projects/merge_requests/widget/open/_unresolved_discussions.html.haml b/app/views/projects/merge_requests/widget/open/_unresolved_discussions.html.haml index e094f97f3b6..ec9346ce89b 100644 --- a/app/views/projects/merge_requests/widget/open/_unresolved_discussions.html.haml +++ b/app/views/projects/merge_requests/widget/open/_unresolved_discussions.html.haml @@ -6,5 +6,5 @@ Please resolve these discussions - if @project.issues_enabled? && can?(current_user, :create_issue, @project) or - = link_to "open an issue to resolve them later", new_namespace_project_issue_path(@project.namespace, @project, merge_request_for_resolving_discussions: @merge_request.iid) + = link_to "open an issue to resolve them later", new_namespace_project_issue_path(@project.namespace, @project, merge_request_to_resolve_discussions_of: @merge_request.iid) to allow this merge request to be merged. diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index 9e7b48ca79c..0b0f2c9cd1a 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -45,23 +45,23 @@ = render 'shared/issuable/form/merge_params', issuable: issuable -- if @merge_request_for_resolving_discussions +- if @merge_request_to_resolve_discussions_of .form-group .col-sm-10.col-sm-offset-2 = icon('info-circle') - - if @merge_request_for_resolving_discussions.discussions_can_be_resolved_by?(current_user) - = hidden_field_tag 'merge_request_for_resolving_discussions', @merge_request_for_resolving_discussions.iid + - if @merge_request_to_resolve_discussions_of.discussions_can_be_resolved_by?(current_user) + = hidden_field_tag 'merge_request_to_resolve_discussions_of', @merge_request_to_resolve_discussions_of.iid - if @discussion_to_resolve = hidden_field_tag 'discussion_to_resolve', @discussion_to_resolve.id Creating this issue will resolve the discussion in - else Creating this issue will resolve all discussions in - = link_to_discussions_to_resolve(@merge_request_for_resolving_discussions, @discussion_to_resolve) + = link_to_discussions_to_resolve(@merge_request_to_resolve_discussions_of, @discussion_to_resolve) - else The = @discussion_to_resolve ? 'discussion' : 'discussions' at - = link_to_discussions_to_resolve(@merge_request_for_resolving_discussions, @discussion_to_resolve) + = link_to_discussions_to_resolve(@merge_request_to_resolve_discussions_of, @discussion_to_resolve) will stay unresolved. Ask someone with permission to resolve = @discussion_to_resolve ? 'it.' : 'them.' |