Remove Twitter from Canvas due to expired Key

fixes VICE-2776

Test Plan
- before checking this commit out, run `bundle exec rails c`
- then `u = User.find(IDOFUSERYOUWANTTOTEST)`
- then `u.user_services.create! service: "twitter", service_user_name: "user", service_user_id: "user", visible: true`
- as the user, visit /profile/settings
- notice that in the web services section, you see twitter under registered service, and also under "Other Contacts" in "Ways to Contant"
- visit /profile/communication
- notice that you see a column for twitter
- visit /profile
- notice that a twitter icon shows in ways to contact
- now, check this commit out
- as the user, visit /profile/settings
- verify you do not see twitter in other ways to contact and in the web services section
- visit /profile/communication
- verify that you do not see a column for twitter
- visit /profile
- verify that you do not see a twitter icon in ways to contact

Change-Id: Ic5c73a8238f38a3d3a8e3ab3d3e9a07003ed7e4a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/291767
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
This commit is contained in:
Jeffrey Johnson 2022-05-12 11:23:15 -07:00 committed by Caleb Guanzon
parent 2f54d5d263
commit 5a842a7eed
5 changed files with 14 additions and 64 deletions

View File

@ -41,7 +41,8 @@ module Types
channels = channels.reject { |cc| cc.path_type == CommunicationChannel::TYPE_PUSH }
end
channels
# remove Twitter notification types
channels.reject { |cc| cc.path_type == CommunicationChannel::TYPE_TWITTER }
end
field :send_scores_in_emails, Boolean, null: true do

View File

@ -362,30 +362,6 @@ TEXT
</div>
</div>
</li>
<li id="unregistered_service_twitter" class="service" style="<%= hidden if services.include?("twitter") || !feature_and_service_enabled?(:twitter) %>">
<a href="#" class="btn btn-small"><%= image_tag "twitter_icon.png", :alt => '' %> <%= t('links.twitter', "Twitter") %></a>
<div style="display: none; text-align: <%= direction('left') %>;" class="content" title="<%= t('titles.authorize_twitter', "Authorize Twitter") %>" id="unregistered_service_twitter_dialog">
<div>
<%= image_tag "twitter.png", :style => "float: #{direction('left')}; padding-#{ direction('right') }: 5px;", :alt => '' %>
<div style="font-size: 1.2em; font-weight: bold;"><%= t('headers.twitter_access', "Twitter Access") %></div>
<%= mt(:twitter_description, <<~TEXT)
Twitter is a service for posting and subscribing to short messages.
If you have a Twitter account, you can register it here. Then if you allow
fellow course/group members to see your registered services, they can
easily connect with your Twitter account.
You can also sign up to have notifications sent to your Twitter account.
These notifications will be sent as direct messages to yourself from
yourself, and won't appear in your public stream.
TEXT
%>
<div class="clear"></div>
</div>
<div style="text-align: center; margin-top: 10px;">
<a class="btn btn-primary" href="<%= oauth_url(:service => "twitter", :return_to => settings_profile_url) %>"><%= t('buttons.authorize_twitter', "Authorize Twitter Access") %></a>
</div>
</div>
</li>
<li id="unregistered_service_delicious" class="service" style="<%= hidden if services.include?("delicious") || !service_enabled?(:delicious) %>">
<a href="#" class="btn btn-small"><%= image_tag "delicious_icon.png", :alt => '' %> <%= t('links.delicious', "Delicious") %></a>
<div style="display: none; text-align: <%= direction('left') %>;" class="content" title="<%= t('titles.delicious_login', "Delicious Login") %>" id="unregistered_service_delicious_dialog">

View File

