Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/tooling/visual_review_helper.rb')
-rw-r--r--app/helpers/tooling/visual_review_helper.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/helpers/tooling/visual_review_helper.rb b/app/helpers/tooling/visual_review_helper.rb
new file mode 100644
index 00000000000..da6eb3ec434
--- /dev/null
+++ b/app/helpers/tooling/visual_review_helper.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module Tooling
+ module VisualReviewHelper
+ # Since we only use the visual review toolbar for the gitlab project,
+ # we can hardcode the project ID and project path for now.
+ #
+ # If we need to extend the review apps to other applications in the future,
+ # we should create REVIEW_APPS_PROJECT_ID and REVIEW_APPS_PROJECT_PATH
+ # environment variables (mapped to CI_PROJECT_ID and CI_PROJECT_PATH respectively),
+ # as well as setting `data-require-auth` according to the project visibility.
+ GITLAB_INSTANCE_URL = 'https://gitlab.com'
+ GITLAB_ORG_GITLAB_PROJECT_ID = '278964'
+ GITLAB_ORG_GITLAB_PROJECT_PATH = 'gitlab-org/gitlab'
+
+ def visual_review_toolbar_options
+ { 'data-merge-request-id': "#{ENV['REVIEW_APPS_MERGE_REQUEST_IID']}",
+ 'data-mr-url': "#{GITLAB_INSTANCE_URL}",
+ 'data-project-id': "#{GITLAB_ORG_GITLAB_PROJECT_ID}",
+ 'data-project-path': "#{GITLAB_ORG_GITLAB_PROJECT_PATH}",
+ 'data-require-auth': false,
+ 'id': 'review-app-toolbar-script',
+ 'src': 'https://gitlab.com/assets/webpack/visual_review_toolbar.js' }
+ end
+ end
+end