Skip to content
Snippets Groups Projects

Notification routes promoted to production

Merged Cool Fire requested to merge development into master
3 files
+ 53
6
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 30
6
@@ -27,27 +27,51 @@ class Manager2Api < Sinatra::Base
post '/v1/notify/irc' do
check_key_admin(params)
check_params(params, %w[username message])
# TODO: Implement sending notifies to IRC
notify_irc(params['message'], [params['username']])
erb :result, locals: { message: 'Message sent' }
end
# Send notification via email
post '/v1/notify/email' do
check_key_admin(params)
check_params(params, %w[username subject body])
# TODO: Implement sending notifies by email
notify_mail_user(
params['username'],
params['subject'],
params['body']
)
erb :result, locals: { message: 'Email sent' }
end
# Send email with request approved mail template
post '/v1/notify/email/approved' do
check_key_admin(params)
check_param(username)
# TODO: Implement sending notifies by email
check_params(params, %w[username details])
notify_mail_user(
params['username'],
'Your request has been approved',
(erb :'email/request_approved', locals: {
username: params['username'],
details: params['details']
})
)
erb :result, locals: { message: 'Email sent' }
end
# Send email with request rejected mail template
post '/v1/notify/email/rejected' do
check_key_admin(params)
check_param(username)
# TODO: Implement sending notifies by email
check_params(params, %w[username details comments])
notify_mail_user(
params['username'],
'Your request has been rejected',
(erb :'email/request_rejected', locals: {
username: params['username'],
details: params['details'],
comments: params['comments']
})
)
erb :result, locals: { message: 'Email sent' }
end
end
Loading