Documentation ¶
Index ¶
- func ActivityReadable(user, doer *user_model.User) bool
- func CountActionCreatedUnixString(ctx context.Context) (int64, error)
- func CountNotifications(ctx context.Context, opts *FindNotificationOptions) (int64, error)
- func CountUnread(ctx context.Context, userID int64) int64
- func CreateOrUpdateIssueNotifications(issueID, commentID, notificationAuthorID, receiverID int64) error
- func CreateRepoTransferNotification(ctx context.Context, doer, newOwner *user_model.User, ...) error
- func DeleteIssueActions(ctx context.Context, repoID, issueID int64) error
- func DeleteOldActions(olderThan time.Duration) (err error)
- func FixActionCreatedUnixString(ctx context.Context) (int64, error)
- func GetNotificationCount(ctx context.Context, user *user_model.User, status NotificationStatus) (count int64, err error)
- func NotifyWatchers(ctx context.Context, actions ...*Action) error
- func NotifyWatchersActions(acts []*Action) error
- func SetIssueReadBy(ctx context.Context, issueID, userID int64) error
- func SetRepoReadBy(ctx context.Context, userID, repoID int64) error
- func UpdateNotificationStatuses(ctx context.Context, user *user_model.User, ...) error
- type Action
- func (a *Action) GetActFullName() string
- func (a *Action) GetActUserName() string
- func (a *Action) GetBranch() string
- func (a *Action) GetCommentLink() string
- func (a *Action) GetContent() string
- func (a *Action) GetCreate() time.Time
- func (a *Action) GetDisplayName() string
- func (a *Action) GetDisplayNameTitle() string
- func (a *Action) GetIssueContent() string
- func (a *Action) GetIssueInfos() []string
- func (a *Action) GetIssueTitle() string
- func (a *Action) GetOpType() ActionType
- func (a *Action) GetRefLink() string
- func (a *Action) GetRepoAbsoluteLink() string
- func (a *Action) GetRepoLink() string
- func (a *Action) GetRepoName() string
- func (a *Action) GetRepoPath() string
- func (a *Action) GetRepoUserName() string
- func (a *Action) GetTag() string
- func (a *Action) LoadActUser(ctx context.Context)
- func (a *Action) ShortActUserName() string
- func (a *Action) ShortRepoName() string
- func (a *Action) ShortRepoPath() string
- func (a *Action) ShortRepoUserName() string
- func (a *Action) TableIndices() []*schemas.Index
- type ActionList
- type ActionType
- type ActivityAuthorData
- type ActivityStats
- func (stats *ActivityStats) ActiveIssueCount() int
- func (stats *ActivityStats) ActivePRCount() int
- func (stats *ActivityStats) ClosedIssueCount() int
- func (stats *ActivityStats) ClosedIssuePerc() int
- func (stats *ActivityStats) FillIssues(repoID int64, fromTime time.Time) error
- func (stats *ActivityStats) FillPullRequests(repoID int64, fromTime time.Time) error
- func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
- func (stats *ActivityStats) FillUnresolvedIssues(repoID int64, fromTime time.Time, issues, prs bool) error
- func (stats *ActivityStats) MergedPRCount() int
- func (stats *ActivityStats) MergedPRPerc() int
- func (stats *ActivityStats) OpenedIssueCount() int
- func (stats *ActivityStats) OpenedIssuePerc() int
- func (stats *ActivityStats) OpenedPRCount() int
- func (stats *ActivityStats) OpenedPRPerc() int
- func (stats *ActivityStats) PublishedReleaseCount() int
- func (stats *ActivityStats) UnresolvedIssueCount() int
- type FindNotificationOptions
- type GetFeedsOptions
- type IssueByLabelCount
- type IssueByRepositoryCount
- type Notification
- type NotificationList
- func (nl NotificationList) LoadAttributes(ctx context.Context) error
- func (nl NotificationList) LoadComments(ctx context.Context) ([]int, error)
- func (nl NotificationList) LoadIssues(ctx context.Context) ([]int, error)
- func (nl NotificationList) LoadRepos(ctx context.Context) (repo_model.RepositoryList, []int, error)
- func (nl NotificationList) Without(failures []int) NotificationList
- type NotificationSource
- type NotificationStatus
- type Statistic
- type UserHeatmapData
- type UserIDCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityReadable ¶
func ActivityReadable(user, doer *user_model.User) bool
ActivityReadable return whether doer can read activities of user
func CountActionCreatedUnixString ¶
CountActionCreatedUnixString count actions where created_unix is an empty string
func CountNotifications ¶
func CountNotifications(ctx context.Context, opts *FindNotificationOptions) (int64, error)
CountNotifications count all notifications that fit to the given options and ignore pagination.
func CountUnread ¶
CountUnread count unread notifications for a user
func CreateOrUpdateIssueNotifications ¶
func CreateOrUpdateIssueNotifications(issueID, commentID, notificationAuthorID, receiverID int64) error
CreateOrUpdateIssueNotifications creates an issue notification for each watcher, or updates it if already exists receiverID > 0 just send to receiver, else send to all watcher
func CreateRepoTransferNotification ¶
func CreateRepoTransferNotification(ctx context.Context, doer, newOwner *user_model.User, repo *repo_model.Repository) error
CreateRepoTransferNotification creates notification for the user a repository was transferred to
func DeleteIssueActions ¶
DeleteIssueActions delete all actions related with issueID
func DeleteOldActions ¶
DeleteOldActions deletes all old actions from database.
func FixActionCreatedUnixString ¶
FixActionCreatedUnixString set created_unix to zero if it is an empty string
func GetNotificationCount ¶
func GetNotificationCount(ctx context.Context, user *user_model.User, status NotificationStatus) (count int64, err error)
GetNotificationCount returns the notification count for user
func NotifyWatchers ¶
NotifyWatchers creates batch of actions for every watcher.
func NotifyWatchersActions ¶
NotifyWatchersActions creates batch of actions for every watcher.
func SetIssueReadBy ¶
SetIssueReadBy sets issue to be read by given user.
func SetRepoReadBy ¶
SetRepoReadBy sets repo to be visited by given user.
func UpdateNotificationStatuses ¶
func UpdateNotificationStatuses(ctx context.Context, user *user_model.User, currentStatus, desiredStatus NotificationStatus) error
UpdateNotificationStatuses updates the statuses of all of a user's notifications that are of the currentStatus type to the desiredStatus
Types ¶
type Action ¶
type Action struct { ID int64 `xorm:"pk autoincr"` UserID int64 // Receiver user id. OpType ActionType ActUserID int64 // Action user id. ActUser *user_model.User `xorm:"-"` RepoID int64 Repo *repo_model.Repository `xorm:"-"` CommentID int64 `xorm:"INDEX"` Comment *issues_model.Comment `xorm:"-"` IsDeleted bool `xorm:"NOT NULL DEFAULT false"` RefName string IsPrivate bool `xorm:"NOT NULL DEFAULT false"` Content string `xorm:"TEXT"` CreatedUnix timeutil.TimeStamp `xorm:"created"` }
Action represents user operation type and other information to repository. It implemented interface base.Actioner so that can be used in template render.
func (*Action) GetActFullName ¶
GetActFullName gets the action's user full name.
func (*Action) GetActUserName ¶
GetActUserName gets the action's user name.
func (*Action) GetCommentLink ¶
GetCommentLink returns link to action comment.
func (*Action) GetContent ¶
GetContent returns the action's content.
func (*Action) GetDisplayName ¶
GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME, or falls back to the username if it is blank.
func (*Action) GetDisplayNameTitle ¶
GetDisplayNameTitle gets the action's display name used for the title (tooltip) based on DEFAULT_SHOW_FULL_NAME
func (*Action) GetIssueContent ¶
GetIssueContent returns the content of first issue associated with this action.
func (*Action) GetIssueInfos ¶
GetIssueInfos returns a list of issues associated with the action.
func (*Action) GetIssueTitle ¶
GetIssueTitle returns the title of first issue associated with the action.
func (*Action) GetOpType ¶
func (a *Action) GetOpType() ActionType
GetOpType gets the ActionType of this action.
func (*Action) GetRefLink ¶
GetRefLink returns the action's ref link.
func (*Action) GetRepoAbsoluteLink ¶
GetRepoAbsoluteLink returns the absolute link to action repository.
func (*Action) GetRepoLink ¶
GetRepoLink returns relative link to action repository.
func (*Action) GetRepoName ¶
GetRepoName returns the name of the action repository.
func (*Action) GetRepoPath ¶
GetRepoPath returns the virtual path to the action repository.
func (*Action) GetRepoUserName ¶
GetRepoUserName returns the name of the action repository owner.
func (*Action) LoadActUser ¶
LoadActUser loads a.ActUser
func (*Action) ShortActUserName ¶
ShortActUserName gets the action's user name trimmed to max 20 chars.
func (*Action) ShortRepoName ¶
ShortRepoName returns the name of the action repository trimmed to max 33 chars.
func (*Action) ShortRepoPath ¶
ShortRepoPath returns the virtual path to the action repository trimmed to max 20 + 1 + 33 chars.
func (*Action) ShortRepoUserName ¶
ShortRepoUserName returns the name of the action repository owner trimmed to max 20 chars.
func (*Action) TableIndices ¶
TableIndices implements xorm's TableIndices interface
type ActionList ¶
type ActionList []*Action
ActionList defines a list of actions
func GetFeeds ¶
func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, error)
GetFeeds returns actions according to the provided options
type ActionType ¶
type ActionType int
ActionType represents the type of an action.
const ( ActionCreateRepo ActionType = iota + 1 // 1 ActionRenameRepo // 2 ActionStarRepo // 3 ActionWatchRepo // 4 ActionCommitRepo // 5 ActionCreateIssue // 6 ActionCreatePullRequest // 7 ActionTransferRepo // 8 ActionPushTag // 9 ActionCommentIssue // 10 ActionMergePullRequest // 11 ActionCloseIssue // 12 ActionReopenIssue // 13 ActionClosePullRequest // 14 ActionReopenPullRequest // 15 ActionDeleteTag // 16 ActionDeleteBranch // 17 ActionMirrorSyncPush // 18 ActionMirrorSyncCreate // 19 ActionMirrorSyncDelete // 20 ActionApprovePullRequest // 21 ActionRejectPullRequest // 22 ActionCommentPull // 23 ActionPublishRelease // 24 ActionPullReviewDismissed // 25 ActionPullRequestReadyForReview // 26 ActionAutoMergePullRequest // 27 )
Possible action types.
type ActivityAuthorData ¶
type ActivityAuthorData struct { Name string `json:"name"` Login string `json:"login"` AvatarLink string `json:"avatar_link"` HomeLink string `json:"home_link"` Commits int64 `json:"commits"` }
ActivityAuthorData represents statistical git commit count data
func GetActivityStatsTopAuthors ¶
func GetActivityStatsTopAuthors(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, count int) ([]*ActivityAuthorData, error)
GetActivityStatsTopAuthors returns top author stats for git commits for all branches
type ActivityStats ¶
type ActivityStats struct { OpenedPRs issues_model.PullRequestList OpenedPRAuthorCount int64 MergedPRs issues_model.PullRequestList MergedPRAuthorCount int64 OpenedIssues issues_model.IssueList OpenedIssueAuthorCount int64 ClosedIssues issues_model.IssueList ClosedIssueAuthorCount int64 UnresolvedIssues issues_model.IssueList PublishedReleases []*repo_model.Release PublishedReleaseAuthorCount int64 Code *git.CodeActivityStats }
ActivityStats represents issue and pull request information.
func GetActivityStats ¶
func GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, releases, issues, prs, code bool) (*ActivityStats, error)
GetActivityStats return stats for repository at given time range
func (*ActivityStats) ActiveIssueCount ¶
func (stats *ActivityStats) ActiveIssueCount() int
ActiveIssueCount returns total active issue count
func (*ActivityStats) ActivePRCount ¶
func (stats *ActivityStats) ActivePRCount() int
ActivePRCount returns total active pull request count
func (*ActivityStats) ClosedIssueCount ¶
func (stats *ActivityStats) ClosedIssueCount() int
ClosedIssueCount returns closed issue count
func (*ActivityStats) ClosedIssuePerc ¶
func (stats *ActivityStats) ClosedIssuePerc() int
ClosedIssuePerc returns closed issue count percent from total active
func (*ActivityStats) FillIssues ¶
func (stats *ActivityStats) FillIssues(repoID int64, fromTime time.Time) error
FillIssues returns issue information for activity page
func (*ActivityStats) FillPullRequests ¶
func (stats *ActivityStats) FillPullRequests(repoID int64, fromTime time.Time) error
FillPullRequests returns pull request information for activity page
func (*ActivityStats) FillReleases ¶
func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
FillReleases returns release information for activity page
func (*ActivityStats) FillUnresolvedIssues ¶
func (stats *ActivityStats) FillUnresolvedIssues(repoID int64, fromTime time.Time, issues, prs bool) error
FillUnresolvedIssues returns unresolved issue and pull request information for activity page
func (*ActivityStats) MergedPRCount ¶
func (stats *ActivityStats) MergedPRCount() int
MergedPRCount returns merged pull request count
func (*ActivityStats) MergedPRPerc ¶
func (stats *ActivityStats) MergedPRPerc() int
MergedPRPerc returns merged pull request percent from total active
func (*ActivityStats) OpenedIssueCount ¶
func (stats *ActivityStats) OpenedIssueCount() int
OpenedIssueCount returns open issue count
func (*ActivityStats) OpenedIssuePerc ¶
func (stats *ActivityStats) OpenedIssuePerc() int
OpenedIssuePerc returns open issue count percent from total active
func (*ActivityStats) OpenedPRCount ¶
func (stats *ActivityStats) OpenedPRCount() int
OpenedPRCount returns opened pull request count
func (*ActivityStats) OpenedPRPerc ¶
func (stats *ActivityStats) OpenedPRPerc() int
OpenedPRPerc returns opened pull request percents from total active
func (*ActivityStats) PublishedReleaseCount ¶
func (stats *ActivityStats) PublishedReleaseCount() int
PublishedReleaseCount returns published release count
func (*ActivityStats) UnresolvedIssueCount ¶
func (stats *ActivityStats) UnresolvedIssueCount() int
UnresolvedIssueCount returns unresolved issue and pull request count
type FindNotificationOptions ¶
type FindNotificationOptions struct { db.ListOptions UserID int64 RepoID int64 IssueID int64 Status []NotificationStatus Source []NotificationSource UpdatedAfterUnix int64 UpdatedBeforeUnix int64 }
FindNotificationOptions represent the filters for notifications. If an ID is 0 it will be ignored.
func (*FindNotificationOptions) ToCond ¶
func (opts *FindNotificationOptions) ToCond() builder.Cond
ToCond will convert each condition into a xorm-Cond
type GetFeedsOptions ¶
type GetFeedsOptions struct { db.ListOptions RequestedUser *user_model.User // the user we want activity for RequestedTeam *organization.Team // the team we want activity for RequestedRepo *repo_model.Repository // the repo we want activity for Actor *user_model.User // the user viewing the activity IncludePrivate bool // include private actions OnlyPerformedBy bool // only actions performed by requested user IncludeDeleted bool // include deleted actions Date string // the day we want activity for: YYYY-MM-DD }
GetFeedsOptions options for retrieving feeds
type IssueByLabelCount ¶
IssueByLabelCount contains the number of issue group by label
type IssueByRepositoryCount ¶
IssueByRepositoryCount contains the number of issue group by repository
type Notification ¶
type Notification struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"INDEX NOT NULL"` RepoID int64 `xorm:"INDEX NOT NULL"` Status NotificationStatus `xorm:"SMALLINT INDEX NOT NULL"` Source NotificationSource `xorm:"SMALLINT INDEX NOT NULL"` IssueID int64 `xorm:"INDEX NOT NULL"` CommitID string `xorm:"INDEX"` CommentID int64 UpdatedBy int64 `xorm:"INDEX NOT NULL"` Issue *issues_model.Issue `xorm:"-"` Repository *repo_model.Repository `xorm:"-"` Comment *issues_model.Comment `xorm:"-"` User *user_model.User `xorm:"-"` CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"` UpdatedUnix timeutil.TimeStamp `xorm:"updated INDEX NOT NULL"` }
Notification represents a notification
func GetNotificationByID ¶
func GetNotificationByID(ctx context.Context, notificationID int64) (*Notification, error)
GetNotificationByID return notification by ID
func SetNotificationStatus ¶
func SetNotificationStatus(ctx context.Context, notificationID int64, user *user_model.User, status NotificationStatus) (*Notification, error)
SetNotificationStatus change the notification status
func (*Notification) APIURL ¶
func (n *Notification) APIURL() string
APIURL formats a URL-string to the notification
func (*Notification) GetIssue ¶
func (n *Notification) GetIssue() (*issues_model.Issue, error)
GetIssue returns the issue of the notification
func (*Notification) GetRepo ¶
func (n *Notification) GetRepo() (*repo_model.Repository, error)
GetRepo returns the repo of the notification
func (*Notification) HTMLURL ¶
func (n *Notification) HTMLURL() string
HTMLURL formats a URL-string to the notification
func (*Notification) LoadAttributes ¶
func (n *Notification) LoadAttributes(ctx context.Context) (err error)
LoadAttributes load Repo Issue User and Comment if not loaded
type NotificationList ¶
type NotificationList []*Notification
NotificationList contains a list of notifications
func GetNotifications ¶
func GetNotifications(ctx context.Context, options *FindNotificationOptions) (nl NotificationList, err error)
GetNotifications returns all notifications that fit to the given options.
func NotificationsForUser ¶
func NotificationsForUser(ctx context.Context, user *user_model.User, statuses []NotificationStatus, page, perPage int) (notifications NotificationList, err error)
NotificationsForUser returns notifications for a given user and status
func (NotificationList) LoadAttributes ¶
func (nl NotificationList) LoadAttributes(ctx context.Context) error
LoadAttributes load Repo Issue User and Comment if not loaded
func (NotificationList) LoadComments ¶
func (nl NotificationList) LoadComments(ctx context.Context) ([]int, error)
LoadComments loads comments from database
func (NotificationList) LoadIssues ¶
func (nl NotificationList) LoadIssues(ctx context.Context) ([]int, error)
LoadIssues loads issues from database
func (NotificationList) LoadRepos ¶
func (nl NotificationList) LoadRepos(ctx context.Context) (repo_model.RepositoryList, []int, error)
LoadRepos loads repositories from database
func (NotificationList) Without ¶
func (nl NotificationList) Without(failures []int) NotificationList
Without returns the notification list without the failures
type NotificationSource ¶
type NotificationSource uint8
NotificationSource is the source of the notification (issue, PR, commit, etc)
const ( // NotificationSourceIssue is a notification of an issue NotificationSourceIssue NotificationSource = iota + 1 // NotificationSourcePullRequest is a notification of a pull request NotificationSourcePullRequest // NotificationSourceCommit is a notification of a commit NotificationSourceCommit // NotificationSourceRepository is a notification for a repository NotificationSourceRepository )
type NotificationStatus ¶
type NotificationStatus uint8
NotificationStatus is the status of the notification (read or unread)
const ( // NotificationStatusUnread represents an unread notification NotificationStatusUnread NotificationStatus = iota + 1 // NotificationStatusRead represents a read notification NotificationStatusRead // NotificationStatusPinned represents a pinned notification NotificationStatusPinned )
type Statistic ¶
type Statistic struct { Counter struct { User, Org, PublicKey, Repo, Watch, Star, Action, Access, Issue, IssueClosed, IssueOpen, Comment, Oauth, Follow, Mirror, Release, AuthSource, Webhook, Milestone, Label, HookTask, Team, UpdateTask, Project, ProjectBoard, Attachment int64 IssueByLabel []IssueByLabelCount IssueByRepository []IssueByRepositoryCount } }
Statistic contains the database statistics
func GetStatistic ¶
func GetStatistic() (stats Statistic)
GetStatistic returns the database statistics
type UserHeatmapData ¶
type UserHeatmapData struct { Timestamp timeutil.TimeStamp `json:"timestamp"` Contributions int64 `json:"contributions"` }
UserHeatmapData represents the data needed to create a heatmap
func GetUserHeatmapDataByUser ¶
func GetUserHeatmapDataByUser(user, doer *user_model.User) ([]*UserHeatmapData, error)
GetUserHeatmapDataByUser returns an array of UserHeatmapData
func GetUserHeatmapDataByUserTeam ¶
func GetUserHeatmapDataByUserTeam(user *user_model.User, team *organization.Team, doer *user_model.User) ([]*UserHeatmapData, error)
GetUserHeatmapDataByUserTeam returns an array of UserHeatmapData
type UserIDCount ¶
UserIDCount is a simple coalition of UserID and Count
func GetUIDsAndNotificationCounts ¶
func GetUIDsAndNotificationCounts(since, until timeutil.TimeStamp) ([]UserIDCount, error)
GetUIDsAndNotificationCounts between the two provided times