diff options
Diffstat (limited to 'app/helpers/issuables_helper.rb')
-rw-r--r-- | app/helpers/issuables_helper.rb | 66 |
1 files changed, 10 insertions, 56 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 77ced17bc22..15842dec3dd 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -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,30 +164,26 @@ 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 + def issuable_meta_author_status(author) + return "" unless show_status_emoji?(author&.status) && status = user_status(author) + + "#{status}".html_safe 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 + if issuable.is_a?(Issue) && issuable.service_desk_reply_to + output << "#{html_escape(issuable.service_desk_reply_to)} via " + end + output << content_tag(:strong) do author_output = link_to_member(project, issuable.author, size: 24, mobile_classes: "d-none d-sm-inline") author_output << link_to_member(project, issuable.author, size: 24, by_username: true, avatar: false, mobile_classes: "d-inline d-sm-none") author_output << issuable_meta_author_slot(issuable.author, css_class: 'ml-1') - - if status = user_status(issuable.author) - author_output << "#{status}".html_safe - end + author_output << issuable_meta_author_status(issuable.author) author_output end @@ -336,42 +322,10 @@ 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' - - issuable_path(issuable, { merge_request: { wip_event: wip_event } }) - end - def issuable_path(issuable, *options) 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 |