Commit e10c3757 authored by Sean McGivern's avatar Sean McGivern

Merge branch '288836-cleanup-some-unused-issuable-helper-methods' into 'master'

Cleanup some unused issuable helper methods

See merge request gitlab-org/gitlab!48707
parents 7090019c 48496e1f
......@@ -61,16 +61,6 @@ module IssuablesHelper
end
end
def issuable_json_path(issuable)
project = issuable.project
if issuable.is_a?(MergeRequest)
project_merge_request_path(project, issuable.iid, :json)
else
project_issue_path(project, issuable.iid, :json)
end
end
def serialize_issuable(issuable, opts = {})
serializer_klass = case issuable
when Issue
......@@ -174,18 +164,7 @@ module IssuablesHelper
h(title || default_label)
end
def to_url_reference(issuable)
case issuable
when Issue
link_to issuable.to_reference, issue_url(issuable)
when MergeRequest
link_to issuable.to_reference, merge_request_url(issuable)
else
issuable.to_reference
end
end
def issuable_meta(issuable, project, text)
def issuable_meta(issuable, project)
output = []
output << "Opened #{time_ago_with_tooltip(issuable.created_at)} by ".html_safe
......@@ -340,10 +319,6 @@ module IssuablesHelper
issuable_path(issuable, close_reopen_params(issuable, :reopen))
end
def close_reopen_issuable_path(issuable, should_inverse = false)
issuable.closed? ^ should_inverse ? reopen_issuable_path(issuable) : close_issuable_path(issuable)
end
def toggle_draft_issuable_path(issuable)
wip_event = issuable.work_in_progress? ? 'unwip' : 'wip'
......@@ -354,28 +329,6 @@ module IssuablesHelper
polymorphic_path(issuable, *options)
end
def issuable_url(issuable, *options)
case issuable
when Issue
issue_url(issuable, *options)
when MergeRequest
merge_request_url(issuable, *options)
end
end
def issuable_button_visibility(issuable, closed)
return 'hidden' if issuable_button_hidden?(issuable, closed)
end
def issuable_button_hidden?(issuable, closed)
case issuable
when Issue
issue_button_hidden?(issuable, closed)
when MergeRequest
merge_request_button_hidden?(issuable, closed)
end
end
def issuable_author_is_current_user(issuable)
issuable.author == current_user
end
......
......@@ -2,7 +2,7 @@
- can_update_merge_request = can?(current_user, :update_merge_request, @merge_request)
- can_reopen_merge_request = can?(current_user, :reopen_merge_request, @merge_request)
- state_human_name, state_icon_name = state_name_with_icon(@merge_request)
- are_close_and_open_buttons_hidden = issuable_button_hidden?(@merge_request, true) && issuable_button_hidden?(@merge_request, false)
- are_close_and_open_buttons_hidden = merge_request_button_hidden?(@merge_request, true) && merge_request_button_hidden?(@merge_request, false)
- if @merge_request.closed_without_fork?
.gl-alert.gl-alert-danger.gl-mb-5
......@@ -19,7 +19,7 @@
.issuable-meta
#js-issuable-header-warnings
= issuable_meta(@merge_request, @project, "Merge request")
= issuable_meta(@merge_request, @project)
%a.btn.btn-default.float-right.d-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" }
= sprite_icon('chevron-double-lg-left')
......@@ -50,4 +50,4 @@
- if can_update_merge_request && !are_close_and_open_buttons_hidden
= render 'shared/issuable/close_reopen_draft_report_toggle', issuable: @merge_request
- elsif !@merge_request.merged?
= link_to _('Report abuse'), new_abuse_report_path(user_id: @merge_request.author.id, ref_url: issuable_url(@merge_request)), class: 'gl-display-none gl-display-md-block gl-button btn btn-warning-secondary', title: _('Report abuse')
= link_to _('Report abuse'), new_abuse_report_path(user_id: @merge_request.author.id, ref_url: merge_request_url(@merge_request)), class: 'gl-display-none gl-display-md-block gl-button btn btn-warning-secondary', title: _('Report abuse')
......@@ -30,7 +30,7 @@
%li.divider.droplab-item-ignore
%li.report-item
%a.report-abuse-link{ href: new_abuse_report_path(user_id: issuable.author.id, ref_url: issuable_url(issuable)) }
%a.report-abuse-link{ href: new_abuse_report_path(user_id: issuable.author.id, ref_url: merge_request_url(issuable)) }
.description
%strong.title= _('Report abuse')
%p.text
......
......@@ -11,7 +11,7 @@
.issuable-meta
#js-issuable-header-warnings
= issuable_meta(issuable, @project, issuable_display_type(issuable))
= issuable_meta(issuable, @project)
%a.btn.gl-button.btn-default.float-right.gl-display-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" }
= sprite_icon('chevron-double-lg-left')
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:user) { create(:user, feed_token: 'feedtoken:coldfeed') }
let(:group) { create(:group) }
let(:project) { create(:project_empty_repo, namespace: group, path: 'issues-project') }
render_views
before(:all) do
clean_frontend_fixtures('ee/issues/')
end
before do
project.add_developer(user)
sign_in(user)
end
after do
remove_repository(project)
end
it 'ee/issues/blocked-issue.html' do
issue = create(:issue, project: project)
related_issue = create(:issue, project: project)
create(:issue_link, source: related_issue, target: issue, link_type: IssueLink::TYPE_BLOCKS)
render_issue(issue)
end
private
def render_issue(issue)
get :show, params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: issue.to_param
}
expect(response).to be_successful
end
end
......@@ -45,12 +45,6 @@ RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :contr
render_issue(issue)
end
it 'issues/issue_with_comment.html' do
issue = create(:issue, project: project)
create(:note, project: project, noteable: issue, note: '- [ ] Task List Item').save
render_issue(issue)
end
it 'issues/issue_list.html' do
create(:issue, project: project)
......
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