Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Messaging
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
mashplace
backend
Messaging
Commits
0836590f
Commit
0836590f
authored
1 year ago
by
rromanov
Browse files
Options
Downloads
Patches
Plain Diff
fix linter
parent
094b4f6d
Branches
release/v0.38
Tags
b0.38.2
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
internal/chat/process_notification.go
+5
-0
5 additions, 0 deletions
internal/chat/process_notification.go
with
5 additions
and
0 deletions
internal/chat/process_notification.go
+
5
−
0
View file @
0836590f
...
...
@@ -10,6 +10,7 @@ import (
"github.com/jasonlvhit/gocron"
)
// NotificationPeriod is a period of time after which a user is considered unresponding.
func
(
root
*
root
)
processNotifications
(
ctx
context
.
Context
)
{
for
ctx
.
Err
()
==
nil
{
root
.
DeliverNotifications
(
ctx
)
...
...
@@ -18,6 +19,7 @@ func (root *root) processNotifications(ctx context.Context) {
}
}
// DeliverNotifications delivers notifications.
func
(
root
*
root
)
DeliverNotifications
(
ctx
context
.
Context
)
(
errs
[]
error
)
{
resp
,
err
:=
root
.
Repository
.
UserListUnresponding
(
ctx
,
root
.
NotificationPeriod
)
if
err
!=
nil
{
...
...
@@ -48,6 +50,7 @@ func (root *root) DeliverNotifications(ctx context.Context) (errs []error) {
return
}
// CreateSendNotificationRequestForUserAboutNewUnreadMessages creates a notification request for a user about new unread messages.
func
CreateSendNotificationRequestForUserAboutNewUnreadMessages
(
userID
string
)
*
notification
.
SendNotificationRequest
{
return
&
notification
.
SendNotificationRequest
{
Entity
:
notification
.
Entity_ENTITY_MESSAGE
,
...
...
@@ -61,6 +64,7 @@ func CreateSendNotificationRequestForUserAboutNewUnreadMessages(userID string) *
}
}
// processNotificationsByCron sends notifications by cron.
func
(
root
*
root
)
processNotificationsByCron
(
ctx
context
.
Context
)
{
err
:=
gocron
.
Every
(
1
)
.
Day
()
.
At
(
"09:00"
)
.
Do
(
root
.
EveryDayNotificationsAboutNewMessages
,
ctx
)
if
err
!=
nil
{
...
...
@@ -71,6 +75,7 @@ func (root *root) processNotificationsByCron(ctx context.Context) {
<-
gocron
.
Start
()
}
// EveryDayNotificationsAboutNewMessages sends notifications about new messages.
func
(
root
*
root
)
EveryDayNotificationsAboutNewMessages
(
ctx
context
.
Context
)
(
errs
[]
error
)
{
resp
,
err
:=
root
.
Repository
.
UserListUnResponding
(
ctx
,
root
.
NotificationPeriod
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment