summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 12:08:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-28 12:08:44 +0000
commitdb24ab2b72dbff24c201410a0561e929ae7e8061 (patch)
tree67297286aad8cc590ae325330a0bfe1e2a7e51dc /app
parent7e8278c0f46cf6058efad5afd0aef177977bd663 (diff)
downloadgitlab-ce-db24ab2b72dbff24c201410a0561e929ae7e8061.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/pages/projects/init_blob.js2
-rw-r--r--app/controllers/sent_notifications_controller.rb14
2 files changed, 13 insertions, 3 deletions
diff --git a/app/assets/javascripts/pages/projects/init_blob.js b/app/assets/javascripts/pages/projects/init_blob.js
index e862456f429..5eb0d323266 100644
--- a/app/assets/javascripts/pages/projects/init_blob.js
+++ b/app/assets/javascripts/pages/projects/init_blob.js
@@ -11,7 +11,7 @@ export default () => {
// eslint-disable-next-line no-new
new BlobLinePermalinkUpdater(
document.querySelector('#blob-content-holder'),
- '.diff-line-num[data-line-number]',
+ '.diff-line-num[data-line-number], .diff-line-num[data-line-number] *',
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
);
diff --git a/app/controllers/sent_notifications_controller.rb b/app/controllers/sent_notifications_controller.rb
index 893f5145e99..20134de81a0 100644
--- a/app/controllers/sent_notifications_controller.rb
+++ b/app/controllers/sent_notifications_controller.rb
@@ -6,14 +6,24 @@ class SentNotificationsController < ApplicationController
def unsubscribe
@sent_notification = SentNotification.for(params[:id])
- return render_404 unless @sent_notification && @sent_notification.unsubscribable?
+ return render_404 unless unsubscribe_prerequisites_met?
+
return unsubscribe_and_redirect if current_user || params[:force]
end
private
+ def unsubscribe_prerequisites_met?
+ @sent_notification.present? &&
+ @sent_notification.unsubscribable? &&
+ noteable.present?
+ end
+
+ def noteable
+ @sent_notification.noteable
+ end
+
def unsubscribe_and_redirect
- noteable = @sent_notification.noteable
noteable.unsubscribe(@sent_notification.recipient, @sent_notification.project)
flash[:notice] = _("You have been unsubscribed from this thread.")