mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Remove unused functions from user model
set_up is callback and should be a private method. removed methods: * ticket(id) was introduced in5f8a8ac6, however never used. * self.prepare(params) only use instance was removed ind21e19b9* attending_conference?(conference) introduced in merge of person and user model23bf55b6, any previous use instance difficult to find * biography_word_count: we are using js for this now * biography_limit only use instance was removed in23bf55b6
This commit is contained in:
parent
0f24a4fa1b
commit
3c356cbaaf
1 changed files with 4 additions and 43 deletions
|
|
@ -61,13 +61,6 @@ class User < ActiveRecord::Base
|
|||
self.subscriptions.find_by(conference_id: conference.id).present?
|
||||
end
|
||||
|
||||
# Returns the purchased ticket
|
||||
# ====Returns
|
||||
# * +TicketUser::ActiveRecord_Relation+ -> user
|
||||
def ticket(id)
|
||||
ticket_purchases.where(ticket_id: id).first
|
||||
end
|
||||
|
||||
def supports? conference
|
||||
ticket_purchases.find_by(conference_id: conference.id).present?
|
||||
end
|
||||
|
|
@ -122,12 +115,6 @@ class User < ActiveRecord::Base
|
|||
user
|
||||
end
|
||||
|
||||
def setup_role
|
||||
if User.count == 1 && User.first.email == 'deleted@localhost.osem'
|
||||
self.is_admin = true
|
||||
end
|
||||
end
|
||||
|
||||
# Gets the roles of the user, groups them by role.name and returns the resource(s) of each role
|
||||
# ====Returns
|
||||
# * +Hash+ * -> e.g. 'organizer' => "(conf1, conf2)"
|
||||
|
|
@ -140,20 +127,6 @@ class User < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
def self.prepare(params)
|
||||
email = params['email']
|
||||
user = User.where(email: email).first_or_initialize
|
||||
|
||||
# If there is a new user, add the necessary attributes
|
||||
if user.new_record?
|
||||
user.password = Devise.friendly_token[0, 20]
|
||||
user.skip_confirmation!
|
||||
user.attributes = params
|
||||
end
|
||||
|
||||
user
|
||||
end
|
||||
|
||||
def registered
|
||||
registrations = self.registrations
|
||||
if registrations.count == 0
|
||||
|
|
@ -176,11 +149,6 @@ class User < ActiveRecord::Base
|
|||
!confirmed_at.nil?
|
||||
end
|
||||
|
||||
def attending_conference?(conference)
|
||||
Registration.where(conference_id: conference.id,
|
||||
user_id: id).count
|
||||
end
|
||||
|
||||
def proposals(conference)
|
||||
events.where('program_id = ? AND event_users.event_role=?', conference.program.id, 'submitter')
|
||||
end
|
||||
|
|
@ -189,18 +157,11 @@ class User < ActiveRecord::Base
|
|||
proposals(conference).count
|
||||
end
|
||||
|
||||
def biography_word_count
|
||||
if biography.nil?
|
||||
0
|
||||
else
|
||||
biography.split.size
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def biography_limit
|
||||
errors.add(:abstract, 'cannot have more than 150 words') if biography &&
|
||||
biography.split.size > 150
|
||||
def setup_role
|
||||
if User.count == 1 && User.first.email == 'deleted@localhost.osem'
|
||||
self.is_admin = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue