summaryrefslogtreecommitdiffstats
path: root/modules/convert/notification.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/convert/notification.go')
-rw-r--r--modules/convert/notification.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/convert/notification.go b/modules/convert/notification.go
index 1efba5745c..55f782f8f6 100644
--- a/modules/convert/notification.go
+++ b/modules/convert/notification.go
@@ -7,17 +7,17 @@ package convert
import (
"net/url"
- "code.gitea.io/gitea/models"
+ activities_model "code.gitea.io/gitea/models/activities"
"code.gitea.io/gitea/models/perm"
api "code.gitea.io/gitea/modules/structs"
)
// ToNotificationThread convert a Notification to api.NotificationThread
-func ToNotificationThread(n *models.Notification) *api.NotificationThread {
+func ToNotificationThread(n *activities_model.Notification) *api.NotificationThread {
result := &api.NotificationThread{
ID: n.ID,
- Unread: !(n.Status == models.NotificationStatusRead || n.Status == models.NotificationStatusPinned),
- Pinned: n.Status == models.NotificationStatusPinned,
+ Unread: !(n.Status == activities_model.NotificationStatusRead || n.Status == activities_model.NotificationStatusPinned),
+ Pinned: n.Status == activities_model.NotificationStatusPinned,
UpdatedAt: n.UpdatedUnix.AsTime(),
URL: n.APIURL(),
}
@@ -34,7 +34,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread {
// handle Subject
switch n.Source {
- case models.NotificationSourceIssue:
+ case activities_model.NotificationSourceIssue:
result.Subject = &api.NotificationSubject{Type: api.NotifySubjectIssue}
if n.Issue != nil {
result.Subject.Title = n.Issue.Title
@@ -47,7 +47,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread {
result.Subject.LatestCommentHTMLURL = comment.HTMLURL()
}
}
- case models.NotificationSourcePullRequest:
+ case activities_model.NotificationSourcePullRequest:
result.Subject = &api.NotificationSubject{Type: api.NotifySubjectPull}
if n.Issue != nil {
result.Subject.Title = n.Issue.Title
@@ -65,7 +65,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread {
result.Subject.State = "merged"
}
}
- case models.NotificationSourceCommit:
+ case activities_model.NotificationSourceCommit:
url := n.Repository.HTMLURL() + "/commit/" + url.PathEscape(n.CommitID)
result.Subject = &api.NotificationSubject{
Type: api.NotifySubjectCommit,
@@ -73,7 +73,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread {
URL: url,
HTMLURL: url,
}
- case models.NotificationSourceRepository:
+ case activities_model.NotificationSourceRepository:
result.Subject = &api.NotificationSubject{
Type: api.NotifySubjectRepository,
Title: n.Repository.FullName(),
@@ -87,7 +87,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread {
}
// ToNotifications convert list of Notification to api.NotificationThread list
-func ToNotifications(nl models.NotificationList) []*api.NotificationThread {
+func ToNotifications(nl activities_model.NotificationList) []*api.NotificationThread {
result := make([]*api.NotificationThread, 0, len(nl))
for _, n := range nl {
result = append(result, ToNotificationThread(n))