automatically approve invited users on forum where moderators must approve (keep in mind only moderators can invite)

speed up specs a touch
allow invite controller to accept an email in absence of user (cleans up API)
This commit is contained in:
Sam
2013-07-11 11:21:39 +10:00
parent 7792b7da48
commit 1aef6de4b0
5 changed files with 42 additions and 24 deletions

View File

@@ -18,6 +18,7 @@ InviteRedeemer = Struct.new(:invite) do
add_to_private_topics_if_invited
add_user_to_invited_topics
send_welcome_message
approve_account_if_needed
notify_invitee
end
@@ -66,8 +67,12 @@ InviteRedeemer = Struct.new(:invite) do
end
end
def approve_account_if_needed
invited_user.approve(invite.invited_by_id, send_email=false)
end
def notify_invitee
invite.invited_by.notifications.create(notification_type: Notification.types[:invitee_accepted],
data: {display_username: invited_user.username}.to_json)
end
end
end