diff --git a/app/assets/templates/shared/_twitter.html.erb b/app/assets/templates/shared/_twitter.html.erb
new file mode 100644
index 000000000..af77d9ba3
--- /dev/null
+++ b/app/assets/templates/shared/_twitter.html.erb
@@ -0,0 +1,14 @@
+
diff --git a/app/controllers/api/feeds_controller.rb b/app/controllers/api/feeds_controller.rb
deleted file mode 100644
index f98154408..000000000
--- a/app/controllers/api/feeds_controller.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# API Controller to wrap social networks public feeds
-class API::FeedsController < API::ApiController
-
- respond_to :json
-
- def twitter_timelines
- limit = if params
- params[:limit]
- else
- 3
- end
- from_account = Setting.find_by(name: 'twitter_name').try(:value) || ENV['TWITTER_NAME']
- begin
- @tweet_news = Feed.twitter.user_timeline(from_account, count: limit)
- rescue Twitter::Error::BadRequest => e
- STDERR.puts "[WARNING] Unable to retrieve the twitter feed, please check your ENV configuration. Details: #{e.message}"
- render status: :no_content
- end
- end
-
-end
diff --git a/app/models/feed.rb b/app/models/feed.rb
deleted file mode 100644
index 52f190d32..000000000
--- a/app/models/feed.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class Feed
- mattr_accessor :twitter do
- Twitter::REST::Client.new do |config|
- config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
- config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
- config.access_token = ENV['TWITTER_ACCESS_TOKEN']
- config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET']
- end
- end
-end
diff --git a/config/application.yml.default b/config/application.yml.default
index 19d994944..790a7ee6d 100644
--- a/config/application.yml.default
+++ b/config/application.yml.default
@@ -54,12 +54,8 @@ RECAPTCHA_SECRET_KEY: ''
# Projects comments
DISQUS_SHORTNAME:
-# Twitter sharing & last tweet on home page
+# Twitter sharing
TWITTER_NAME: 'FablabGrenoble'
-TWITTER_CONSUMER_KEY: ''
-TWITTER_CONSUMER_SECRET: ''
-TWITTER_ACCESS_TOKEN: ''
-TWITTER_ACCESS_TOKEN_SECRET: ''
# Facebook sharing
FACEBOOK_APP_ID: ''
@@ -102,4 +98,3 @@ MAX_IMPORT_SIZE: '5242880'
MAX_IMAGE_SIZE: '10485760'
# 20971520 = 20 megabytes
MAX_CAO_SIZE: '20971520'
-
diff --git a/config/initializers/twitter.rb b/config/initializers/twitter.rb
deleted file mode 100644
index 6f9a4e93e..000000000
--- a/config/initializers/twitter.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-Feed.twitter = Twitter::REST::Client.new do |config|
- config.consumer_key = ENV['TWITTER_CONSUMER_KEY']
- config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']
- config.access_token = ENV['TWITTER_ACCESS_TOKEN']
- config.access_token_secret = ENV['TWITTER_ACCESS_TOKEN_SECRET']
-end
diff --git a/config/routes.rb b/config/routes.rb
index 8894a62a3..5d4647f34 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -72,7 +72,6 @@ Rails.application.routes.draw do
# for homepage
get '/last_subscribed/:last' => 'members#last_subscribed'
- get '/feeds/twitter_timelines' => 'feeds#twitter_timelines'
get 'pricing' => 'pricing#index'
put 'pricing' => 'pricing#update'
diff --git a/doc/environment.md b/doc/environment.md
index 0a2152dcd..0e44f11bd 100644
--- a/doc/environment.md
+++ b/doc/environment.md
@@ -99,7 +99,7 @@ Valid stripe API keys are still required, even if you don't require online payme
FABLAB_WITHOUT_INVOICES
-If set to 'true', the invoices will be disabled.
+If set to 'true', the invoices will be disabled.
This is useful if you have your own invoicing system and you want to prevent Fab-manager from generating and sending invoices to members.
**Very important**: if you disable invoices, you still have to configure VAT in the interface to prevent errors in accounting and prices.
@@ -167,15 +167,8 @@ See https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
TWITTER_NAME
-Identifier of the Twitter account, from witch the last tweet will be fetched and displayed on the home page.
-This value can be graphically overridden during the application's lifecycle in Admin/Customization/Home page/Twitter Feed.
+Identifier of the Twitter account for Twitter share project, event or training
It will also be used for [Twitter Card analytics](https://dev.twitter.com/cards/analytics).
-
-
- TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_ACCESS_TOKEN & TWITTER_ACCESS_TOKEN_SECRET
-
-Keys and secrets to access the twitter API.
-Retrieve them from https://apps.twitter.co.
FACEBOOK_APP_ID
@@ -363,7 +356,7 @@ Accordingly, `RAILS_LOCALE` and `APP_LOCALE` must be configured to `ach`.
OPENLAB_APP_ID, OPENLAB_APP_SECRET
-This configuration is optional and can only work in production mode.
+This configuration is optional and can only work in production mode.
It allows you to display a shared projects gallery and to share your projects with other fablabs.
Send an email to **contact@fab-manager.com** to get your OpenLab client's credentials.
diff --git a/package.json b/package.json
index 1344f2e24..4f6db971f 100644
--- a/package.json
+++ b/package.json
@@ -72,6 +72,7 @@
"ngUpload": "0.5",
"nvd3": "1.8",
"summernote": "0.7.3",
+ "twitter-fetcher": "^18.0.2",
"ui-select": "0.19",
"underscore": "1.7"
}
diff --git a/setup/env.example b/setup/env.example
index 6db0127c9..7591de428 100644
--- a/setup/env.example
+++ b/setup/env.example
@@ -40,10 +40,6 @@ RECAPTCHA_SECRET_KEY=
DISQUS_SHORTNAME=
TWITTER_NAME=FablabGrenoble
-TWITTER_CONSUMER_KEY=
-TWITTER_CONSUMER_SECRET=
-TWITTER_ACCESS_TOKEN=
-TWITTER_ACCESS_TOKEN_SECRET=
FACEBOOK_APP_ID=
diff --git a/setup/setup.sh b/setup/setup.sh
index b43076403..159b4c44d 100755
--- a/setup/setup.sh
+++ b/setup/setup.sh
@@ -212,8 +212,8 @@ configure_env_file()
doc=$(\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/doc/environment.md)
variables=(STRIPE_API_KEY STRIPE_PUBLISHABLE_KEY STRIPE_CURRENCY INVOICE_PREFIX FABLAB_WITHOUT_PLANS FABLAB_WITHOUT_SPACES FABLAB_WITHOUT_ONLINE_PAYMENT FABLAB_WITHOUT_INVOICES \
PHONE_REQUIRED USER_CONFIRMATION_NEEDED_TO_SIGN_IN EVENTS_IN_CALENDAR SLOT_DURATION DEFAULT_MAIL_FROM DELIVERY_METHOD DEFAULT_HOST DEFAULT_PROTOCOL SMTP_ADDRESS SMTP_PORT SMTP_USER_NAME SMTP_PASSWORD SMTP_AUTHENTICATION \
- SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS GA_ID RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME TWITTER_CONSUMER_KEY TWITTER_CONSUMER_SECRET \
- TWITTER_ACCESS_TOKEN TWITTER_ACCESS_TOKEN_SECRET FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
+ SMTP_ENABLE_STARTTLS_AUTO SMTP_OPENSSL_VERIFY_MODE SMTP_TLS GA_ID RECAPTCHA_SITE_KEY RECAPTCHA_SECRET_KEY DISQUS_SHORTNAME TWITTER_NAME \
+ FACEBOOK_APP_ID LOG_LEVEL ALLOWED_EXTENSIONS ALLOWED_MIME_TYPES MAX_IMAGE_SIZE MAX_CAO_SIZE MAX_IMPORT_SIZE DISK_SPACE_MB_ALERT \
SUPERADMIN_EMAIL APP_LOCALE RAILS_LOCALE MOMENT_LOCALE SUMMERNOTE_LOCALE ANGULAR_LOCALE MESSAGEFORMAT_LOCALE FULLCALENDAR_LOCALE ELASTICSEARCH_LANGUAGE_ANALYZER TIME_ZONE \
WEEK_STARTING_DAY D3_DATE_FORMAT UIB_DATE_FORMAT EXCEL_DATE_FORMAT OPENLAB_APP_ID OPENLAB_APP_SECRET OPENLAB_DEFAULT)
for variable in "${variables[@]}"; do
@@ -331,4 +331,3 @@ setup()
}
setup "$@"
-
diff --git a/yarn.lock b/yarn.lock
index 2e2d438c0..570b919b1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1498,6 +1498,11 @@ tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
+twitter-fetcher@^18.0.2:
+ version "18.0.2"
+ resolved "https://registry.yarnpkg.com/twitter-fetcher/-/twitter-fetcher-18.0.2.tgz#47aeff8f3ccbec54443d7f5a5e845ed5279c0b5f"
+ integrity sha1-R67/jzzL7FREPX9aXoRe1SecC18=
+
type-check@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"