Skip to content

Commit

Permalink
Merge branch 'master' into master-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
thatandromeda committed Dec 20, 2018
2 parents 6d5c8d6 + 9fbb6e0 commit 329d05f
Show file tree
Hide file tree
Showing 73 changed files with 246 additions and 1,585 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rerun.txt
tags
vendor/bundler_gems
config/database.yml
config/elasticsearch.yml
.idea/*
.byebug_history
.rubocop.yml
Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ source 'https://rubygems.org'
gem 'active_model_serializers', '~> 0.8.3'
gem 'activerecord-import'
gem 'acts-as-taggable-on'
gem 'addressable'
gem 'ancestry'
gem 'bootstrap-datepicker-rails'
gem 'bourbon'
Expand Down Expand Up @@ -36,7 +35,6 @@ gem 'rack-test', require: 'rack/test'
gem 'rails', '~> 4.2.11'
gem 'rails_admin'
gem 'rails_admin_tag_list'
gem 'recaptcha'
gem 'recipient_interceptor'
gem 'redcarpet', '~>2.3.0'
gem 'ruby-progressbar'
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
recaptcha (4.13.0)
json
recipient_interceptor (0.1.1)
mail
redcarpet (2.3.0)
Expand Down Expand Up @@ -425,7 +423,6 @@ DEPENDENCIES
active_model_serializers (~> 0.8.3)
activerecord-import
acts-as-taggable-on
addressable
ancestry
binding_of_caller
bootstrap-datepicker-rails
Expand Down Expand Up @@ -475,7 +472,6 @@ DEPENDENCIES
rails (~> 4.2.11)
rails_admin
rails_admin_tag_list
recaptcha
recipient_interceptor
redcarpet (~> 2.3.0)
rspec-collection_matchers (~> 1.1, >= 1.1.2)
Expand Down
25 changes: 0 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,6 @@ Profiling:
* runs in dev by default; can run anywhere by setting `ENV[LUMEN_USE_OINK]` (ok to run in production)
* logs to `log/oink.log`

## Environment variables

- `RAILS_LOG_LEVEL` - logging level
- `WEB_CONCURRENCY` - number of Unicorn workers
- `WEB_TIMEOUT` - Unicorn timeout
- `MAILER_DELIVERY_METHOD` - mailer delivery method
- `DEFAULT_SENDER` - default mailer sender
- `RETURN_PATH` - default mailer return path
- `SITE_HOST` - site host, used in mailer templates
- `SMTP_ADDRESS` - SMTP server address
- `SMTP_DOMAIN` - SMTP server domain
- `SMTP_USERNAME` - SMTP server username
- `SMTP_PASSWORD` - SMTP server password
- `SMTP_PORT` - SMTP server port
- `TWITTER_CONSUMER_KEY` - Twitter integration public key
- `TWITTER_CONSUMER_SECRET` - Twitter integration private key
- `TWITTER_OAUTH_TOKEN` - Twitter integration OAuth token
- `TWITTER_OAUTH_TOKEN_SECRET` - Twitter integration OAuth token secret key
- `RECAPTCHA_SITE_KEY` - reCAPTCHA public key
- `RECAPTCHA_SECRET_KEY` - reCAPTCHA private key
- `BROWSER_VALIDATIONS` - enable user browser form validations
- `BATCH_SIZE` - batch size of model items indexed during each run of Elasticsearch re-indexing
- `SEARCH_SLEEP` - used in specs only, time out of Elasticsearch searches
- `RACK_ENV` - Rack environment

Ephemera
========

Expand Down
1 change: 0 additions & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
@import 'blog/index';
@import 'blog/show';
@import 'counter_notices/show';
@import 'token_urls/index';

@import 'pages/pages';

Expand Down
7 changes: 0 additions & 7 deletions app/assets/stylesheets/bitters/_flashes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

/* Success, error & notice boxes for messages and errors. */
// div.error, div.notice, div.success, #flash_failure, #flash_success, #flash_notice {

#flash {
> div {
padding: 10px 20px;
}
}

div#flash_alert {
margin-bottom: .75em;
margin-bottom: .75rem;
Expand Down
4 changes: 0 additions & 4 deletions app/assets/stylesheets/notices/_show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,6 @@ article.notice-show {
font-size: $base-font-size;
padding: 10px $base-padding;
}

.notice-permanent-url {
padding: 10px $base-padding;
}
}

// Attachments
Expand Down
9 changes: 0 additions & 9 deletions app/assets/stylesheets/token_urls/_index.scss

This file was deleted.

22 changes: 0 additions & 22 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ class ApplicationController < ActionController::Base
after_filter :store_action
after_action :include_auth_cookie

if Rails.env.staging? || Rails.env.production?
rescue_from ActiveRecord::RecordNotFound do |exception|
resource_not_found(exception)
end
end

private

def meta_hash_for(results)
Expand Down Expand Up @@ -87,20 +81,4 @@ def store_action

store_location_for(:user, request.fullpath)
end

def resource_not_found(exception)
logger.error(exception)

respond_to do |format|
format.html do
render file: 'public/404',
status: :not_found,
layout: false
end
format.json do
render json: 'Not Found',
status: :not_found
end
end
end
end
76 changes: 24 additions & 52 deletions app/controllers/notices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,30 @@ def create

def show
return unless (@notice = Notice.find(params[:id]))

respond_to do |format|
show_html format
show_json format
format.html do
if @notice.rescinded?
render :rescinded
elsif @notice.hidden
render file: 'public/404_hidden',
formats: [:html],
status: :not_found,
layout: false
elsif @notice.spam || !@notice.published
render file: 'public/404_unavailable',
formats: [:html],
status: :not_found,
layout: false
else
render :show
end
end

format.json do
render json: @notice,
serializer: NoticeSerializerProxy,
root: json_root_for(@notice.class)
end
end
end

Expand Down Expand Up @@ -164,7 +184,7 @@ def researcher?
return false unless request.headers['HTTP_X_AUTHENTICATION_TOKEN']
User.find_by_authentication_token(
request.headers['HTTP_X_AUTHENTICATION_TOKEN']
).role?(Role.researcher)
).has_role?(Role.researcher)
end

def build_entity_notice_roles(model_class)
Expand Down Expand Up @@ -244,52 +264,4 @@ def json_errors(notice)
{ errors: msg }
end
end

def run_show_callbacks
process_notice_viewer_request unless current_user.nil?
end

def process_notice_viewer_request
# Only notice viewers
return unless current_user.role?(Role.notice_viewer)
# Only when the views limit is set for a user
return unless current_user.notice_viewer_views_limit.present?
# No need to update the counter when the limit is reached
return if current_user.notice_viewer_viewed_notices >= current_user.notice_viewer_views_limit

current_user.increment!(:notice_viewer_viewed_notices)
end

def show_html(format)
format.html do
show_render_html
end
end

def show_json(format)
format.json do
render json: @notice,
serializer: NoticeSerializerProxy,
root: json_root_for(@notice.class)
end
end

def show_render_html
if @notice.rescinded?
render :rescinded
elsif @notice.hidden
render file: 'public/404_hidden',
formats: [:html],
status: :not_found,
layout: false
elsif @notice.spam || !@notice.published
render file: 'public/404_unavailable',
formats: [:html],
status: :not_found,
layout: false
else
render :show
run_show_callbacks
end
end
end
112 changes: 0 additions & 112 deletions app/controllers/token_urls_controller.rb

This file was deleted.

Loading

0 comments on commit 329d05f

Please sign in to comment.