forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs AE-142 flag=none test plan: - mutating allowed_services via UI still works - mutating user services via UI still works Change-Id: I2231b76c2dc9443ea94ecf0afbdfc842ecc8c497 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/313727 Reviewed-by: Aaron Ogata <[email protected]> Reviewed-by: Jacob Burroughs <[email protected]> Tested-by: Service Cloud Jenkins <[email protected]> Migration-Review: Jacob Burroughs <[email protected]> QA-Review: Isaac Moore <[email protected]> Product-Review: Isaac Moore <[email protected]>
- Loading branch information
Showing
18 changed files
with
119 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright (C) 2023 - present Instructure, Inc. | ||
# | ||
# This file is part of Canvas. | ||
# | ||
# Canvas is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Affero General Public License as published by the Free | ||
# Software Foundation, version 3 of the License. | ||
# | ||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
class RemoveDelicious < ActiveRecord::Migration[7.0] | ||
tag :predeploy | ||
|
||
def up | ||
DataFixup::RemoveDelicious.run | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright (C) 2023 - present Instructure, Inc. | ||
# | ||
# This file is part of Canvas. | ||
# | ||
# Canvas is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Affero General Public License as published by the Free | ||
# Software Foundation, version 3 of the License. | ||
# | ||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
module DataFixup::RemoveDelicious | ||
def self.run | ||
# Remove delicious from allowed services | ||
Account.where("allowed_services LIKE ?", "%delicious%") | ||
.in_batches | ||
.update_all("allowed_services = regexp_replace(allowed_services, '(^[+-]?delicious,)|(,[+-]?delicious)', '', 'g')") | ||
|
||
# Delete delicious user service configurations | ||
UserService.where(service: "delicious").in_batches.delete_all | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (C) 2023 - present Instructure, Inc. | ||
# | ||
# This file is part of Canvas. | ||
# | ||
# Canvas is free software: you can redistribute it and/or modify it under | ||
# the terms of the GNU Affero General Public License as published by the Free | ||
# Software Foundation, version 3 of the License. | ||
# | ||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
describe DataFixup::RemoveDelicious do | ||
it "removes delicious when it is at the start" do | ||
account = account_model(allowed_services: "+delicious,-skype") | ||
described_class.run | ||
|
||
expect(account.reload.allowed_services).to eq "-skype" | ||
end | ||
|
||
it "removes delicious when it is at the end" do | ||
account = account_model(allowed_services: "+skype,-delicious") | ||
described_class.run | ||
|
||
expect(account.reload.allowed_services).to eq "+skype" | ||
end | ||
|
||
it "removes delicious when it is in the middle" do | ||
account = account_model(allowed_services: "+skype,-delicious,+diigo") | ||
described_class.run | ||
|
||
expect(account.reload.allowed_services).to eq "+skype,+diigo" | ||
end | ||
|
||
it "removes delicious when it is present multiple times" do | ||
account = account_model(allowed_services: "+delicious,+skype,-delicious,+diigo,+delicious") | ||
described_class.run | ||
|
||
expect(account.reload.allowed_services).to eq "+skype,+diigo" | ||
end | ||
|
||
it "deletes any configured delicious user services" do | ||
user_service = user_service_model(service: "delicious") | ||
described_class.run | ||
|
||
expect { user_service.reload }.to raise_error(ActiveRecord::RecordNotFound) | ||
end | ||
end |
Oops, something went wrong.