Skip to content

Commit c3810c6

Browse files
committed
Lint
1 parent 75c2752 commit c3810c6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

models/notification.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,29 @@ import (
55
)
66

77
type (
8+
// NotificationStatus is the status of the notification (read or unread)
89
NotificationStatus uint8
10+
// NotificationSource is the source of the notification (issue, PR, commit, etc)
911
NotificationSource uint8
1012
)
1113

1214
const (
15+
// NotificationStatusUnread represents an unread notification
1316
NotificationStatusUnread NotificationStatus = iota + 1
17+
// NotificationStatusRead represents a read notification
1418
NotificationStatusRead
1519
)
1620

1721
const (
22+
// NotificationSourceIssue is a notification of an issue
1823
NotificationSourceIssue NotificationSource = iota + 1
24+
// NotificationSourcePullRequest is a notification of a pull request
1925
NotificationSourcePullRequest
26+
// NotificationSourceCommit is a notification of a commit
2027
NotificationSourceCommit
2128
)
2229

30+
// Notification represents a notification
2331
type Notification struct {
2432
ID int64 `xorm:"pk autoincr"`
2533
UserID int64 `xorm:"INDEX NOT NULL"`
@@ -41,6 +49,7 @@ type Notification struct {
4149
UpdatedUnix int64 `xorm:"INDEX NOT NULL"`
4250
}
4351

52+
// BeforeInsert runs while inserting a record
4453
func (n *Notification) BeforeInsert() {
4554
var (
4655
now = time.Now()
@@ -51,6 +60,8 @@ func (n *Notification) BeforeInsert() {
5160
n.Updated = now
5261
n.UpdatedUnix = nowUnix
5362
}
63+
64+
// BeforeUpdate runs while updateing a record
5465
func (n *Notification) BeforeUpdate() {
5566
var (
5667
now = time.Now()
@@ -60,6 +71,8 @@ func (n *Notification) BeforeUpdate() {
6071
n.UpdatedUnix = nowUnix
6172
}
6273

74+
// CreateOrUpdateIssueNotifications creates an issue notification
75+
// for each watcher, or updates it if already exists
6376
func CreateOrUpdateIssueNotifications(issue *Issue) error {
6477
watches, err := getWatchers(x, issue.RepoID)
6578
if err != nil {
@@ -70,7 +83,6 @@ func CreateOrUpdateIssueNotifications(issue *Issue) error {
7083
if err := sess.Begin(); err != nil {
7184
return err
7285
}
73-
7486
defer sess.Close()
7587

7688
for _, watch := range watches {

0 commit comments

Comments
 (0)