2018-11-27 15:10:40 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class IssuePresenter < Gitlab::View::Presenter::Delegated
|
2021-09-21 09:12:21 +00:00
|
|
|
presents ::Issue, as: :issue
|
2018-11-27 15:10:40 +00:00
|
|
|
|
2019-05-31 16:46:16 +00:00
|
|
|
def issue_path
|
2022-03-30 21:09:29 +00:00
|
|
|
return url_builder.build(issue, only_path: true) unless use_work_items_path?
|
|
|
|
|
|
|
|
project_work_items_path(issue.project, work_items_path: issue.id)
|
2019-05-31 16:46:16 +00:00
|
|
|
end
|
|
|
|
|
2021-09-21 09:12:21 +00:00
|
|
|
delegator_override :subscribed?
|
2019-10-02 00:06:26 +00:00
|
|
|
def subscribed?
|
|
|
|
issue.subscribed?(current_user, issue.project)
|
|
|
|
end
|
2020-11-09 03:09:03 +00:00
|
|
|
|
|
|
|
def project_emails_disabled?
|
|
|
|
issue.project.emails_disabled?
|
|
|
|
end
|
2022-03-30 21:09:29 +00:00
|
|
|
|
|
|
|
def web_url
|
|
|
|
return super unless use_work_items_path?
|
|
|
|
|
|
|
|
project_work_items_url(issue.project, work_items_path: issue.id)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def use_work_items_path?
|
|
|
|
issue.issue_type == 'task' && issue.project.work_items_feature_flag_enabled?
|
|
|
|
end
|
2018-11-27 15:10:40 +00:00
|
|
|
end
|
2020-10-13 21:09:27 +00:00
|
|
|
|
2021-05-11 21:10:21 +00:00
|
|
|
IssuePresenter.prepend_mod_with('IssuePresenter')
|