Fix Rubocop issues
This commit is contained in:
parent
a45008640f
commit
7f5d06b23c
27 changed files with 94 additions and 83 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# rubocop:disable Metrics/ClassLength
|
||||
class Conference < ApplicationRecord
|
||||
include RevisionCount
|
||||
require 'uri'
|
||||
|
|
@ -1199,3 +1200,4 @@ class Conference < ApplicationRecord
|
|||
]
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/ClassLength
|
||||
|
|
|
|||
|
|
@ -281,7 +281,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
|
||||
#
|
||||
|
|
|
|||
|
|
@ -2,7 +2,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
|
||||
|
|
|
|||
|
|
@ -23,7 +23,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
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,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
|
||||
|
|
|
|||
|
|
@ -56,8 +56,7 @@ class User < ApplicationRecord
|
|||
:recoverable, :rememberable, :trackable, :validatable, :confirmable,
|
||||
:omniauthable,
|
||||
# omniauth_providers: [:suse, :google, :facebook, :github, :discourse]
|
||||
omniauth_providers: [:google, :discourse]
|
||||
]
|
||||
omniauth_providers: [:google, :discourse]]
|
||||
end
|
||||
|
||||
devise(*devise_modules)
|
||||
|
|
@ -160,6 +159,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
|
||||
|
|
@ -259,7 +259,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
|
||||
|
|
@ -300,7 +300,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue