diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-31 16:03:32 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-05-31 16:03:32 +0300 |
commit | b888ed59abd3a6cc6a1c14278c38fda472f5b90c (patch) | |
tree | 41fe86ce3c76ada3379a2528c40313a027e22259 /app/helpers | |
parent | 632d0c0a4c6ed8dd099f67a6914868811490e6a4 (diff) |
Fixed issuables_helper_spec and added a test for issuable_app_data
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/issuables_helper.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index afe19f017d7..a4197d34db3 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -199,6 +199,29 @@ module IssuablesHelper issuable_filter_params.any? { |k| params.key?(k) } end + def issuable_app_data(project, issue) + data = { + endpoint: realtime_changes_namespace_project_issue_path(project.namespace, project, issue), + 'can-update' => can?(current_user, :update_issue, issue).to_s, + 'issuable-ref' => issue.to_reference || '' + } + updated_at_by = updated_at_by(issue) + + data.merge(updated_at_by) + end + + def updated_at_by(issuable) + return {} unless issuable.is_edited? + + { + updated_at: issuable.updated_at.to_time.iso8601, + updated_by: { + name: issuable.last_edited_by.name, + path: user_path(issuable.last_edited_by) + } + } + end + private def sidebar_gutter_collapsed? @@ -273,27 +296,4 @@ module IssuablesHelper container: (is_collapsed ? 'body' : nil) } end - - def issuable_app_data(project, issue) - data = { - endpoint: realtime_changes_namespace_project_issue_path(project.namespace, project, issue), - 'can-update' => can?(current_user, :update_issue, issue).to_s, - 'issuable-ref' => issue.to_reference || '' - } - updated_at_by = updated_at_by(issue) - - data.merge(updated_at_by) - end - - def updated_at_by(issuable) - return {} unless issuable.is_edited? - - { - updated_at: issuable.updated_at.to_time.iso8601, - updated_by: { - name: issuable.last_edited_by.name, - path: user_path(issuable.last_edited_by) - } - } - end end |