Fix Rubocop issues

This commit is contained in:
CactusPuppy 2021-02-18 21:03:28 -08:00
parent f67c4aafe0
commit 21e282679f
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
17 changed files with 50 additions and 33 deletions

View file

@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base
!request.xhr?) # don't store ajax calls
session[:return_to] = request.fullpath
end
end
end
def after_sign_in_path_for(_resource)
if (can? :view, Conference) &&

View file

@ -31,7 +31,9 @@ class UsersController < ApplicationController
end
# Somewhat of a hack: users/current/edit
# rubocop:disable Naming/MemoizedInstanceVariableName
def load_user
@user ||= (params[:id] && params[:id] != 'current' && User.find(params[:id]) || current_user)
end
# rubocop:enable Naming/MemoizedInstanceVariableName
end

View file

@ -112,7 +112,7 @@ module ApplicationHelper
concurrent_events << other_event_schedule.event
end
end
concurrent_events.sort_by { |event_schedule| event_schedule.room&.order }
concurrent_events.sort_by { |schedule| schedule.room&.order }
end
def speaker_links(event)

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
# TODO: Split this module into smaller modules
# rubocop:disable Metrics/ModuleLength
module EventsHelper
##
# Includes functions related to events
@ -193,7 +195,7 @@ module EventsHelper
end
end
def calendar_timestamp(timestamp, timezone)
def calendar_timestamp(timestamp, _timezone)
timestamp = timestamp.in_time_zone('GMT')
timestamp -= timestamp.utc_offset
timestamp.strftime('%Y%m%dT%H%M%S')
@ -221,7 +223,7 @@ 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}
#{event_schedule.start_time.strftime('%Y %B %e - %H:%M')} #{event_schedule.timezone}
More Info: #{conference_program_proposal_url(conference, event)}
Join: #{event.url}
@ -256,3 +258,4 @@ module EventsHelper
end
end
end
# rubocop:enable Metrics/ModuleLength

View file

@ -68,6 +68,8 @@ class Ability
end
# Abilities for signed in users
# TODO: Refactor into multiple functions
# rubocop:disable Metrics/AbcSize
def signed_in(user)
# Abilities from not_signed_in user are also inherited
not_signed_in
@ -140,6 +142,7 @@ class Ability
user == track.submitter && !(track.accepted? || track.confirmed?)
end
end
# rubocop:enable Metrics/AbcSize
# Abilities for users with roles wandering around in non-admin views.
def common_abilities_for_admins(user)

View file

@ -30,7 +30,7 @@ class Commercial < ApplicationRecord
begin
resource = OEmbed::Providers.get(url, maxwidth: 560, maxheight: 315)
{ html: resource.html.html_safe }
rescue StandardError => exception
rescue StandardError
{ html: iframe_fallback(url) }
# { error: exception.message }
end

View file

@ -35,6 +35,7 @@
#
# index_conferences_on_organization_id (organization_id)
#
# rubocop:disable Metrics/ClassLength
class Conference < ApplicationRecord
include RevisionCount
require 'uri'
@ -1234,3 +1235,4 @@ class Conference < ApplicationRecord
]
end
end
# rubocop:enable Metrics/ClassLength

View file

@ -305,7 +305,7 @@ class User < ApplicationRecord
# TODO: Use a real authorization in the right place....
def manages_volunteers?(conference)
organizer_roles = get_roles['organizer']
organizer_roles&.include?(conference.short_title) # TODO or Volunteer Coorinator.
organizer_roles&.include?(conference.short_title) # TODO: or Volunteer Coorinator.
end
def registered