@ -44,12 +44,6 @@ module AccountServices
description: "",
expose_to_ui: :service
},
twitter: {
name: I18n.t("Twitter"),
description: "",
expose_to_ui: :service,
expose_to_ui_proc: proc { !!Twitter::Connection.config }
},
delicious: {
name: I18n.t("Delicious"),
description: "",

View File

@ -191,7 +191,6 @@ describe "User Profile API", type: :request do
context "user_services" do
before :once do
@student.user_services.create! service: "skype", service_user_name: "user", service_user_id: "user", visible: false
@student.user_services.create! service: "twitter", service_user_name: "user", service_user_id: "user", visible: true
@student.user_services.create! service: "somethingthatdoesntexistanymore", service_user_name: "user", service_user_id: "user", visible: true
end
@ -206,19 +205,7 @@ describe "User Profile API", type: :request do
user_id: @student.to_param, format: "json",
include: ["user_services"])
expect(json["user_services"]).to eq [
{ "service" => "skype", "visible" => false, "service_user_link" => "skype:user?add" },
{ "service" => "twitter", "visible" => true, "service_user_link" => "http://www.twitter.com/user" }
]
end
it "only returns visible services for other users" do
@user = @admin
json = api_call(:get, "/api/v1/users/#{@student.id}/profile?include[]=user_services",
controller: "profile", action: "settings",
user_id: @student.to_param, format: "json",
include: %w[user_services])
expect(json["user_services"]).to eq [
{ "service" => "twitter", "visible" => true, "service_user_link" => "http://www.twitter.com/user" },
{ "service" => "skype", "visible" => false, "service_user_link" => "skype:user?add" }
]
end

View File

@ -458,8 +458,8 @@ describe Account do
end
it "is able to specify a list of enabled services" do
@a.allowed_services = "twitter"
expect(@a.service_enabled?(:twitter)).to be_truthy
@a.allowed_services = "fakeService"
# expect(@a.service_enabled?(:twitter)).to be_truthy
expect(@a.service_enabled?(:diigo)).to be_falsey
expect(@a.service_enabled?(:avatars)).to be_falsey
end
@ -469,29 +469,22 @@ describe Account do
end
it "adds and remove services from the defaults" do
@a.allowed_services = "+avatars,-twitter"
@a.allowed_services = "+avatars,-myplugin"
expect(@a.service_enabled?(:avatars)).to be_truthy
expect(@a.service_enabled?(:twitter)).to be_falsey
expect(@a.service_enabled?(:myplugin)).to be_falsey
end
it "allows settings services" do
expect { @a.enable_service(:completly_bogs) }.to raise_error("Invalid Service")
@a.disable_service(:twitter)
expect(@a.service_enabled?(:twitter)).to be_falsey
@a.disable_service(:avatars)
expect(@a.service_enabled?(:avatars)).to be_falsey
@a.enable_service(:twitter)
expect(@a.service_enabled?(:twitter)).to be_truthy
@a.enable_service(:avatars)
expect(@a.service_enabled?(:avatars)).to be_truthy
end
it "uses + and - by default when setting service availability" do
@a.enable_service(:twitter)
expect(@a.service_enabled?(:twitter)).to be_truthy
expect(@a.allowed_services).to be_nil
@a.disable_service(:twitter)
expect(@a.allowed_services).to match("\\-twitter")
@a.disable_service(:avatars)
expect(@a.service_enabled?(:avatars)).to be_falsey
expect(@a.allowed_services).not_to match("avatars")
@ -504,13 +497,12 @@ describe Account do
it "is able to set service availibity for previously hard-coded values" do
@a.allowed_services = "avatars"
@a.enable_service(:twitter)
expect(@a.service_enabled?(:twitter)).to be_truthy
expect(@a.allowed_services).to match(/twitter/)
@a.enable_service(:avatars)
expect(@a.service_enabled?(:avatars)).to be_truthy
expect(@a.allowed_services).to match(/avatars/)
expect(@a.allowed_services).not_to match(/[+-]/)
@a.disable_service(:avatars)
@a.disable_service(:twitter)
expect(@a.allowed_services).to be_nil
end