diff --git a/Gemfile b/Gemfile index 998bcbc9..d45208d8 100644 --- a/Gemfile +++ b/Gemfile @@ -55,13 +55,10 @@ gem 'httparty' # OmniAuth and providers gem 'omniauth' gem 'omniauth-twitter' -gem 'omniauth-tumblr' # OAuth clients gem 'twitter' gem 'twitter-text' -# To use a more recent Faraday version, a fork of this gem is required. -gem 'tumblr_client', git: 'https://github.com/amplifr/tumblr_client' gem 'redis' diff --git a/Gemfile.lock b/Gemfile.lock index 9e3dc9a0..623bad26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,18 +6,6 @@ GIT hcaptcha (6.0.2) json -GIT - remote: https://github.com/amplifr/tumblr_client - revision: 3927ee366598a9b70b095933ded32e45f730b652 - specs: - tumblr_client (0.8.5) - faraday - faraday_middleware - json - mime-types - oauth - simple_oauth - GIT remote: https://github.com/mltnhm/carrierwave_backgrounder.git revision: 8fe468957f047ad7039f07679e5952a534d07b6d @@ -187,8 +175,6 @@ GEM faraday-net_http_persistent (1.2.0) faraday-patron (1.0.0) faraday-rack (1.0.0) - faraday_middleware (1.2.0) - faraday (~> 1.0) ffi (1.15.4) ffi-compiler (1.0.1) ffi (>= 1.0.0) @@ -339,9 +325,6 @@ GEM omniauth-rails_csrf_protection (1.0.0) actionpack (>= 4.2) omniauth (~> 2.0) - omniauth-tumblr (1.2) - multi_json - omniauth-oauth (~> 1.0) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack @@ -625,7 +608,6 @@ DEPENDENCIES mini_magick omniauth omniauth-rails_csrf_protection (~> 1.0) - omniauth-tumblr omniauth-twitter pg pghero @@ -657,7 +639,6 @@ DEPENDENCIES simplecov-json spring (~> 2.0) timecop - tumblr_client! turbolinks (~> 2.5.3) twitter twitter-text diff --git a/app/models/services/tumblr.rb b/app/models/services/tumblr.rb deleted file mode 100644 index 85124df7..00000000 --- a/app/models/services/tumblr.rb +++ /dev/null @@ -1,34 +0,0 @@ -class Services::Tumblr < Service - include Rails.application.routes.url_helpers - include SocialHelper::TumblrMethods - - def provider - "tumblr" - end - - def post(answer) - Rails.logger.debug "posting to Tumblr {'answer' => #{answer.id}, 'user' => #{self.user_id}}" - create_post answer - end - - private - - def client - @client ||= Tumblr::Client.new( - consumer_key: APP_CONFIG['sharing']['tumblr']['consumer_key'], - consumer_secret: APP_CONFIG['sharing']['tumblr']['consumer_secret'], - oauth_token: self.access_token, - oauth_token_secret: self.access_secret - ) - end - - def create_post(answer) - client.text( - self.uid, - title: tumblr_title(answer), - body: tumblr_body(answer), - format: 'markdown', - tweet: 'off' - ) - end -end \ No newline at end of file diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 61a34a79..c34c2b2f 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,7 +1,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do - %w(facebook twitter tumblr).each do |service| - if APP_CONFIG['sharing'][service]['enabled'] - provider service.to_sym, APP_CONFIG['sharing'][service]['consumer_key'], APP_CONFIG['sharing'][service]['consumer_secret'] + APP_CONFIG.fetch('sharing').each do |service, opts| + if opts['enabled'] + provider service.to_sym, opts['consumer_key'], opts['consumer_secret'] end end -end \ No newline at end of file +end diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index 22954c2e..f2a17fee 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -41,7 +41,6 @@ RailsAdmin.config do |config| Report Service Services::Twitter - Services::Tumblr Smile Theme User diff --git a/config/justask.yml.example b/config/justask.yml.example index 8c0032bc..199af2a6 100644 --- a/config/justask.yml.example +++ b/config/justask.yml.example @@ -27,13 +27,6 @@ sharing: # Get the tokens from https://apps.twitter.com consumer_key: '' consumer_secret: '' - facebook: - enabled: false - tumblr: - enabled: true - # Get the tokens from https://www.tumblr.com/oauth/apps - consumer_key: '' - consumer_secret: '' # Redis redis_url: "redis://localhost:6379" diff --git a/db/migrate/20220105171216_remove_tumblr_connections.rb b/db/migrate/20220105171216_remove_tumblr_connections.rb new file mode 100644 index 00000000..f0bc111c --- /dev/null +++ b/db/migrate/20220105171216_remove_tumblr_connections.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveTumblrConnections < ActiveRecord::Migration[5.2] + def up + execute %(DELETE FROM services WHERE type = 'Services::Tumblr';) + end + + def down + # won't have tumblr tokens anymore on rollback, but that's ok + end +end diff --git a/db/schema.rb b/db/schema.rb index a1294985..9046d8f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_12_28_135426) do +ActiveRecord::Schema.define(version: 2022_01_05_171216) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/service-docs/en/policy/privacy.md b/service-docs/en/policy/privacy.md index 007bb6d0..f5f897f4 100644 --- a/service-docs/en/policy/privacy.md +++ b/service-docs/en/policy/privacy.md @@ -12,11 +12,10 @@ Like many websites, we use cookies and similar technologies to collect addition #### Non-personal Identification Information When using our Services, we may receive technical information ("Non-personal Identification") information such as your IP address, browser type, operating system, the referring web page, pages visited, location, search terms, and cookie information. We receive this data when you interact with our Services, for example, when you visit our websites or sign into our Services. #### Third-Party Services -Retrospring uses a variety of third-party services to help provide our Services or to share your answers to, if connected, other Services like Twitter or Tumblr. These third-party service providers may collect information sent by your browser as part of a web page request, such as cookies or your IP address. Please refer to their Privacy Policies in regard to how they handle your data. +Retrospring uses a variety of third-party services to help provide our Services or to share your answers to, if connected, other Services like Twitter. These third-party service providers may collect information sent by your browser as part of a web page request, such as cookies or your IP address. Please refer to their Privacy Policies in regard to how they handle your data. * [_Cloudflare - Privacy Policy_](https://www.cloudflare.com/en-gb/privacypolicy/) * [_Twitter - Privacy Policy_](https://twitter.com/en/privacy) -* [_Tumblr - Privacy Policy_](https://www.tumblr.com/privacy/en) ## Information Sharing Retrospring will keep any collected data (see "Information Collection and Use" above) encrypted on our servers. Any information shared with other Services is controlled by the user itself, as we only supply sharing to these. If a user isn't satisfied with Terms from another Service they shouldn't connect their accounts or remove access over the Sharing page on the profile settings page. diff --git a/spec/helpers/social_helper/tumblr_methods_spec.rb b/spec/helpers/social_helper/tumblr_methods_spec.rb index 87c64e4a..c151a6a2 100644 --- a/spec/helpers/social_helper/tumblr_methods_spec.rb +++ b/spec/helpers/social_helper/tumblr_methods_spec.rb @@ -14,11 +14,7 @@ describe SocialHelper::TumblrMethods, :type => :helper do 'anonymous_name' => 'Anonymous', 'https' => true, 'items_per_page' => 5, - 'sharing' => { - 'tumblr' => { - 'consumer_key' => 'AAA', - } - } + 'sharing' => {} }) end @@ -61,4 +57,4 @@ describe SocialHelper::TumblrMethods, :type => :helper do expect(subject).to eq("https://www.tumblr.com/widgets/share/tool?shareSource=legacy&posttype=text&title=#{CGI.escape(tumblr_title(answer))}&url=#{CGI.escape("https://example.com/#{answer.user.screen_name}/a/#{answer.id}")}&caption=&content=#{CGI.escape(tumblr_body(answer))}") end end -end \ No newline at end of file +end diff --git a/spec/models/services/tumblr_spec.rb b/spec/models/services/tumblr_spec.rb deleted file mode 100644 index de702297..00000000 --- a/spec/models/services/tumblr_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -describe Services::Tumblr do - describe "#post" do - let(:user) { FactoryBot.create(:user) } - let(:service) { Services::Tumblr.create(user: user) } - let(:answer) { FactoryBot.create(:answer, user: user, - content: 'a' * 255, - question_content: 'q' * 255) } - let(:tumblr_client) { instance_double(Tumblr::Client) } - - before do - allow(Tumblr::Client).to receive(:new).and_return(tumblr_client) - allow(tumblr_client).to receive(:text) - stub_const("APP_CONFIG", { - 'hostname' => 'example.com', - 'anonymous_name' => 'Anonymous', - 'https' => true, - 'items_per_page' => 5, - 'sharing' => { - 'tumblr' => { - 'consumer_key' => 'AAA', - } - } - }) - end - - it "posts a text-post" do - answer.question.content = 'Why are raccoons so good?' - answer.question.author_is_anonymous = true - answer.question.save! - answer.content = 'Because they are good cunes.' - answer.save! - - service.post(answer) - - expect(tumblr_client).to have_received(:text).with( - service.uid, - title: 'Anonymous asked: Why are raccoons so good?', - body: "Because they are good cunes.\n\n[Smile or comment on the answer here](https://example.com/#{user.screen_name}/a/#{answer.id})", - format: 'markdown', - tweet: 'off' - ) - end - end -end \ No newline at end of file