diff --git a/Gemfile b/Gemfile index 28de94c3b..63be4eaca 100644 --- a/Gemfile +++ b/Gemfile @@ -91,10 +91,9 @@ gem 'bootstrap-datepicker-rails' # DRY-er easier bootstrap 4 forms gem "bootstrap_form", ">= 4.5.0" -# For connecting to other services (eg Twitter) +# For connecting to other services (eg Flickr) gem 'omniauth', '~> 1.3' gem 'omniauth-flickr', '>= 0.0.15' -gem 'omniauth-twitter' # Pretty charts gem "chartkick" diff --git a/Gemfile.lock b/Gemfile.lock index a0bd14c00..d3bfb8c01 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -452,9 +452,6 @@ GEM omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-twitter (1.4.0) - omniauth-oauth (~> 1.1) - rack open-uri (0.1.0) orm_adapter (0.5.0) ostruct (0.6.2) @@ -810,7 +807,6 @@ DEPENDENCIES oj omniauth (~> 1.3) omniauth-flickr (>= 0.0.15) - omniauth-twitter percy-capybara (~> 5.0.0) pg platform-api diff --git a/README.md b/README.md index 4bda20767..c6aec2da6 100644 --- a/README.md +++ b/README.md @@ -62,5 +62,3 @@ For more information about this project, contact [info@growstuff.org](mailto:inf Security Issues: If you find an authorization bypass or data breach, please contact our maintainers directly at [maintainers@growstuff.org](mailto:maintainers@growstuff.org). -You can also contact us on [Twitter](http://twitter.com/growstufforg/) or -[Facebook](https://www.facebook.com/pages/Growstuff/1531133417099494) or [Github](https://github.com/Growstuff/growstuff/issues).. diff --git a/app/assets/images/twitter_32.png b/app/assets/images/twitter_32.png deleted file mode 100644 index 550232344..000000000 Binary files a/app/assets/images/twitter_32.png and /dev/null differ diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 2099ffd46..160746519 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -16,7 +16,6 @@ class MembersController < ApplicationController def show @member = Member.confirmed.kept.find_by!(slug: params[:slug]) - @twitter_auth = @member.auth('twitter') @flickr_auth = @member.auth('flickr') @posts = @member.posts diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index e8e54befb..0d55de038 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -28,7 +28,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController @authentication = action.establish_authentication(auth, member) if action.member_created? - raise "Invalid provider" unless %w(twitter flickr).index(auth['provider'].to_s) + raise "Invalid provider" unless %w(flickr).index(auth['provider'].to_s) session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"] sign_in member diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 862a18689..2bb8b1764 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -6,7 +6,6 @@ class RegistrationsController < Devise::RegistrationsController prepend_before_action :check_captcha, only: [:create] # Change this to be any actions you want to protect with recaptcha. def edit - @twitter_auth = current_member.auth('twitter') @flickr_auth = current_member.auth('flickr') render "edit" end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 992dc1b6b..9506cabf3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -50,7 +50,6 @@ module ApplicationHelper uri.query = "&width=#{size}&height=#{size}" if uri.host == 'graph.facebook.com' - # TODO: Assess twitter - https://dev.twitter.com/overview/general/user-profile-images-and-banners # TODO: Assess flickr - https://www.flickr.com/services/api/misc.buddyicons.html return uri.to_s diff --git a/app/views/devise/registrations/_edit_apps.html.haml b/app/views/devise/registrations/_edit_apps.html.haml index ab9e5d80e..12e267bb0 100644 --- a/app/views/devise/registrations/_edit_apps.html.haml +++ b/app/views/devise/registrations/_edit_apps.html.haml @@ -3,19 +3,6 @@ html: { method: :put, class: 'form-horizontal' }) do |_f| %br/ = render 'devise/shared/error_messages', resource: resource - .row - .col-md-12 - %p - = image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo' - - if @twitter_auth - You are connected to Twitter as - = link_to @twitter_auth.name, "https://twitter.com/#{@twitter_auth.name}" - = link_to "Disconnect", @twitter_auth, - confirm: "Are you sure you want to remove this connection?", - method: :delete, class: "remove btn btn-danger" - - else - = link_to 'Connect to Twitter', '/members/auth/twitter', class: 'btn' - .row .col-md-12 %p diff --git a/app/views/members/_contact.html.haml b/app/views/members/_contact.html.haml index ce07b2246..348cbce35 100644 --- a/app/views/members/_contact.html.haml +++ b/app/views/members/_contact.html.haml @@ -1,4 +1,4 @@ -- if member.website_url.present? || member.instagram_handle.present? || member.facebook_handle.present? || member.bluesky_handle.present? || member.other_url.present? || twitter_auth || flickr_auth || member.show_email +- if member.website_url.present? || member.instagram_handle.present? || member.facebook_handle.present? || member.bluesky_handle.present? || member.other_url.present? || flickr_auth || member.show_email %h4 Contact - if member.website_url.present? @@ -26,11 +26,6 @@ = icon 'fas', 'link', class: 'fa-fw' = link_to "More...", member.other_url, target: '_blank', rel: 'noopener noreferrer' - - if twitter_auth - %p - = image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo' - = link_to twitter_auth.name, "https://twitter.com/#{twitter_auth.name}", target: '_blank', rel: 'noopener noreferrer' - - if flickr_auth %p = image_tag "flickr_32.png", size: "32x32", alt: 'Flickr logo' diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index c231a8cc8..c60370439 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -77,8 +77,7 @@ = render "stats", member: @member .card-footer - = render "contact", member: @member, twitter_auth: @twitter_auth, - flickr_auth: @flickr_auth + = render "contact", member: @member, flickr_auth: @flickr_auth .col-md-10#content .row diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 56af5eafb..e23e20679 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true Rails.application.config.middleware.use OmniAuth::Builder do - provider :twitter, ENV.fetch('GROWSTUFF_TWITTER_KEY', nil), ENV.fetch('GROWSTUFF_TWITTER_SECRET', nil) provider :flickr, ENV.fetch('GROWSTUFF_FLICKR_KEY', nil), ENV.fetch('GROWSTUFF_FLICKR_SECRET', nil), scope: 'read' end diff --git a/env-example b/env-example index 26db16165..6a3e34f06 100644 --- a/env-example +++ b/env-example @@ -40,11 +40,6 @@ GROWSTUFF_SITE_NAME="Growstuff (dev)" GROWSTUFF_MAILCHIMP_APIKEY="" GROWSTUFF_MAILCHIMP_NEWSLETTER_ID="" -# Used for connecting member accounts to Twitter -# Get Twitter key from https://dev.twitter.com/apps -GROWSTUFF_TWITTER_KEY="" -GROWSTUFF_TWITTER_SECRET="" - # Used for connecting member accounts to Flickr # Get Flickr key from http://www.flickr.com/services/apps/create/apply/ GROWSTUFF_FLICKR_KEY="" diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb index fe00fb305..1d3235d91 100644 --- a/lib/actions/oauth_signup_action.rb +++ b/lib/actions/oauth_signup_action.rb @@ -61,8 +61,6 @@ class Growstuff::OauthSignupAction def determine_name(auth) case auth['provider'] - when 'twitter' - auth['info']['nickname'] when 'flickr' auth['info']['name'] else diff --git a/spec/controllers/member_controller_spec.rb b/spec/controllers/member_controller_spec.rb index dad64c564..3d7ba9721 100644 --- a/spec/controllers/member_controller_spec.rb +++ b/spec/controllers/member_controller_spec.rb @@ -5,7 +5,6 @@ require 'rails_helper' describe MembersController do before do @member = FactoryBot.create(:member) - @twitter_auth = FactoryBot.create(:authentication, member: @member) @flickr_auth = FactoryBot.create(:flickr_authentication, member: @member) end @@ -29,11 +28,6 @@ describe MembersController do expect(response).to be_successful end - it "assigns @twitter_auth" do - get :show, params: { slug: @member.to_param } - expect(assigns(:twitter_auth)).to eq(@twitter_auth) - end - it "assigns @flickr_auth" do get :show, params: { slug: @member.to_param } expect(assigns(:flickr_auth)).to eq(@flickr_auth) diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 71b628101..cc994900d 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -16,12 +16,6 @@ describe RegistrationsController do assigns(:member).should eq(@member) end - it "picks up the twitter auth" do - @auth = FactoryBot.create(:authentication, member: @member) - get :edit - assigns(:twitter_auth).should eq @auth - end - it "picks up the flickr auth" do @auth = FactoryBot.create(:flickr_authentication, member: @member) get :edit diff --git a/spec/factories/authentications.rb b/spec/factories/authentications.rb index d93c37bb2..c64fa2149 100644 --- a/spec/factories/authentications.rb +++ b/spec/factories/authentications.rb @@ -5,7 +5,7 @@ FactoryBot.define do factory :authentication do member - provider { 'twitter' } + provider { 'flickr' } uid { 'foo' } secret { 'bar' } name { 'baz' } diff --git a/spec/features/members/profile_spec.rb b/spec/features/members/profile_spec.rb index 2da6340ac..47a6c257b 100644 --- a/spec/features/members/profile_spec.rb +++ b/spec/features/members/profile_spec.rb @@ -76,12 +76,6 @@ describe "member profile", :js do end end - it "twitter link" do - twitter_auth = create(:authentication, member:) - visit member_path(member) - expect(page).to have_link twitter_auth.name, href: "https://twitter.com/#{twitter_auth.name}" - end - it "flickr link" do flickr_auth = create(:flickr_authentication, member:) visit member_path(member) diff --git a/spec/views/devise/registrations/edit_spec.rb b/spec/views/devise/registrations/edit_spec.rb index 4721f507b..0483f275b 100644 --- a/spec/views/devise/registrations/edit_spec.rb +++ b/spec/views/devise/registrations/edit_spec.rb @@ -60,29 +60,6 @@ describe 'devise/registrations/edit.html.haml', type: "view" do end context 'other sites section' do - context 'not connected to twitter' do - it 'has a link to connect' do - render - assert_select "a", "Connect to Twitter" - end - end - - context 'connected to twitter' do - before do - @twitter_auth = FactoryBot.create(:authentication, member: @member) - render - end - - it 'has a link to twitter profile' do - assert_select "a", href: "http://twitter.com/#{@twitter_auth.name}" - end - - it 'has a link to disconnect' do - render - assert_select "a", href: @twitter_auth, text: "Disconnect" - end - end - context 'not connected to flickr' do it 'has a link to connect' do render