run rubocp --fix
This commit is contained in:
parent
1ca72dcf74
commit
2b2745ade9
26 changed files with 104 additions and 107 deletions
|
|
@ -9,7 +9,7 @@ module Admin
|
|||
|
||||
def index
|
||||
@events = Event.accessible_by(current_ability).where(program: @program,
|
||||
state: [:confirmed, :unconfirmed])
|
||||
state: [:confirmed, :unconfirmed])
|
||||
@events_commercials = Commercial.where(commercialable_type: 'Event', commercialable_id: @events.pluck(:id))
|
||||
@events_missing_commercial = @events.where.not(id: @events_commercials.pluck(:commercialable_id))
|
||||
@events_with_requirements = @events.where.not(description: ['', nil])
|
||||
|
|
|
|||
|
|
@ -10,21 +10,21 @@ class ApplicationController < ActionController::Base
|
|||
check_authorization unless: :devise_controller?
|
||||
skip_authorization_check if:
|
||||
|
||||
def store_location
|
||||
# store last url - this is needed for post-login redirect to whatever the user last visited.
|
||||
return unless request.get?
|
||||
def store_location
|
||||
# store last url - this is needed for post-login redirect to whatever the user last visited.
|
||||
return unless request.get?
|
||||
|
||||
if (request.path != '/accounts/sign_in' &&
|
||||
request.path != '/accounts/sign_up' &&
|
||||
request.path != '/accounts/password/new' &&
|
||||
request.path != '/accounts/password/edit' &&
|
||||
request.path != '/accounts/confirmation' &&
|
||||
request.path != '/accounts/sign_out' &&
|
||||
request.path != '/users/ichain_registration/ichain_sign_up' &&
|
||||
!request.path.starts_with?(Devise.ichain_base_url) &&
|
||||
!request.xhr?) # don't store ajax calls
|
||||
session[:return_to] = request.fullpath
|
||||
end
|
||||
if (request.path != '/accounts/sign_in' &&
|
||||
request.path != '/accounts/sign_up' &&
|
||||
request.path != '/accounts/password/new' &&
|
||||
request.path != '/accounts/password/edit' &&
|
||||
request.path != '/accounts/confirmation' &&
|
||||
request.path != '/accounts/sign_out' &&
|
||||
request.path != '/users/ichain_registration/ichain_sign_up' &&
|
||||
!request.path.starts_with?(Devise.ichain_base_url) &&
|
||||
!request.xhr?) # don't store ajax calls
|
||||
session[:return_to] = request.fullpath
|
||||
end
|
||||
end
|
||||
|
||||
def after_sign_in_path_for(_resource)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
end
|
||||
elsif @conference.registration_ticket_required? && !current_user.supports?(@conference)
|
||||
redirect_to conference_tickets_path(@conference.short_title),
|
||||
error: 'You must buy a registration ticket before registering.'
|
||||
error: 'You must buy a registration ticket before registering.'
|
||||
else
|
||||
flash.now[:error] = "Could not create your registration for #{@conference.title}: "\
|
||||
"#{@registration.errors.full_messages.join('. ')}."
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class UsersController < ApplicationController
|
|||
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :biography, :nickname, :affiliation,
|
||||
:picture, :picture_cache)
|
||||
:picture, :picture_cache)
|
||||
end
|
||||
|
||||
# Somewhat of a hack: users/current/edit
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserDatatable < AjaxDatatablesRails::Base
|
||||
|
|
|
|||
|
|
@ -201,8 +201,8 @@ module ApplicationHelper
|
|||
|
||||
def nav_link_text(conference)
|
||||
conference.try(:organization).try(:name) ||
|
||||
ENV['OSEM_NAME'] ||
|
||||
'OSEM'
|
||||
ENV['OSEM_NAME'] ||
|
||||
'OSEM'
|
||||
end
|
||||
|
||||
# returns the url to be used for logo on basis of sponsorship level position
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ module ConferenceHelper
|
|||
|
||||
def short_ticket_description(ticket)
|
||||
return unless ticket.description
|
||||
|
||||
markdown(ticket.description.split("\n").first&.strip)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ module EventsHelper
|
|||
conference_id,
|
||||
event.id,
|
||||
event.send(attribute),
|
||||
url: admin_conference_program_event_path(
|
||||
url: admin_conference_program_event_path(
|
||||
conference_id,
|
||||
event,
|
||||
event: { attribute => nil }
|
||||
|
|
@ -183,7 +183,7 @@ module EventsHelper
|
|||
if current_user.roles.where(id: conference.roles).any?
|
||||
# Show Pre-Event links for any memeber of the conference team.
|
||||
link_to("Join Live Event #{'(Admin link)' unless is_now}",
|
||||
event.url, target: '_blank')
|
||||
event.url, target: '_blank')
|
||||
elsif current_user.registered_to_event?(conference)
|
||||
if is_now
|
||||
link_to('Join Live Event', event.url, target: '_blank')
|
||||
|
|
@ -206,12 +206,12 @@ module EventsHelper
|
|||
start_timestamp = calendar_timestamp(event_schedule.start_time, conference.timezone)
|
||||
end_timestamp = calendar_timestamp(event_schedule.end_time, conference.timezone)
|
||||
event_details = {
|
||||
action: 'TEMPLATE',
|
||||
text: "#{event.title} at #{conference.title}",
|
||||
details: calendar_event_text(event, event_schedule, conference),
|
||||
action: 'TEMPLATE',
|
||||
text: "#{event.title} at #{conference.title}",
|
||||
details: calendar_event_text(event, event_schedule, conference),
|
||||
location: "#{event.room.name} #{event.url}",
|
||||
dates: "#{start_timestamp}/#{end_timestamp}",
|
||||
ctz: event_schedule.timezone
|
||||
dates: "#{start_timestamp}/#{end_timestamp}",
|
||||
ctz: event_schedule.timezone
|
||||
}
|
||||
"#{calendar_base}?#{event_details.to_param}"
|
||||
end
|
||||
|
|
@ -220,13 +220,13 @@ module EventsHelper
|
|||
|
||||
def calendar_event_text(event, event_schedule, conference)
|
||||
<<~TEXT
|
||||
#{conference.title} - #{event.title}
|
||||
#{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone}
|
||||
#{conference.title} - #{event.title}
|
||||
#{event_schedule.start_time.strftime("%Y %B %e - %H:%M")} #{event_schedule.timezone}
|
||||
|
||||
More Info: #{conference_program_proposal_url(conference, event)}
|
||||
Join: #{event.url}
|
||||
More Info: #{conference_program_proposal_url(conference, event)}
|
||||
Join: #{event.url}
|
||||
|
||||
#{truncate(event.abstract, length: 200)}
|
||||
#{truncate(event.abstract, length: 200)}
|
||||
TEXT
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -184,12 +184,12 @@ module FormatHelper
|
|||
return '' if text.nil?
|
||||
|
||||
options = {
|
||||
autolink: true,
|
||||
autolink: true,
|
||||
space_after_headers: true,
|
||||
tables: true,
|
||||
strikethrough: true,
|
||||
footnotes: true,
|
||||
superscript: true
|
||||
tables: true,
|
||||
strikethrough: true,
|
||||
footnotes: true,
|
||||
superscript: true
|
||||
}
|
||||
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(escape_html: escape_html), options)
|
||||
markdown.render(text).html_safe
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class Conference < ApplicationRecord
|
|||
has_many :highlighted_events,
|
||||
-> { where(state: :confirmed, is_highlight: true) },
|
||||
through: :program,
|
||||
source: :events
|
||||
source: :events
|
||||
has_many :event_types, through: :program
|
||||
|
||||
has_many :surveys, as: :surveyable, dependent: :destroy do
|
||||
|
|
|
|||
|
|
@ -310,7 +310,6 @@ class Event < ApplicationRecord
|
|||
event_schedules.find_by(schedule_id: selected_schedule_id).try(:happening_now?)
|
||||
end
|
||||
|
||||
|
||||
##
|
||||
# Returns true or false, if the event is already over or not
|
||||
#
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#
|
||||
class EventUser < ApplicationRecord
|
||||
ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator],
|
||||
%w[Volunteer volunteer]]
|
||||
%w[Volunteer volunteer]]
|
||||
|
||||
belongs_to :event, touch: true
|
||||
belongs_to :user
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Payment < ApplicationRecord
|
|||
end
|
||||
|
||||
def stripe_description
|
||||
#"ticket purchases(#{user.username})"
|
||||
# "ticket purchases(#{user.username})"
|
||||
"Tickets for #{conference.title} #{user.name} #{user.email}"
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class Registration < ApplicationRecord
|
|||
|
||||
def user_has_registration_ticket
|
||||
return if conference.registration_ticket_required? &&
|
||||
TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any?
|
||||
TicketPurchase.where(user: user, ticket: conference.registration_tickets).paid.any?
|
||||
|
||||
errors.add(:base, 'You must purchase a registration ticket before registering')
|
||||
if TicketPurchase.where(user: user, ticket: conference.registration_tickets).unpaid.any?
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ end
|
|||
def count_purchased_registration_tickets(conference, purchases)
|
||||
# TODO: WHAT CAUSED THIS???
|
||||
return 0 unless purchases
|
||||
|
||||
conference.tickets.for_registration.inject(0) do |sum, registration_ticket|
|
||||
sum + purchases[registration_ticket.id.to_s].to_i
|
||||
end
|
||||
|
|
|
|||
|
|
@ -101,9 +101,8 @@ class User < ApplicationRecord
|
|||
[:database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
|
||||
:omniauthable,
|
||||
omniauth_providers: [:suse, :google, :facebook, :github, :discourse]
|
||||
omniauth_providers: [:suse, :google, :facebook, :github, :discourse]]
|
||||
# omniauth_providers: [:google, :discourse]
|
||||
]
|
||||
end
|
||||
|
||||
devise(*devise_modules)
|
||||
|
|
@ -206,6 +205,7 @@ class User < ApplicationRecord
|
|||
# Partials should *not* directly call `gravatar_url`
|
||||
def profile_picture(opts = {})
|
||||
return gravatar_url(opts) unless picture.present?
|
||||
|
||||
size = (opts[:size] || 0).to_i
|
||||
if size < 50
|
||||
picture.tiny.url
|
||||
|
|
@ -346,7 +346,6 @@ class User < ApplicationRecord
|
|||
events.where(program_id: conference.program.id, 'event_users.event_role': 'volunteer')
|
||||
end
|
||||
|
||||
|
||||
def self.empty?
|
||||
User.count == 1 && User.first.email == 'deleted@localhost.osem'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Devise.setup do |config|
|
|||
|
||||
# TODO-SNAPCON: This ought to be configurable. Use OSEM_DISCOURSE_KEY?
|
||||
config.omniauth :discourse,
|
||||
sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider',
|
||||
sso_url: 'https://forum.snap.berkeley.edu/session/sso_provider',
|
||||
sso_secret: ENV['OSEM_DISCOURSE_SECRET']
|
||||
|
||||
config.omniauth :facebook,
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ end
|
|||
lowlevel_error_handler do |ex, env|
|
||||
Sentry.capture_exception(
|
||||
ex,
|
||||
:message => ex.message,
|
||||
:extra => { :puma => env },
|
||||
:message => ex.message,
|
||||
:extra => { :puma => env },
|
||||
:transaction => "Puma"
|
||||
)
|
||||
# note the below is just a Rack response
|
||||
|
|
|
|||
|
|
@ -7,51 +7,51 @@ if Rails.env.development?
|
|||
# You can override any of these by setting an environment variable of the
|
||||
# same name.
|
||||
Annotate.set_defaults(
|
||||
'active_admin' => 'false',
|
||||
'additional_file_patterns' => [],
|
||||
'routes' => 'false',
|
||||
'models' => 'true',
|
||||
'position_in_routes' => 'before',
|
||||
'position_in_class' => 'before',
|
||||
'position_in_test' => 'before',
|
||||
'position_in_fixture' => 'before',
|
||||
'position_in_factory' => 'before',
|
||||
'position_in_serializer' => 'before',
|
||||
'show_foreign_keys' => 'true',
|
||||
'show_complete_foreign_keys' => 'false',
|
||||
'show_indexes' => 'true',
|
||||
'simple_indexes' => 'false',
|
||||
'model_dir' => 'app/models',
|
||||
'root_dir' => '',
|
||||
'include_version' => 'false',
|
||||
'require' => '',
|
||||
'exclude_tests' => 'false',
|
||||
'exclude_fixtures' => 'false',
|
||||
'exclude_factories' => 'false',
|
||||
'exclude_serializers' => 'false',
|
||||
'exclude_scaffolds' => 'true',
|
||||
'exclude_controllers' => 'true',
|
||||
'exclude_helpers' => 'true',
|
||||
'exclude_sti_subclasses' => 'false',
|
||||
'ignore_model_sub_dir' => 'false',
|
||||
'ignore_columns' => nil,
|
||||
'ignore_routes' => nil,
|
||||
'ignore_unknown_models' => 'false',
|
||||
'hide_limit_column_types' => 'integer,bigint,boolean',
|
||||
'hide_default_column_types' => 'json,jsonb,hstore',
|
||||
'skip_on_db_migrate' => 'false',
|
||||
'format_bare' => 'true',
|
||||
'format_rdoc' => 'false',
|
||||
'format_yard' => 'false',
|
||||
'format_markdown' => 'false',
|
||||
'sort' => 'false',
|
||||
'force' => 'false',
|
||||
'frozen' => 'false',
|
||||
'classified_sort' => 'true',
|
||||
'trace' => 'false',
|
||||
'wrapper_open' => nil,
|
||||
'wrapper_close' => nil,
|
||||
'with_comment' => 'true'
|
||||
'active_admin' => 'false',
|
||||
'additional_file_patterns' => [],
|
||||
'routes' => 'false',
|
||||
'models' => 'true',
|
||||
'position_in_routes' => 'before',
|
||||
'position_in_class' => 'before',
|
||||
'position_in_test' => 'before',
|
||||
'position_in_fixture' => 'before',
|
||||
'position_in_factory' => 'before',
|
||||
'position_in_serializer' => 'before',
|
||||
'show_foreign_keys' => 'true',
|
||||
'show_complete_foreign_keys' => 'false',
|
||||
'show_indexes' => 'true',
|
||||
'simple_indexes' => 'false',
|
||||
'model_dir' => 'app/models',
|
||||
'root_dir' => '',
|
||||
'include_version' => 'false',
|
||||
'require' => '',
|
||||
'exclude_tests' => 'false',
|
||||
'exclude_fixtures' => 'false',
|
||||
'exclude_factories' => 'false',
|
||||
'exclude_serializers' => 'false',
|
||||
'exclude_scaffolds' => 'true',
|
||||
'exclude_controllers' => 'true',
|
||||
'exclude_helpers' => 'true',
|
||||
'exclude_sti_subclasses' => 'false',
|
||||
'ignore_model_sub_dir' => 'false',
|
||||
'ignore_columns' => nil,
|
||||
'ignore_routes' => nil,
|
||||
'ignore_unknown_models' => 'false',
|
||||
'hide_limit_column_types' => 'integer,bigint,boolean',
|
||||
'hide_default_column_types' => 'json,jsonb,hstore',
|
||||
'skip_on_db_migrate' => 'false',
|
||||
'format_bare' => 'true',
|
||||
'format_rdoc' => 'false',
|
||||
'format_yard' => 'false',
|
||||
'format_markdown' => 'false',
|
||||
'sort' => 'false',
|
||||
'force' => 'false',
|
||||
'frozen' => 'false',
|
||||
'classified_sort' => 'true',
|
||||
'trace' => 'false',
|
||||
'wrapper_open' => nil,
|
||||
'wrapper_close' => nil,
|
||||
'with_comment' => 'true'
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ describe Admin::TicketsController do
|
|||
it 'creates new ticket' do
|
||||
expect do
|
||||
post :create, params: {
|
||||
ticket: attributes_for(:ticket),
|
||||
conference_id: conference
|
||||
ticket: attributes_for(:ticket),
|
||||
conference_id: conference
|
||||
}
|
||||
end.to change{ conference.tickets.count }.from(ticket_count).to(ticket_count + 1)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ feature 'Has correct abilities' do
|
|||
other_user = create(:user)
|
||||
ticket = conference.registration_tickets.first
|
||||
create(:paid_ticket_purchase,
|
||||
user: other_user, ticket: ticket, quantity: 1, conference: conference)
|
||||
user: other_user, ticket: ticket, quantity: 1, conference: conference)
|
||||
create(:registration, user: other_user, conference: conference)
|
||||
visit edit_admin_conference_registration_path(conference.short_title, conference.registrations.first)
|
||||
expect(current_path).to eq(edit_admin_conference_registration_path(conference.short_title, conference.registrations.first))
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ feature 'Has correct abilities' do
|
|||
other_user = create(:user)
|
||||
ticket = conference.registration_tickets.first
|
||||
create(:paid_ticket_purchase,
|
||||
user: other_user, ticket: ticket, quantity: 1, conference: conference)
|
||||
user: other_user, ticket: ticket, quantity: 1, conference: conference)
|
||||
create(:registration, user: other_user, conference: conference)
|
||||
visit edit_admin_conference_registration_path(conference.short_title, conference.registrations.first)
|
||||
expect(current_path).to eq(edit_admin_conference_registration_path(conference.short_title, conference.registrations.first))
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ describe FormatHelper, type: :helper do
|
|||
expect(Redcarpet::Markdown).to receive(:new)
|
||||
.with(
|
||||
Redcarpet::Render::HTML,
|
||||
autolink: true,
|
||||
autolink: true,
|
||||
space_after_headers: true,
|
||||
tables: true,
|
||||
strikethrough: true,
|
||||
footnotes: true,
|
||||
superscript: true
|
||||
tables: true,
|
||||
strikethrough: true,
|
||||
footnotes: true,
|
||||
superscript: true
|
||||
)
|
||||
.and_call_original
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#
|
||||
# index_conferences_on_organization_id (organization_id)
|
||||
#
|
||||
#!/bin/env ruby
|
||||
# !/bin/env ruby
|
||||
require 'spec_helper'
|
||||
|
||||
describe Conference do
|
||||
|
|
|
|||
|
|
@ -35,6 +35,6 @@ def mock_commercial_request
|
|||
end
|
||||
|
||||
def mock_image_request
|
||||
WebMock.stub_request(:post, "https://api.cloudinary.com/v1_1/snapcon/image/destroy").
|
||||
to_return(status: 200, body: {}.to_json, headers: {})
|
||||
WebMock.stub_request(:post, "https://api.cloudinary.com/v1_1/snapcon/image/destroy")
|
||||
.to_return(status: 200, body: {}.to_json, headers: {})
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ module OmniauthMacros
|
|||
ENV['OSEM_DISCOURSE_KEY'] = 'test key discourse'
|
||||
ENV['OSEM_DISCOURSE_SECRET'] = 'test secret discourse'
|
||||
|
||||
|
||||
|
||||
def mock_auth_new_user
|
||||
OmniAuth.config.mock_auth[:google] =
|
||||
OmniAuth::AuthHash.new(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue