Commit 278a7561 authored by Nick Thomas's avatar Nick Thomas

Merge branch '2524-geo-secondary-help-users-not-waste-time-on-impossible-operations' into 'master'

Resolve "Geo secondary help users not waste time on impossible operations."

Closes #2524

See merge request gitlab-org/gitlab-ee!3260
parents bff9e896 437b42c1
...@@ -45,11 +45,6 @@ class Oauth::GeoAuthController < ActionController::Base ...@@ -45,11 +45,6 @@ class Oauth::GeoAuthController < ActionController::Base
private private
def after_sign_in_with_gitlab(token, return_to) def after_sign_in_with_gitlab(token, return_to)
if Gitlab::Geo.primary_node
primary_node = view_context.link_to('primary node', Gitlab::Geo.primary_node.url)
flash[:notice] = "You are on a secondary (read-only) Geo node. If you want to make any changes, you must visit the #{primary_node}.".html_safe
end
session[:access_token] = token session[:access_token] = token
redirect_to(return_to || root_path) redirect_to(return_to || root_path)
end end
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
.alert-wrapper .alert-wrapper
= render "layouts/header/ee_license_banner" = render "layouts/header/ee_license_banner"
= render "layouts/broadcast" = render "layouts/broadcast"
= render 'layouts/header/ee/geo_secondary_banner'
= yield :flash_message = yield :flash_message
- unless @hide_breadcrumbs - unless @hide_breadcrumbs
= render "layouts/nav/breadcrumbs" = render "layouts/nav/breadcrumbs"
......
---
title: On Secondary read-only Geo Nodes now a flash banner is shown on all pages
merge_request: 3260
author:
type: added
- if ::Gitlab::Geo.secondary? && ::Gitlab::Geo.primary_node
- primary_node = link_to('primary node', ::Gitlab::Geo.primary_node.url)
.flash-container.flash-container-page
.flash-notice
%div{ class: (container_class) }
%span You are on a secondary (read-only) Geo node. If you want to make any changes, you must visit the #{primary_node}.
require 'spec_helper'
feature 'GEO Nodes' do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:geo_url) { 'http://geo.example.com' }
context 'Geo Secondary Node' do
before do
allow(Gitlab::Geo).to receive(:secondary?) { true }
allow(Gitlab::Geo).to receive_message_chain(:primary_node, :url) { geo_url }
project.add_master(user)
sign_in(user)
end
describe "showing Flash Info Message" do
it 'on dashboard' do
visit root_dashboard_path
expect(page).to have_content 'You are on a secondary (read-only) Geo node.'
end
it 'on project overview' do
visit project_path(project)
expect(page).to have_content 'You are on a secondary (read-only) Geo node.'
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment