Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
manager2-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shells
manager2-api
Merge requests
!5
Notification routes promoted to production
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Notification routes promoted to production
development
into
master
Overview
0
Commits
2
Pipelines
1
Changes
3
Merged
Cool Fire
requested to merge
development
into
master
6 years ago
Overview
0
Commits
2
Pipelines
1
Changes
3
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
9415fbaf
2 commits,
6 years ago
3 files
+
53
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
routes/v1/requestadmin.rb
+
30
−
6
Options
@@ -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