mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-04-12 02:50:27 -04:00
Merge branch 'dev' into reupgrade-ruby
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
1
Gemfile
1
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'
|
||||
|
||||
|
||||
17
Gemfile.lock
17
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -92,13 +92,6 @@
|
||||
"type": "string",
|
||||
"description": "Display field",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"name": "fields[crops]",
|
||||
"in": "query",
|
||||
"type": "string",
|
||||
"description": "Display field",
|
||||
"required": false
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
||||
Reference in New Issue
Block a user