diff --git a/Gemfile b/Gemfile index fc285d73..84b96363 100644 --- a/Gemfile +++ b/Gemfile @@ -57,13 +57,11 @@ gem 'redcarpet' #markdown formatting # Analytics gem 'mixpanel-ruby' gem 'barnes' - -# Sharing -gem 'social-share-button' +gem 'skylight' # Apps #gem 'easy_translate' -gem 'levenshtein-ffi' +#gem 'levenshtein-ffi' # Forum gem 'thredded' diff --git a/Gemfile.lock b/Gemfile.lock index 4763c38e..f89e44e3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -236,8 +236,6 @@ GEM kaminari-core (= 1.1.1) kaminari-core (1.1.1) kramdown (1.17.0) - levenshtein-ffi (1.1.0) - ffi (~> 1.9) libv8 (6.7.288.46.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) @@ -460,9 +458,11 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) + skylight (3.1.2) + skylight-core (= 3.1.2) + skylight-core (3.1.2) + activesupport (>= 4.2.0) slack-notifier (2.3.2) - social-share-button (1.1.0) - coffee-rails sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -562,7 +562,6 @@ DEPENDENCIES guard guard-minitest guard-rubocop - levenshtein-ffi material_icons medium-editor-rails memory_profiler @@ -596,8 +595,8 @@ DEPENDENCIES serendipitous! shoulda-matchers (~> 3.1) simplecov + skylight slack-notifier - social-share-button sqlite3 stackprof stripe diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index bce2f0db..595fc42b 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -40,7 +40,8 @@ class ContentController < ApplicationController def show content_type = content_type_from_controller(self.class) return redirect_to root_path unless valid_content_types.map(&:name).include?(content_type.name) - @content = content_type.find(params[:id]) + @content = content_type.find_by(id: params[:id]) + return redirect_to(root_path, notice: "You don't have permission to view that content.") if @content.nil? @serialized_content = ContentSerializer.new(@content) return redirect_to(root_path) if @content.user.nil? # deleted user's content diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9435ea5a..f341616f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,7 +4,9 @@ class UsersController < ApplicationController end def show - @user = User.find(params[:id]) + @user = User.find_by(id: params[:id]) + return redirect_to(root_path, notice: 'That user does not exist.') if @user.nil? + @content = @user.public_content.select { |type, list| list.any? } @tabs = @content.keys @stream = @user.content_change_events.order('updated_at desc').limit(100).group_by do |cce| diff --git a/config/initializers/social_share_button.rb b/config/initializers/social_share_button.rb deleted file mode 100644 index 0d17d72a..00000000 --- a/config/initializers/social_share_button.rb +++ /dev/null @@ -1,5 +0,0 @@ -SocialShareButton.configure do |config| - config.allow_sites = %w(twitter facebook google_plus weibo qq douban google_bookmark - delicious tumblr pinterest email linkedin wechat vkontakte - xing reddit hacker_news telegram odnoklassniki) -end diff --git a/config/skylight.yml b/config/skylight.yml new file mode 100644 index 00000000..cffe8227 --- /dev/null +++ b/config/skylight.yml @@ -0,0 +1,4 @@ +--- +# The authentication token for the application. +# I think this is actually ignored if the ENV var is set, but this is fine for reference / dummy data. +authentication: ENV['SKYLIGHT_AUTHENTICATION']