Commit e4984434 authored by briankabiro's avatar briankabiro

Destroy the OAuth application when secondary becomes a primary

When a secondary becomes a primary, the OAuth application is
disassociated from that Geo node. This change destroys the OAuth
application in addition to the disassociation.
parent 65b8e37b
---
title: Destroy the OAuth application when Geo secondary becomes a primary
merge_request: 25154
author: briankabiro
type: other
......@@ -318,7 +318,9 @@ class GeoNode < ApplicationRecord
def update_dependents_attributes
if self.primary?
self.oauth_application&.destroy
self.oauth_application = nil
update_clone_url
else
update_oauth_application!
......
......@@ -186,12 +186,12 @@ describe GeoNode, :request_store, :geo, type: :model do
end
context 'when it has an oauth_application' do
# TODO Should it instead be destroyed?
# https://gitlab.com/gitlab-org/gitlab/issues/10225
it 'disassociates the oauth_application' do
it 'destroys the oauth_application' do
primary_node.oauth_application = create(:oauth_application)
expect do
expect(primary_node).to be_valid
end.to change(Doorkeeper::Application, :count).by(-1)
expect(primary_node.oauth_application).to be_nil
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