diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-02-28 15:40:52 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2018-02-28 15:40:52 +0000 |
commit | b5b8dc83cc1bb271877c79532ecfb555540672a7 (patch) | |
tree | 190f6cd6991cbfbabbd670a7aac5ff36eb1a64bb /app/helpers/notes_helper.rb | |
parent | deef09cd1f0dbe5cab5095ff02f19a5c3588cb91 (diff) | |
parent | ff2f57da791890957fe97efd46f5c34f270a0c46 (diff) | |
download | gitlab-ce-dispatcher-cycle-analytics.tar.gz |
Merge branch 'master' into 'dispatcher-cycle-analytics'dispatcher-cycle-analytics
# Conflicts:
# config/webpack.config.js
Diffstat (limited to 'app/helpers/notes_helper.rb')
-rw-r--r-- | app/helpers/notes_helper.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index c219aa3d6a9..e86e43b5ebf 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -151,7 +151,38 @@ module NotesHelper } end + def notes_data(issuable) + discussions_path = + if issuable.is_a?(Issue) + discussions_project_issue_path(@project, issuable, format: :json) + else + discussions_project_merge_request_path(@project, issuable, format: :json) + end + + { + discussionsPath: discussions_path, + registerPath: new_session_path(:user, redirect_to_referer: 'yes', anchor: 'register-pane'), + newSessionPath: new_session_path(:user, redirect_to_referer: 'yes'), + markdownDocsPath: help_page_path('user/markdown'), + quickActionsDocsPath: help_page_path('user/project/quick_actions'), + closePath: close_issuable_path(issuable), + reopenPath: reopen_issuable_path(issuable), + notesPath: notes_url, + totalNotes: issuable.discussions.length, + lastFetchedAt: Time.now + + }.to_json + end + def discussion_resolved_intro(discussion) discussion.resolved_by_push? ? 'Automatically resolved' : 'Resolved' end + + def has_vue_discussions_cookie? + cookies[:vue_mr_discussions] == 'true' + end + + def serialize_notes? + has_vue_discussions_cookie? && !params['html'] + end end |