Commit 012a04b0 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '10225-detroy-oauth-application-when-secondary-becomes-primary' into 'master'

Geo: Destroy the OAuth application when secondary becomes a primary

Closes #10225

See merge request gitlab-org/gitlab!25154
parents 76c5e52e e4984434
---
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 ...@@ -318,7 +318,9 @@ class GeoNode < ApplicationRecord
def update_dependents_attributes def update_dependents_attributes
if self.primary? if self.primary?
self.oauth_application&.destroy
self.oauth_application = nil self.oauth_application = nil
update_clone_url update_clone_url
else else
update_oauth_application! update_oauth_application!
......
...@@ -186,12 +186,12 @@ describe GeoNode, :request_store, :geo, type: :model do ...@@ -186,12 +186,12 @@ describe GeoNode, :request_store, :geo, type: :model do
end end
context 'when it has an oauth_application' do context 'when it has an oauth_application' do
# TODO Should it instead be destroyed? it 'destroys the oauth_application' do
# https://gitlab.com/gitlab-org/gitlab/issues/10225
it 'disassociates the oauth_application' do
primary_node.oauth_application = create(:oauth_application) primary_node.oauth_application = create(:oauth_application)
expect(primary_node).to be_valid expect do
expect(primary_node).to be_valid
end.to change(Doorkeeper::Application, :count).by(-1)
expect(primary_node.oauth_application).to be_nil expect(primary_node.oauth_application).to be_nil
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