diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cdd60ca49..5362e2f72 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -92,6 +92,7 @@ submit the change with your pull request. - André Aubin / [lambda2](https://github.com/lambda2) - Martina Simicic / [simicic](https://github.com/simicic) - Rowan Crawford / [wombleton](https://github.com/wombleton) +- Ítalo Pires / [italopires](https://github.com/italopires) ## Bots diff --git a/Gemfile b/Gemfile index 16f20fd92..916597071 100644 --- a/Gemfile +++ b/Gemfile @@ -94,7 +94,6 @@ gem "bootstrap_form", ">= 4.5.0" # For connecting to other services (eg Twitter) gem 'omniauth', '~> 1.3' -gem 'omniauth-facebook' gem 'omniauth-flickr', '>= 0.0.15' gem 'omniauth-twitter' diff --git a/Gemfile.lock b/Gemfile.lock index 9cb3ba360..a689ea755 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -288,8 +288,8 @@ GEM activesupport (>= 5.1) haml (>= 4.0.6) railties (>= 5.1) - haml_lint (0.42.0) - haml (>= 4.0, < 6.1) + haml_lint (0.43.0) + haml (>= 4.0, < 6.2) parallel (~> 1.10) rainbow rubocop (>= 0.50.0) @@ -338,7 +338,6 @@ GEM concurrent-ruby railties (>= 4.1) jsonapi-swagger (0.8.1) - jwt (2.3.0) kgio (2.11.4) kramdown (2.4.0) rexml @@ -399,27 +398,16 @@ GEM nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) oauth (0.5.6) - oauth2 (1.4.9) - faraday (>= 0.17.3, < 3.0) - jwt (>= 1.0, < 3.0) - multi_json (~> 1.3) - multi_xml (~> 0.5) - rack (>= 1.2, < 3) oj (3.13.23) omniauth (1.9.2) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-facebook (9.0.0) - omniauth-oauth2 (~> 1.2) omniauth-flickr (0.0.20) multi_json (~> 1.12) omniauth-oauth (~> 1.0) omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.7.2) - oauth2 (~> 1.4) - omniauth (>= 1.9, < 3) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack @@ -716,7 +704,6 @@ DEPENDENCIES memcachier oj omniauth (~> 1.3) - omniauth-facebook omniauth-flickr (>= 0.0.15) omniauth-twitter percy-capybara (~> 5.0.0) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 021460c99..1211e870e 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -18,7 +18,6 @@ class MembersController < ApplicationController @member = Member.confirmed.kept.find_by!(slug: params[:slug]) @twitter_auth = @member.auth('twitter') @flickr_auth = @member.auth('flickr') - @facebook_auth = @member.auth('facebook') @posts = @member.posts @activity = TimelineService.member_query(@member).limit(30) diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index c9243c89b..f01ad3d71 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -9,10 +9,6 @@ require './lib/actions/oauth_signup_action' # Heavily overlaps with Authentications controller # class OmniauthCallbacksController < Devise::OmniauthCallbacksController - def facebook - create - end - def failure flash[:alert] = "Authentication failed." redirect_to request.env['omniauth.origin'] || "/" @@ -32,7 +28,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController @authentication = action.establish_authentication(auth, member) if action.member_created? - raise "Invalid provider" unless %w(facebook twitter flickr).index(auth['provider'].to_s) + raise "Invalid provider" unless %w(twitter 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 530321233..29cc5e1b1 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -6,7 +6,6 @@ class RegistrationsController < Devise::RegistrationsController def edit @twitter_auth = current_member.auth('twitter') @flickr_auth = current_member.auth('flickr') - @facebook_auth = current_member.auth('facebook') render "edit" end diff --git a/app/views/devise/registrations/_edit_apps.html.haml b/app/views/devise/registrations/_edit_apps.html.haml index da6e88470..e4bcf487e 100644 --- a/app/views/devise/registrations/_edit_apps.html.haml +++ b/app/views/devise/registrations/_edit_apps.html.haml @@ -28,17 +28,3 @@ method: :delete, class: "remove btn btn-danger" - else = link_to 'Connect to Flickr', '/members/auth/flickr', class: 'btn' - - .row - .col-md-12 - %p - = image_tag "facebook_32.png", size: "32x32", alt: 'Facebook logo' - - if @facebook_auth - You are connected to Facebook as - = succeed "." do - = link_to @facebook_auth.name, "https://facebook.com/profile/#{@facebook_auth.uid}" - = link_to "Disconnect", @facebook_auth, - confirm: "Are you sure you want to remove this connection?", - method: :delete, class: "remove btn btn-danger" - - else - = link_to 'Connect to Facebook', '/members/auth/facebook', class: 'btn' diff --git a/app/views/members/_contact.html.haml b/app/views/members/_contact.html.haml index 69e1f60b0..d6bdb7cb9 100644 --- a/app/views/members/_contact.html.haml +++ b/app/views/members/_contact.html.haml @@ -1,4 +1,4 @@ -- if twitter_auth || flickr_auth || facebook_auth || member.show_email +- if twitter_auth || flickr_auth || member.show_email %h4 Contact - if twitter_auth @@ -11,11 +11,6 @@ = image_tag "flickr_32.png", size: "32x32", alt: 'Flickr logo' = link_to flickr_auth.name, "https://flickr.com/photos/#{flickr_auth.uid}" - - if facebook_auth - %p - = image_tag "facebook_32.png", size: "32x32", alt: 'Facebook logo' - = link_to facebook_auth.name, "https://facebook.com/profile/#{facebook_auth.uid}" - - if member.show_email %p Email: diff --git a/app/views/members/_stats.html.haml b/app/views/members/_stats.html.haml index 7b7d667f6..86f08adc1 100644 --- a/app/views/members/_stats.html.haml +++ b/app/views/members/_stats.html.haml @@ -2,39 +2,39 @@ %h3 Activity %ul.list-group.list-group-flush %li.list-group-item - - if !member.gardens.empty? + - if member.gardens.present? = link_to localize_plural(member.gardens, Garden), member_gardens_path(member) - else 0 gardens %li.list-group-item - - if !member.plantings.empty? + - if member.plantings.present? = link_to localize_plural(member.plantings, Planting), member_plantings_path(member) - else 0 plantings %li.list-group-item - - if !member.harvests.empty? + - if member.harvests.present? = link_to localize_plural(member.harvests, Harvest), member_harvests_path(member) - else 0 harvests %li.list-group-item - - if !member.seeds.empty? + - if member.seeds.present? = link_to localize_plural(member.seeds, Seed), member_seeds_path(member) - else 0 seeds %li.list-group-item - - if !member.posts.empty? + - if member.posts.present? = link_to localize_plural(member.posts, Post), member_posts_path(member) - else 0 posts %li.list-group-item - - if !member.followed.empty? + - if member.followed.present? = link_to localize_plural(member.followed, Follow), member_follows_path(member) - else 0 following %li.list-group-item - - if !member.followers.empty? + - if member.followers.present? = link_to pluralize(member.followers.size, "follower"), member_followers_path(member) - else 0 followers diff --git a/app/views/members/show.html.haml b/app/views/members/show.html.haml index 3f56bb4ef..2a62abac9 100644 --- a/app/views/members/show.html.haml +++ b/app/views/members/show.html.haml @@ -57,8 +57,7 @@ = render "stats", member: @member .card-footer = render "contact", member: @member, twitter_auth: @twitter_auth, - flickr_auth: @flickr_auth, - facebook_auth: @facebook_auth + flickr_auth: @flickr_auth .col-md-10 %section= render "map", member: @member diff --git a/config/environments/test.rb b/config/environments/test.rb index 1cfd2c15a..14276a429 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -104,16 +104,3 @@ Capybara.configure do |config| end OmniAuth.config.test_mode = true -# Fake the omniauth -OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook', - uid: '123545', - info: { - name: "John Testerson", - nickname: 'JohnnyT', - email: 'example.oauth.facebook@example.com', - image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png' - }, - credentials: { - token: "token", - secret: "donttell" - }) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 9e5b06c66..4990573d1 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -233,8 +233,4 @@ Devise.setup do |config| # When using omniauth, Devise cannot automatically set Omniauth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = "/my_engine/users/auth" - - # Later we may wish to ask for user_photos,user_location, however this means we need to be reviewed by facebook - config.omniauth :facebook, ENV['GROWSTUFF_FACEBOOK_KEY'], ENV['GROWSTUFF_FACEBOOK_SECRET'], scope: 'email,public_profile', -display: 'page', info_fields: 'email,name,first_name,last_name,id' end diff --git a/env-example b/env-example index a7d3ef65e..951611496 100644 --- a/env-example +++ b/env-example @@ -50,10 +50,6 @@ GROWSTUFF_TWITTER_SECRET="" GROWSTUFF_FLICKR_KEY="" GROWSTUFF_FLICKR_SECRET="" -# https://developers.facebook.com/ -GROWSTUFF_FACEBOOK_KEY="" -GROWSTUFF_FACEBOOK_SECRET="" - # Elasticsearch is used for flexible search and it requires another component # to be installed. To make it easy for people who don't need to test this feature # it's been turned off for test and development environment as a default. diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb index a20741fb1..fe00fb305 100644 --- a/lib/actions/oauth_signup_action.rb +++ b/lib/actions/oauth_signup_action.rb @@ -63,7 +63,7 @@ class Growstuff::OauthSignupAction case auth['provider'] when 'twitter' auth['info']['nickname'] - when 'flickr', 'facebook' + when 'flickr' auth['info']['name'] else auth['info']['name'] diff --git a/spec/features/signin_spec.rb b/spec/features/signin_spec.rb index 6ea441989..aa9082bd3 100644 --- a/spec/features/signin_spec.rb +++ b/spec/features/signin_spec.rb @@ -82,28 +82,4 @@ describe "signin", js: true do click_button 'Sign in' expect(page).to have_content("There are crops waiting to be wrangled.") end - - context "with facebook" do - it "sign in" do - # Ordinarily done by database_cleaner - Member.where(login_name: 'tdawg').delete_all - - create(:member, login_name: 'tdawg', email: 'example.oauth.facebook@example.com') - - # Start the test - visit root_path - first('.signup a').click - - # Click the signup with facebook link - - first('a[href="/members/auth/facebook"]').click - # Magic happens! - # See config/environments/test.rb for the fake user - # that we pretended to auth as - - # Signed up and logged in - expect(page).to have_current_path root_path, ignore_query: true - expect(page.text).to include("Welcome to #{ENV['GROWSTUFF_SITE_NAME']}, tdawg") - end - end end diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb index 687253a85..5dabbb02d 100644 --- a/spec/features/signup_spec.rb +++ b/spec/features/signup_spec.rb @@ -45,37 +45,4 @@ describe "signup", js: true do click_button 'Sign up' expect(page).to have_current_path members_path, ignore_query: true end - - context "with facebook" do - it "sign up" do - # Ordinarily done by database_cleaner - Member.where(login_name: 'tdawg').delete_all - Member.where(email: 'tdawg@hotmail.com').delete_all - Member.where(email: 'example.oauth.facebook@example.com').delete_all - Authentication.where(provider: 'facebook', uid: '123545').delete_all - - # Start the test - visit root_path - first('.signup a').click - - # Click the signup with facebook link - - first('a[href="/members/auth/facebook"]').click - # Magic happens! - # See config/environments/test.rb for the fake user - # that we pretended to auth as - - # Confirm page - expect(page).to have_current_path '/members/johnnyt/finish_signup' - - fill_in 'Login name', with: 'tdawg' - fill_in 'Email', with: 'tdawg@hotmail.com' - check 'member_tos_agreement' - click_button 'Continue' - - # Signed up and logged in - expect(page).to have_current_path root_path, ignore_query: true - expect(page.text).to include("Welcome to #{ENV['GROWSTUFF_SITE_NAME']}, tdawg") - end - end end diff --git a/spec/views/scientific_names/edit.html.haml_spec.rb b/spec/views/scientific_names/edit.html.haml_spec.rb index 15c904e07..0b148032b 100644 --- a/spec/views/scientific_names/edit.html.haml_spec.rb +++ b/spec/views/scientific_names/edit.html.haml_spec.rb @@ -18,7 +18,9 @@ describe "scientific_names/edit" do expect(rendered).to have_content "Added by #{member} less than a minute ago." end - xit { expect(rendered).to have_link member_path(member) } + it "render member link" do + expect(rendered).to have_link member.login_name, href: member_path(member) + end it "renders the edit scientific_name form" do assert_select "form", action: scientific_names_path(scientific_name), method: "post" do diff --git a/swagger/v1/swagger.json b/swagger/v1/swagger.json index 11d215f1d..575c5423a 100644 --- a/swagger/v1/swagger.json +++ b/swagger/v1/swagger.json @@ -92,13 +92,6 @@ "type": "string", "description": "Display field", "required": false - }, - { - "name": "fields[crops]", - "in": "query", - "type": "string", - "description": "Display field", - "required": false } ], "responses": {