Documentation ¶
Index ¶
- Constants
- Variables
- func AddEmailAddress(email *EmailAddress) error
- func AddEmailAddresses(emails []*EmailAddress) error
- func AddOrgUser(orgID, uid int64) error
- func AddTeamMember(orgID, teamID, uid int64) error
- func AddTeamRepo(orgID, teamID, repoID int64) error
- func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool)
- func AddUpdateTask(task *UpdateTask) error
- func AttachmentLocalPath(uuid string) string
- func Cell2Int64(val xorm.Cell) int64
- func ChangeMilestoneAssign(issue *Issue, oldMilestoneID int64) (err error)
- func ChangeMilestoneIssueStats(issue *Issue) (err error)
- func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error)
- func ChangeOrgUserStatus(orgID, uid int64, public bool) error
- func ChangeRepositoryName(u *User, oldRepoName, newRepoName string) (err error)
- func ChangeUserName(u *User, newUserName string) (err error)
- func ChangeUsernameInPullRequests(oldUserName, newUserName string) error
- func CheckPublicKeyString(content string) (_ string, err error)
- func CheckRepoStats()
- func CommitRepoAction(opts CommitRepoActionOptions) error
- func ComposeHTTPSCloneURL(owner, repo string) string
- func CountLoginSources() int64
- func CountNotices() int64
- func CountOrganizations() int64
- func CountRepoClosedMilestones(repoID int64) int64
- func CountRepoMilestones(repoID int64) int64
- func CountRepositories(private bool) int64
- func CountUserRepositories(userID int64, private bool) int64
- func CountUsers() int64
- func CreateHookTask(t *HookTask) error
- func CreateLoginSource(source *LoginSource) error
- func CreateNotice(tp NoticeType, desc string) error
- func CreateOrganization(org, owner *User) (err error)
- func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error
- func CreateRelease(gitRepo *git.Repository, rel *Release) error
- func CreateRepositoryNotice(desc string) error
- func CreateUser(u *User) (err error)
- func CreateWebhook(w *Webhook) error
- func DeleteAccessTokenByID(id int64) error
- func DeleteAttachment(a *Attachment, remove bool) error
- func DeleteAttachments(attachments []*Attachment, remove bool) (int, error)
- func DeleteAttachmentsByComment(commentId int64, remove bool) (int, error)
- func DeleteAttachmentsByIssue(issueId int64, remove bool) (int, error)
- func DeleteCommentByID(id int64) error
- func DeleteDeployKey(doer *User, id int64) error
- func DeleteEmailAddress(email *EmailAddress) (err error)
- func DeleteEmailAddresses(emails []*EmailAddress) (err error)
- func DeleteInactivateUsers() (err error)
- func DeleteIssueLabel(issue *Issue, label *Label) (err error)
- func DeleteLabel(repoID, labelID int64) error
- func DeleteMilestoneByRepoID(repoID, id int64) error
- func DeleteMirrorByRepoID(repoID int64) error
- func DeleteMissingRepositories() error
- func DeleteNotice(id int64) error
- func DeleteNotices(start, end int64) error
- func DeleteNoticesByIDs(ids []int64) error
- func DeleteOrganization(org *User) (err error)
- func DeletePublicKey(doer *User, id int64) (err error)
- func DeleteReleaseByID(id int64) error
- func DeleteRepository(uid, repoID int64) error
- func DeleteRepositoryArchives() error
- func DeleteSource(source *LoginSource) error
- func DeleteTeam(t *Team) error
- func DeleteUpdateTaskByUUID(uuid string) error
- func DeleteUpload(u *Upload) error
- func DeleteUploadByUUID(uuid string) error
- func DeleteUploads(uploads ...*Upload) (err error)
- func DeleteUser(u *User) (err error)
- func DeleteWebhookByOrgID(orgID, id int64) error
- func DeleteWebhookByRepoID(repoID, id int64) error
- func DeliverHooks()
- func DumpDatabase(filePath string) error
- func FollowUser(userID, followID int64) (err error)
- func GetLabelTemplateFile(name string) ([][2]string, error)
- func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Writer) error
- func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64)
- func GetRepositoryCount(u *User) (int64, error)
- func GetUserEmailsByNames(names []string) []string
- func GetUserIDsByNames(names []string) []int64
- func GetUserSalt() string
- func GitFsck()
- func GitGcRepos() error
- func HandleCloneUserCredentials(url string, mosaics bool) string
- func HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error)
- func HasDeployKey(keyID, repoID int64) bool
- func HasIssueLabel(issueID, labelID int64) bool
- func HasTeamRepo(orgID, teamID, repoID int64) bool
- func InitDeliverHooks()
- func InitMailRender(dir, appendDir string, funcMap []template.FuncMap)
- func InitSyncMirrors()
- func InitTestPullRequests()
- func IsEmailUsed(email string) (bool, error)
- func IsErrAccessTokenEmpty(err error) bool
- func IsErrAccessTokenNotExist(err error) bool
- func IsErrAttachmentNotExist(err error) bool
- func IsErrBranchNotExist(err error) bool
- func IsErrCommentNotExist(err error) bool
- func IsErrDeployKeyAlreadyExist(err error) bool
- func IsErrDeployKeyNameAlreadyUsed(err error) bool
- func IsErrDeployKeyNotExist(err error) bool
- func IsErrEmailAlreadyUsed(err error) bool
- func IsErrInvalidCloneAddr(err error) bool
- func IsErrInvalidTagName(err error) bool
- func IsErrIssueNotExist(err error) bool
- func IsErrKeyAccessDenied(err error) bool
- func IsErrKeyAlreadyExist(err error) bool
- func IsErrKeyNameAlreadyUsed(err error) bool
- func IsErrKeyNotExist(err error) bool
- func IsErrKeyUnableVerify(err error) bool
- func IsErrLabelNotExist(err error) bool
- func IsErrLastOrgOwner(err error) bool
- func IsErrLoginSourceAlreadyExist(err error) bool
- func IsErrLoginSourceInUse(err error) bool
- func IsErrLoginSourceNotExist(err error) bool
- func IsErrMilestoneNotExist(err error) bool
- func IsErrNamePatternNotAllowed(err error) bool
- func IsErrNameReserved(err error) bool
- func IsErrPullRequestNotExist(err error) bool
- func IsErrReachLimitOfRepo(err error) bool
- func IsErrReleaseAlreadyExist(err error) bool
- func IsErrReleaseNotExist(err error) bool
- func IsErrRepoAlreadyExist(err error) bool
- func IsErrRepoFileAlreadyExist(err error) bool
- func IsErrRepoNotExist(err error) bool
- func IsErrTeamAlreadyExist(err error) bool
- func IsErrUpdateTaskNotExist(err error) bool
- func IsErrUploadNotExist(err error) bool
- func IsErrUserAlreadyExist(err error) bool
- func IsErrUserHasOrgs(err error) bool
- func IsErrUserNotExist(err error) bool
- func IsErrUserOwnRepos(err error) bool
- func IsErrWebhookNotExist(err error) bool
- func IsErrWikiAlreadyExist(err error) bool
- func IsFollowing(userID, followID int64) bool
- func IsOrganizationMember(orgId, uid int64) bool
- func IsOrganizationOwner(orgId, uid int64) bool
- func IsPublicMembership(orgId, uid int64) bool
- func IsReleaseExist(repoID int64, tagName string) (bool, error)
- func IsRepositoryExist(u *User, repoName string) (bool, error)
- func IsStaring(userID, repoID int64) bool
- func IsTeamMember(orgID, teamID, uid int64) bool
- func IsUsableRepoName(name string) error
- func IsUsableUsername(name string) error
- func IsUserExist(uid int64, name string) (bool, error)
- func IsValidHookContentType(name string) bool
- func IsValidHookTaskType(name string) bool
- func IsWatching(userID, repoID int64) bool
- func LoadConfigs()
- func LoadRepoConfig()
- func MakeEmailPrimary(email *EmailAddress) error
- func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error
- func MilestoneStats(repoID int64) (open int64, closed int64)
- func MirrorUpdate()
- func NewAccessToken(t *AccessToken) error
- func NewEngine() (err error)
- func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) (err error)
- func NewIssueLabel(issue *Issue, label *Label) (err error)
- func NewIssueLabels(issue *Issue, labels []*Label) (err error)
- func NewIssueUsers(repo *Repository, issue *Issue) (err error)
- func NewLabels(labels ...*Label) error
- func NewMilestone(m *Milestone) (err error)
- func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, ...) (err error)
- func NewRepoAction(u *User, repo *Repository) (err error)
- func NewRepoContext()
- func NewTeam(t *Team) error
- func NewTestEngine(x *xorm.Engine) (err error)
- func NotifyWatchers(act *Action) error
- func PairsContains(ius []*IssueUser, issueId, uid int64) int
- func Ping() error
- func PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error
- func PushUpdate(opts PushUpdateOptions) (err error)
- func ReinitMissingRepositories() error
- func RemoveAllWithNotice(title, path string)
- func RemoveOrgRepo(orgID, repoID int64) error
- func RemoveOrgUser(orgID, userID int64) error
- func RemoveTeamMember(orgID, teamID, uid int64) error
- func RemoveTeamRepo(teamID, repoID int64) error
- func RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error
- func RepoPath(userName, repoName string) string
- func RewriteAllPublicKeys() error
- func RewriteRepositoryUpdateHook() error
- func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error
- func SSHKeyGenParsePublicKey(key string) (string, int, error)
- func SSHNativeParsePublicKey(keyLine string) (string, int, error)
- func SendActivateAccountMail(c *macaron.Context, u *User)
- func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress)
- func SendCollaboratorMail(u, doer *User, repo *Repository)
- func SendIssueCommentMail(issue *Issue, doer *User, tos []string)
- func SendIssueMentionMail(issue *Issue, doer *User, tos []string)
- func SendRegisterNotifyMail(c *macaron.Context, u *User)
- func SendResetPasswordMail(c *macaron.Context, u *User)
- func SendTestMail(email string) error
- func SendUserMail(c *macaron.Context, u *User, tpl base.TplName, code, subject, info string)
- func SetEngine() (err error)
- func SlackLinkFormatter(url string, text string) string
- func SlackShortTextFormatter(s string) string
- func SlackTextFormatter(s string) string
- func SortReleases(rels []*Release)
- func StarRepo(userID, repoID int64, star bool) (err error)
- func SyncMirrors()
- func TestPullRequests()
- func ToWikiPageName(urlString string) string
- func ToWikiPageURL(name string) string
- func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
- func TransferRepoAction(doer, oldOwner *User, repo *Repository) error
- func UnfollowUser(userID, followID int64) (err error)
- func UpdateAccessToken(t *AccessToken) error
- func UpdateComment(c *Comment) error
- func UpdateDeployKey(key *DeployKey) error
- func UpdateHookTask(t *HookTask) error
- func UpdateIssue(issue *Issue) error
- func UpdateIssueCols(issue *Issue, cols ...string) error
- func UpdateIssueMentions(issueID int64, mentions []string) error
- func UpdateIssueUserByAssignee(issue *Issue) (err error)
- func UpdateIssueUserByRead(uid, issueID int64) error
- func UpdateIssueUsersByMentions(issueID int64, uids []int64) error
- func UpdateIssueUsersByStatus(issueID int64, isClosed bool) error
- func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) error
- func UpdateLabel(l *Label) error
- func UpdateLocalCopyBranch(repoPath, localPath, branch string) error
- func UpdateMilestone(m *Milestone) error
- func UpdateMirror(m *Mirror) error
- func UpdatePublicKey(key *PublicKey) error
- func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error)
- func UpdateRepository(repo *Repository, visibilityChanged bool) (err error)
- func UpdateSource(source *LoginSource) error
- func UpdateTeam(t *Team, authChanged bool) (err error)
- func UpdateUser(u *User) error
- func UpdateWebhook(w *Webhook) error
- func UploadLocalPath(uuid string) string
- func UserPath(userName string) string
- func ValidateCommitsWithEmails(oldCommits *list.List) *list.List
- func WatchRepo(userID, repoID int64, watch bool) (err error)
- func WikiPath(userName, repoName string) string
- type Access
- type AccessMode
- type AccessToken
- type Action
- func (a *Action) AfterSet(colName string, _ xorm.Cell)
- func (a *Action) BeforeInsert()
- func (a *Action) GetActUserName() string
- func (a *Action) GetBranch() string
- func (a *Action) GetContent() string
- func (a *Action) GetCreate() time.Time
- func (a *Action) GetIssueContent() string
- func (a *Action) GetIssueInfos() []string
- func (a *Action) GetIssueTitle() string
- func (a *Action) GetOpType() int
- func (a *Action) GetRepoLink() string
- func (a *Action) GetRepoName() string
- func (a *Action) GetRepoPath() string
- func (a *Action) GetRepoUserName() string
- func (a *Action) ShortActUserName() string
- func (a *Action) ShortRepoName() string
- func (a *Action) ShortRepoPath() string
- func (a *Action) ShortRepoUserName() string
- type ActionType
- type Attachment
- type Branch
- type CloneLink
- type Collaboration
- type Collaborator
- type Comment
- func CreateComment(opts *CreateCommentOptions) (comment *Comment, err error)
- func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, ...) (*Comment, error)
- func GetCommentByID(id int64) (*Comment, error)
- func GetCommentsByIssueID(issueID int64) ([]*Comment, error)
- func GetCommentsByIssueIDSince(issueID, since int64) ([]*Comment, error)
- func (c *Comment) APIFormat() *api.Comment
- func (c *Comment) AfterDelete()
- func (c *Comment) AfterSet(colName string, _ xorm.Cell)
- func (c *Comment) BeforeInsert()
- func (c *Comment) BeforeUpdate()
- func (c *Comment) EventTag() string
- func (c *Comment) HashTag() string
- func (cmt *Comment) MailParticipants(opType ActionType, issue *Issue) (err error)
- type CommentTag
- type CommentType
- type CommitRepoActionOptions
- type CreateCommentOptions
- type CreateRepoOptions
- type DeleteRepoFileOptions
- type DeployKey
- type Diff
- type DiffFile
- type DiffFileType
- type DiffLine
- type DiffLineType
- type DiffSection
- type EmailAddress
- type Engine
- type ErrAccessTokenEmpty
- type ErrAccessTokenNotExist
- type ErrAttachmentNotExist
- type ErrBranchNotExist
- type ErrCommentNotExist
- type ErrDeployKeyAlreadyExist
- type ErrDeployKeyNameAlreadyUsed
- type ErrDeployKeyNotExist
- type ErrEmailAlreadyUsed
- type ErrInvalidCloneAddr
- type ErrInvalidTagName
- type ErrIssueNotExist
- type ErrKeyAccessDenied
- type ErrKeyAlreadyExist
- type ErrKeyNameAlreadyUsed
- type ErrKeyNotExist
- type ErrKeyUnableVerify
- type ErrLabelNotExist
- type ErrLastOrgOwner
- type ErrLoginSourceAlreadyExist
- type ErrLoginSourceInUse
- type ErrLoginSourceNotExist
- type ErrMilestoneNotExist
- type ErrNamePatternNotAllowed
- type ErrNameReserved
- type ErrPullRequestNotExist
- type ErrReachLimitOfRepo
- type ErrReleaseAlreadyExist
- type ErrReleaseNotExist
- type ErrRepoAlreadyExist
- type ErrRepoFileAlreadyExist
- type ErrRepoNotExist
- type ErrTeamAlreadyExist
- type ErrUpdateTaskNotExist
- type ErrUploadNotExist
- type ErrUserAlreadyExist
- type ErrUserHasOrgs
- type ErrUserNotExist
- type ErrUserOwnRepos
- type ErrWebhookNotExist
- type ErrWikiAlreadyExist
- type Follow
- type HookContentType
- type HookEvent
- type HookEventType
- type HookEvents
- type HookRequest
- type HookResponse
- type HookStatus
- type HookTask
- type HookTaskType
- type Issue
- func (issue *Issue) APIFormat() *api.Issue
- func (issue *Issue) AddLabel(doer *User, label *Label) error
- func (issue *Issue) AddLabels(doer *User, labels []*Label) error
- func (issue *Issue) AfterSet(colName string, _ xorm.Cell)
- func (issue *Issue) BeforeInsert()
- func (issue *Issue) BeforeUpdate()
- func (issue *Issue) ChangeAssignee(doer *User, assigneeID int64) (err error)
- func (issue *Issue) ChangeContent(doer *User, content string) (err error)
- func (issue *Issue) ChangeStatus(doer *User, repo *Repository, isClosed bool) (err error)
- func (issue *Issue) ChangeTitle(doer *User, title string) (err error)
- func (issue *Issue) ClearLabels(doer *User) (err error)
- func (i *Issue) GetAssignee() (err error)
- func (issue *Issue) HTMLURL() string
- func (i *Issue) HasLabel(labelID int64) bool
- func (i *Issue) HashTag() string
- func (i *Issue) IsPoster(uid int64) bool
- func (issue *Issue) LoadAttributes() error
- func (issue *Issue) MailParticipants() (err error)
- func (issue *Issue) MailSubject() string
- func (i *Issue) ReadBy(uid int64) error
- func (issue *Issue) RemoveLabel(doer *User, label *Label) error
- func (issue *Issue) ReplaceLabels(labels []*Label) (err error)
- func (i *Issue) State() api.StateType
- type IssueLabel
- type IssueStats
- type IssueStatsOptions
- type IssueUser
- type IssuesOptions
- type KeyType
- type LDAPConfig
- type Label
- type LoginSource
- func (s *LoginSource) AfterSet(colName string, _ xorm.Cell)
- func (s *LoginSource) BeforeInsert()
- func (source *LoginSource) BeforeSet(colName string, val xorm.Cell)
- func (s *LoginSource) BeforeUpdate()
- func (source *LoginSource) HasTLS() bool
- func (source *LoginSource) IsDLDAP() bool
- func (source *LoginSource) IsLDAP() bool
- func (source *LoginSource) IsPAM() bool
- func (source *LoginSource) IsSMTP() bool
- func (source *LoginSource) LDAP() *LDAPConfig
- func (source *LoginSource) PAM() *PAMConfig
- func (source *LoginSource) SMTP() *SMTPConfig
- func (source *LoginSource) SkipVerify() bool
- func (source *LoginSource) TypeName() string
- func (source *LoginSource) UseTLS() bool
- type LoginType
- type MailRender
- type MigrateRepoOptions
- type Milestone
- type Mirror
- type MirrorRepositoryList
- type NewIssueOptions
- type Notice
- type NoticeType
- type OrgUser
- type PAMConfig
- type PublicKey
- type PullRequest
- func GetPullRequestByID(id int64) (*PullRequest, error)
- func GetPullRequestByIssueID(issueID int64) (*PullRequest, error)
- func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error)
- func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error)
- func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error)
- func (pr *PullRequest) APIFormat() *api.PullRequest
- func (pr *PullRequest) AddToTaskQueue()
- func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell)
- func (pr *PullRequest) BeforeUpdate()
- func (pr *PullRequest) CanAutoMerge() bool
- func (pr *PullRequest) GetBaseRepo() (err error)
- func (pr *PullRequest) GetHeadRepo() error
- func (pr *PullRequest) IsChecking() bool
- func (pr *PullRequest) LoadAttributes() error
- func (pr *PullRequest) LoadIssue() (err error)
- func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error)
- func (pr *PullRequest) PushToBaseRepo() (err error)
- func (pr *PullRequest) Update() error
- func (pr *PullRequest) UpdateCols(cols ...string) error
- func (pr *PullRequest) UpdatePatch() (err error)
- type PullRequestList
- type PullRequestStatus
- type PullRequestType
- type PushCommit
- type PushCommits
- type PushUpdateOptions
- type RawDiffType
- type Release
- type ReleaseSorter
- type Repository
- func CleanUpMigrateInfo(repo *Repository) (*Repository, error)
- func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error)
- func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)
- func GetRecentUpdatedRepositories(page, pageSize int) (repos []*Repository, err error)
- func GetRepositoriesByForkID(forkID int64) ([]*Repository, error)
- func GetRepositoryByID(id int64) (*Repository, error)
- func GetRepositoryByName(ownerID int64, name string) (*Repository, error)
- func GetRepositoryByRef(ref string) (*Repository, error)
- func GetUserMirrorRepositories(userID int64) ([]*Repository, error)
- func GetUserRepositories(userID int64, private bool, page, pageSize int) ([]*Repository, error)
- func HasForkedRepo(ownerID, repoID int64) (*Repository, bool)
- func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error)
- func Repositories(page, pageSize int) (_ []*Repository, err error)
- func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error)
- func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int64, _ error)
- func (repo *Repository) APIFormat(permission *api.Permission) *api.Repository
- func (repo *Repository) AddCollaborator(u *User) error
- func (repo *Repository) AddWikiPage(doer *User, title, content, message string) error
- func (repo *Repository) AfterSet(colName string, _ xorm.Cell)
- func (repo *Repository) AllowsPulls() bool
- func (repo *Repository) BeforeInsert()
- func (repo *Repository) BeforeUpdate()
- func (repo *Repository) CanBeForked() bool
- func (repo *Repository) CanEnableEditor() bool
- func (repo *Repository) CanEnablePulls() bool
- func (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode) error
- func (repo *Repository) CheckoutNewBranch(oldBranch, newBranch string) error
- func (repo *Repository) CloneLink() (cl *CloneLink)
- func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string
- func (repo *Repository) ComposeMetas() map[string]string
- func (repo *Repository) CreateNewBranch(doer *User, oldBranchName, branchName string) (err error)
- func (repo *Repository) DeleteCollaboration(uid int64) (err error)
- func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (err error)
- func (repo *Repository) DeleteWiki()
- func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error)
- func (repo *Repository) DescriptionHtml() template.HTML
- func (repo *Repository) DiscardLocalRepoBranchChanges(branch string) error
- func (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error
- func (repo *Repository) FullName() string
- func (repo *Repository) GetAssigneeByID(userID int64) (*User, error)
- func (repo *Repository) GetAssignees() (_ []*User, err error)
- func (repo *Repository) GetBaseRepo() (err error)
- func (repo *Repository) GetBranch(br string) (*Branch, error)
- func (repo *Repository) GetBranches() ([]*Branch, error)
- func (repo *Repository) GetCollaborators() ([]*Collaborator, error)
- func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *Diff, err error)
- func (repo *Repository) GetForks() ([]*Repository, error)
- func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)
- func (repo *Repository) GetMirror() (err error)
- func (repo *Repository) GetOwner() error
- func (repo *Repository) GetStargazers(page int) ([]*User, error)
- func (repo *Repository) GetWatchers(page int) ([]*User, error)
- func (repo *Repository) GitConfigPath() string
- func (repo *Repository) HTMLURL() string
- func (repo *Repository) HasAccess(u *User) bool
- func (repo *Repository) HasWiki() bool
- func (repo *Repository) InitWiki() error
- func (repo *Repository) IsOwnedBy(userID int64) bool
- func (repo *Repository) IssueStats(uid int64, filterMode int, isPull bool) (int64, int64)
- func (repo *Repository) Link() string
- func (repo *Repository) LocalCopyPath() string
- func (repo *Repository) LocalWikiPath() string
- func (repo *Repository) MustOwner() *User
- func (repo *Repository) NextIssueIndex() int64
- func (repo *Repository) PatchPath(index int64) (string, error)
- func (r *Repository) RecalculateAccesses() error
- func (repo *Repository) RelLink() string
- func (repo *Repository) RepoPath() string
- func (repo *Repository) SavePatch(index int64, patch []byte) error
- func (repo *Repository) UpdateLocalCopyBranch(branch string) error
- func (repo *Repository) UpdateLocalWiki() error
- func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (err error)
- func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) (err error)
- func (repo *Repository) WikiCloneLink() (cl *CloneLink)
- func (repo *Repository) WikiPath() string
- type RepositoryList
- type SMTPConfig
- type SearchRepoOptions
- type SearchUserOptions
- type SlackAttachment
- type SlackMeta
- type SlackPayload
- type Star
- type Statistic
- type Team
- func (t *Team) AddMember(uid int64) error
- func (t *Team) AddRepository(repo *Repository) (err error)
- func (t *Team) GetMembers() (err error)
- func (t *Team) GetRepositories() error
- func (t *Team) HasRepository(repoID int64) bool
- func (t *Team) IsMember(uid int64) bool
- func (t *Team) IsOwnerTeam() bool
- func (t *Team) RemoveMember(uid int64) error
- func (t *Team) RemoveRepository(repoID int64) error
- type TeamRepo
- type TeamUser
- type UpdateRepoFileOptions
- type UpdateTask
- type Upload
- type UploadRepoFileOptions
- type User
- func ExternalUserLogin(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error)
- func GetAssigneeByID(repo *Repository, userID int64) (*User, error)
- func GetOrgByName(name string) (*User, error)
- func GetOrgsByUserID(userID int64, showAll bool) ([]*User, error)
- func GetOrgsByUserIDDesc(userID int64, desc string, showAll bool) ([]*User, error)
- func GetOwnedOrgsByUserID(userID int64) ([]*User, error)
- func GetOwnedOrgsByUserIDDesc(userID int64, desc string) ([]*User, error)
- func GetTeamMembers(teamID int64) ([]*User, error)
- func GetUserByEmail(email string) (*User, error)
- func GetUserByID(id int64) (*User, error)
- func GetUserByKeyID(keyID int64) (*User, error)
- func GetUserByName(name string) (*User, error)
- func LoginViaLDAP(user *User, login, passowrd string, source *LoginSource, autoRegister bool) (*User, error)
- func LoginViaPAM(user *User, login, password string, sourceID int64, cfg *PAMConfig, ...) (*User, error)
- func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPConfig, ...) (*User, error)
- func NewGhostUser() *User
- func Organizations(page, pageSize int) ([]*User, error)
- func SearchUserByName(opts *SearchUserOptions) (users []*User, _ int64, _ error)
- func UserSignIn(username, passowrd string) (*User, error)
- func Users(page, pageSize int) ([]*User, error)
- func ValidateCommitWithEmail(c *git.Commit) *User
- func VerifyUserActiveCode(code string) (user *User)
- func (u *User) APIFormat() *api.User
- func (org *User) AddMember(uid int64) error
- func (u *User) AfterSet(colName string, _ xorm.Cell)
- func (u *User) AvatarLink() string
- func (u *User) BeforeInsert()
- func (u *User) BeforeUpdate()
- func (u *User) CanCreateRepo() bool
- func (u *User) CanEditGitHook() bool
- func (u *User) CanImportLocal() bool
- func (u *User) CustomAvatarPath() string
- func (u *User) DashboardLink() string
- func (u *User) DeleteAvatar() error
- func (u *User) DisplayName() string
- func (u *User) EncodePasswd()
- func (u *User) GenerateActivateCode() string
- func (u *User) GenerateEmailActivateCode(email string) string
- func (u *User) GenerateRandomAvatar() error
- func (user *User) GetAccessibleRepositories(limit int) (repos []*Repository, _ error)
- func (u *User) GetFollowers(page int) ([]*User, error)
- func (u *User) GetFollowing(page int) ([]*User, error)
- func (org *User) GetMembers() error
- func (u *User) GetMirrorRepositories() ([]*Repository, error)
- func (u *User) GetOrganizationCount() (int64, error)
- func (u *User) GetOrganizations(all bool) error
- func (u *User) GetOwnedOrganizations() (err error)
- func (org *User) GetOwnerTeam() (*Team, error)
- func (u *User) GetRepositories(page, pageSize int) (err error)
- func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error)
- func (org *User) GetTeam(name string) (*Team, error)
- func (org *User) GetTeams() error
- func (org *User) GetUserMirrorRepositories(userID int64) ([]*Repository, error)
- func (org *User) GetUserRepositories(userID int64, page, pageSize int) ([]*Repository, int64, error)
- func (org *User) GetUserTeamIDs(userID int64) ([]int64, error)
- func (org *User) GetUserTeams(userID int64) ([]*Team, error)
- func (u *User) HasForkedRepo(repoID int64) bool
- func (u *User) HomeLink() string
- func (u *User) IsAdminOfRepo(repo *Repository) bool
- func (u *User) IsFollowing(followID int64) bool
- func (u *User) IsLocal() bool
- func (org *User) IsOrgMember(uid int64) bool
- func (u *User) IsOrganization() bool
- func (org *User) IsOwnedBy(uid int64) bool
- func (u *User) IsPublicMember(orgId int64) bool
- func (u *User) IsUserOrgOwner(orgId int64) bool
- func (u *User) IsWriterOfRepo(repo *Repository) bool
- func (u *User) NewGitSig() *git.Signature
- func (u *User) RelAvatarLink() string
- func (org *User) RemoveMember(uid int64) error
- func (org *User) RemoveOrgRepo(repoID int64) error
- func (u *User) RepoCreationNum() int
- func (u *User) ShortName(length int) string
- func (u *User) UploadAvatar(data []byte) error
- func (u *User) ValidatePassword(passwd string) bool
- type UserCommit
- type UserType
- type Watch
- type Webhook
- func GetActiveWebhooksByOrgID(orgID int64) (ws []*Webhook, err error)
- func GetActiveWebhooksByRepoID(repoID int64) ([]*Webhook, error)
- func GetWebhookByOrgID(orgID, id int64) (*Webhook, error)
- func GetWebhookByRepoID(repoID, id int64) (*Webhook, error)
- func GetWebhooksByOrgID(orgID int64) (ws []*Webhook, err error)
- func GetWebhooksByRepoID(repoID int64) ([]*Webhook, error)
- func (w *Webhook) AfterSet(colName string, _ xorm.Cell)
- func (w *Webhook) BeforeInsert()
- func (w *Webhook) BeforeUpdate()
- func (w *Webhook) EventsArray() []string
- func (w *Webhook) GetSlackHook() *SlackMeta
- func (w *Webhook) HasCreateEvent() bool
- func (w *Webhook) HasPullRequestEvent() bool
- func (w *Webhook) HasPushEvent() bool
- func (w *Webhook) History(page int) ([]*HookTask, error)
- func (w *Webhook) UpdateEvent() error
Constants ¶
const ( FM_ALL = iota FM_ASSIGN FM_CREATE FM_MENTION )
Filter modes.
const ( SMTP_PLAIN = "PLAIN" SMTP_LOGIN = "LOGIN" )
const ( MAIL_AUTH_ACTIVATE base.TplName = "auth/activate" MAIL_AUTH_ACTIVATE_EMAIL base.TplName = "auth/activate_email" MAIL_AUTH_RESET_PASSWORD base.TplName = "auth/reset_passwd" MAIL_AUTH_REGISTER_NOTIFY base.TplName = "auth/register_notify" MAIL_ISSUE_COMMENT base.TplName = "issue/comment" MAIL_ISSUE_MENTION base.TplName = "issue/mention" MAIL_NOTIFY_COLLABORATOR base.TplName = "notify/collaborator" )
const ( KEY_TYPE_USER = iota + 1 KEY_TYPE_DEPLOY )
const ( HOOK_STATUS_NONE = iota HOOK_STATUS_SUCCEED HOOK_STATUS_FAILED )
const DIFF_HEAD = "diff --git "
const OWNER_TEAM = "Owners"
Variables ¶
var ( // Same as Github. See https://help.github.com/articles/closing-issues-via-commit-messages IssueCloseKeywords = []string{"close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"} IssueReopenKeywords = []string{"reopen", "reopens", "reopened"} IssueCloseKeywordsPat, IssueReopenKeywordsPat *regexp.Regexp IssueReferenceKeywordsPat *regexp.Regexp )
var ( HasEngine bool DbCfg struct { Type, Host, Name, User, Passwd, Path, SSLMode string } EnableSQLite3 bool EnableTiDB bool )
var ( ErrOrgNotExist = errors.New("Organization does not exist") ErrTeamNotExist = errors.New("Team does not exist") )
var ( ErrRepoFileNotExist = errors.New("Repository file does not exist") ErrRepoFileNotLoaded = errors.New("Repository file not loaded") ErrMirrorNotExist = errors.New("Mirror does not exist") ErrInvalidReference = errors.New("Invalid reference specified") ErrNameEmpty = errors.New("Name is empty") )
var (
Gitignores, Licenses, Readmes, LabelTemplates []string
// Maximum items per page in forks, watchers and stars of a repo
ItemsPerPage = 40
)
var ( ErrUserNotKeyOwner = errors.New("User does not the owner of public key") ErrEmailNotExist = errors.New("E-mail does not exist") ErrEmailNotActivated = errors.New("E-mail address has not been activated") ErrUserNameIllegal = errors.New("User name contains illegal characters") ErrLoginSourceNotActived = errors.New("Login source is not actived") ErrUnsupportedLoginType = errors.New("Login source is unknown") )
var (
DescPattern = regexp.MustCompile(`https?://\S+`)
)
var (
ErrMissingIssueNumber = errors.New("No issue number specified")
)
var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)
var LoginNames = map[LoginType]string{ LOGIN_LDAP: "LDAP (via BindDN)", LOGIN_DLDAP: "LDAP (simple auth)", LOGIN_SMTP: "SMTP", LOGIN_PAM: "PAM", }
var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)
var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLength)
var SMTPAuths = []string{SMTP_PLAIN, SMTP_LOGIN}
var SecurityProtocolNames = map[ldap.SecurityProtocol]string{ ldap.SECURITY_PROTOCOL_UNENCRYPTED: "Unencrypted", ldap.SECURITY_PROTOCOL_LDAPS: "LDAPS", ldap.SECURITY_PROTOCOL_START_TLS: "StartTLS", }
Functions ¶
func AddEmailAddress ¶
func AddEmailAddress(email *EmailAddress) error
func AddEmailAddresses ¶
func AddEmailAddresses(emails []*EmailAddress) error
func AddOrgUser ¶
AddOrgUser adds new user to given organization.
func AddTeamMember ¶
AddTeamMember adds new membership of given team to given organization, the user will have membership to given organization automatically when needed.
func AddTeamRepo ¶
AddTeamRepo adds new repository relation to team.
func AddTestPullRequestTask ¶
AddTestPullRequestTask adds new test tasks by given head/base repository and head/base branch, and generate new patch for testing as needed.
func AddUpdateTask ¶
func AddUpdateTask(task *UpdateTask) error
func AttachmentLocalPath ¶
AttachmentLocalPath returns where attachment is stored in local file system based on given UUID.
func Cell2Int64 ¶
Cell2Int64 converts a xorm.Cell type to int64, and handles possible irregular cases.
func ChangeMilestoneAssign ¶
ChangeMilestoneAssign changes assignment of milestone for issue.
func ChangeMilestoneIssueStats ¶
ChangeMilestoneIssueStats updates the open/closed issues counter and progress for the milestone associated with the given issue.
func ChangeMilestoneStatus ¶
ChangeMilestoneStatus changes the milestone open/closed status.
func ChangeOrgUserStatus ¶
ChangeOrgUserStatus changes public or private membership status.
func ChangeRepositoryName ¶
ChangeRepositoryName changes all corresponding setting from old repository name to new one.
func ChangeUserName ¶
ChangeUserName changes all corresponding setting from old user name to new one.
func CheckPublicKeyString ¶
CheckPublicKeyString checks if the given public key string is recognized by SSH. It returns the actual public key line on success.
func CheckRepoStats ¶
func CheckRepoStats()
func CommitRepoAction ¶
func CommitRepoAction(opts CommitRepoActionOptions) error
CommitRepoAction adds new commit actio to the repository, and prepare corresponding webhooks.
func ComposeHTTPSCloneURL ¶
ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
func CountLoginSources ¶
func CountLoginSources() int64
CountLoginSources returns number of login sources.
func CountOrganizations ¶
func CountOrganizations() int64
CountOrganizations returns number of organizations.
func CountRepoClosedMilestones ¶
CountRepoClosedMilestones returns number of closed milestones in given repository.
func CountRepoMilestones ¶
CountRepoMilestones returns number of milestones in given repository.
func CountRepositories ¶
CountRepositories returns number of repositories. Argument private only takes effect when it is false, set it true to count all repositories.
func CountUserRepositories ¶
CountUserRepositories returns number of repositories user owns. Argument private only takes effect when it is false, set it true to count all repositories.
func CreateHookTask ¶
CreateHookTask creates a new hook task, it handles conversion from Payload to PayloadContent.
func CreateLoginSource ¶
func CreateLoginSource(source *LoginSource) error
func CreateNotice ¶
func CreateNotice(tp NoticeType, desc string) error
CreateNotice creates new system notice.
func CreateOrganization ¶
CreateOrganization creates record of a new organization.
func CreateRefComment ¶
func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error
CreateRefComment creates a commit reference comment to issue.
func CreateRelease ¶
CreateRelease creates a new release of repository.
func CreateRepositoryNotice ¶
CreateRepositoryNotice creates new system notice with type NOTICE_REPOSITORY.
func DeleteAccessTokenByID ¶
DeleteAccessTokenByID deletes access token by given ID.
func DeleteAttachment ¶
func DeleteAttachment(a *Attachment, remove bool) error
DeleteAttachment deletes the given attachment and optionally the associated file.
func DeleteAttachments ¶
func DeleteAttachments(attachments []*Attachment, remove bool) (int, error)
DeleteAttachments deletes the given attachments and optionally the associated files.
func DeleteAttachmentsByComment ¶
DeleteAttachmentsByComment deletes all attachments associated with the given comment.
func DeleteAttachmentsByIssue ¶
DeleteAttachmentsByIssue deletes all attachments associated with the given issue.
func DeleteCommentByID ¶
DeleteCommentByID deletes the comment by given ID.
func DeleteDeployKey ¶
DeleteDeployKey deletes deploy key from its repository authorized_keys file if needed.
func DeleteEmailAddress ¶
func DeleteEmailAddress(email *EmailAddress) (err error)
func DeleteEmailAddresses ¶
func DeleteEmailAddresses(emails []*EmailAddress) (err error)
func DeleteInactivateUsers ¶
func DeleteInactivateUsers() (err error)
DeleteInactivateUsers deletes all inactivate users and email addresses.
func DeleteIssueLabel ¶
DeleteIssueLabel deletes issue-label relation.
func DeleteLabel ¶
DeleteLabel delete a label of given repository.
func DeleteMilestoneByRepoID ¶
DeleteMilestoneByRepoID deletes a milestone from a repository.
func DeleteMirrorByRepoID ¶
func DeleteMissingRepositories ¶
func DeleteMissingRepositories() error
DeleteMissingRepositories deletes all repository records that lost Git files.
func DeleteNotice ¶
DeleteNotice deletes a system notice by given ID.
func DeleteNotices ¶
DeleteNotices deletes all notices with ID from start to end (inclusive).
func DeleteNoticesByIDs ¶
DeleteNoticesByIDs deletes notices by given IDs.
func DeleteOrganization ¶
DeleteOrganization completely and permanently deletes everything of organization.
func DeletePublicKey ¶
DeletePublicKey deletes SSH key information both in database and authorized_keys file.
func DeleteReleaseByID ¶
DeleteReleaseByID deletes a release and corresponding Git tag by given ID.
func DeleteRepository ¶
DeleteRepository deletes a repository for a user or organization.
func DeleteRepositoryArchives ¶
func DeleteRepositoryArchives() error
DeleteRepositoryArchives deletes all repositories' archives.
func DeleteSource ¶
func DeleteSource(source *LoginSource) error
func DeleteTeam ¶
DeleteTeam deletes given team. It's caller's responsibility to assign organization ID.
func DeleteUpdateTaskByUUID ¶
func DeleteUpload ¶
func DeleteUploadByUUID ¶
func DeleteUploads ¶
func DeleteUser ¶
DeleteUser completely and permanently deletes everything of a user, but issues/comments/pulls will be kept and shown as someone has been deleted.
func DeleteWebhookByOrgID ¶
DeleteWebhookByOrgID deletes webhook of organization by given ID.
func DeleteWebhookByRepoID ¶
DeleteWebhookByRepoID deletes webhook of repository by given ID.
func DeliverHooks ¶
func DeliverHooks()
DeliverHooks checks and delivers undelivered hooks. TODO: shoot more hooks at same time.
func DumpDatabase ¶
DumpDatabase dumps all data from database to file system.
func FollowUser ¶
FollowUser marks someone be another's follower.
func GetLabelTemplateFile ¶
GetLabelTemplateFile loads the label template file by given name, then parses and returns a list of name-color pairs.
func GetRawDiff ¶
func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Writer) error
GetRawDiff dumps diff results of repository in given commit ID to io.Writer. TODO: move this function to gogits/git-module
func GetRepoIssueStats ¶
func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64)
GetRepoIssueStats returns number of open and closed repository issues by given filter mode.
func GetRepositoryCount ¶
GetRepositoryCount returns the total number of repositories of user.
func GetUserEmailsByNames ¶
GetUserEmailsByNames returns a list of e-mails corresponds to names.
func GetUserIDsByNames ¶
GetUserIDsByNames returns a slice of ids corresponds to names.
func GitGcRepos ¶
func GitGcRepos() error
func HandleCloneUserCredentials ¶
HandleCloneUserCredentials replaces user credentials from HTTP/HTTPS URL with placeholder <credentials>. It will fail for any other forms of clone addresses.
func HasAccess ¶
func HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error)
HasAccess returns true if someone has the request access level. User can be nil!
func HasDeployKey ¶
HasDeployKey returns true if public key is a deploy key of given repository.
func HasIssueLabel ¶
HasIssueLabel returns true if issue has been labeled.
func HasTeamRepo ¶
HasTeamRepo returns true if given repository belongs to team.
func InitDeliverHooks ¶
func InitDeliverHooks()
func InitMailRender ¶
func InitSyncMirrors ¶
func InitSyncMirrors()
func InitTestPullRequests ¶
func InitTestPullRequests()
func IsEmailUsed ¶
IsEmailUsed returns true if the email has been used.
func IsErrAccessTokenEmpty ¶
func IsErrAttachmentNotExist ¶
func IsErrBranchNotExist ¶
func IsErrCommentNotExist ¶
func IsErrDeployKeyNotExist ¶
func IsErrEmailAlreadyUsed ¶
func IsErrInvalidCloneAddr ¶
func IsErrInvalidTagName ¶
func IsErrIssueNotExist ¶
func IsErrKeyAccessDenied ¶
func IsErrKeyAlreadyExist ¶
func IsErrKeyNameAlreadyUsed ¶
func IsErrKeyNotExist ¶
func IsErrKeyUnableVerify ¶
func IsErrLabelNotExist ¶
func IsErrLastOrgOwner ¶
func IsErrLoginSourceInUse ¶
func IsErrMilestoneNotExist ¶
func IsErrNameReserved ¶
func IsErrReachLimitOfRepo ¶
func IsErrReleaseNotExist ¶
func IsErrRepoAlreadyExist ¶
func IsErrRepoNotExist ¶
func IsErrTeamAlreadyExist ¶
func IsErrUpdateTaskNotExist ¶
func IsErrUploadNotExist ¶
func IsErrUserAlreadyExist ¶
func IsErrUserHasOrgs ¶
func IsErrUserNotExist ¶
func IsErrUserOwnRepos ¶
func IsErrWebhookNotExist ¶
func IsErrWikiAlreadyExist ¶
func IsFollowing ¶
func IsOrganizationMember ¶
IsOrganizationMember returns true if given user is member of organization.
func IsOrganizationOwner ¶
IsOrganizationOwner returns true if given user is in the owner team.
func IsPublicMembership ¶
IsPublicMembership returns true if given user public his/her membership.
func IsReleaseExist ¶
IsReleaseExist returns true if release with given tag name already exists.
func IsRepositoryExist ¶
IsRepositoryExist returns true if the repository with given name under user has already existed.
func IsTeamMember ¶
IsTeamMember returns true if given user is a member of team.
func IsUsableRepoName ¶
func IsUsableUsername ¶
func IsUserExist ¶
IsUserExist checks if given user name exist, the user name should be noncased unique. If uid is presented, then check will rule out that one, it is used when update a user name in settings page.
func IsValidHookContentType ¶
IsValidHookContentType returns true if given name is a valid hook content type.
func IsValidHookTaskType ¶
IsValidHookTaskType returns true if given name is a valid hook task type.
func IsWatching ¶
IsWatching checks if user has watched given repository.
func LoadConfigs ¶
func LoadConfigs()
func LoadRepoConfig ¶
func LoadRepoConfig()
func MakeEmailPrimary ¶
func MakeEmailPrimary(email *EmailAddress) error
func MergePullRequestAction ¶
func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error
MergePullRequestAction adds new action for merging pull request.
func MilestoneStats ¶
MilestoneStats returns number of open and closed milestones of given repository.
func NewAccessToken ¶
func NewAccessToken(t *AccessToken) error
NewAccessToken creates new access token.
func NewIssue ¶
func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) (err error)
NewIssue creates new issue with labels for repository.
func NewIssueLabel ¶
NewIssueLabel creates a new issue-label relation.
func NewIssueLabels ¶
NewIssueLabels creates a list of issue-label relations.
func NewIssueUsers ¶
func NewIssueUsers(repo *Repository, issue *Issue) (err error)
NewIssueUsers adds new issue-user relations for new issue of repository.
func NewMilestone ¶
NewMilestone creates new milestone of repository.
func NewPullRequest ¶
func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, pr *PullRequest, patch []byte) (err error)
NewPullRequest creates new pull request with labels for repository.
func NewRepoAction ¶
func NewRepoAction(u *User, repo *Repository) (err error)
NewRepoAction adds new action for creating repository.
func NewRepoContext ¶
func NewRepoContext()
func NewTeam ¶
NewTeam creates a record of new team. It's caller's responsibility to assign organization ID.
func NewTestEngine ¶
func NotifyWatchers ¶
NotifyWatchers creates batch of actions for every watcher.
func PairsContains ¶
PairsContains returns true when pairs list contains given issue.
func PrepareWebhooks ¶
func PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error
PrepareWebhooks adds new webhooks to task queue for given payload.
func PushUpdate ¶
func PushUpdate(opts PushUpdateOptions) (err error)
PushUpdate must be called for any push actions in order to generates necessary push action history feeds.
func ReinitMissingRepositories ¶
func ReinitMissingRepositories() error
ReinitMissingRepositories reinitializes all repository records that lost Git files.
func RemoveAllWithNotice ¶
func RemoveAllWithNotice(title, path string)
RemoveAllWithNotice removes all directories in given path and creates a system notice when error occurs.
func RemoveOrgRepo ¶
RemoveOrgRepo removes all team-repository relations of given organization.
func RemoveOrgUser ¶
RemoveOrgUser removes user from given organization.
func RemoveTeamMember ¶
RemoveTeamMember removes member from given team of given organization.
func RemoveTeamRepo ¶
RemoveTeamRepo deletes repository relation to team.
func RenameRepoAction ¶
func RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error
RenameRepoAction adds new action for renaming a repository.
func RewriteAllPublicKeys ¶
func RewriteAllPublicKeys() error
RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again. Note: x.Iterate does not get latest data after insert/delete, so we have to call this function outsite any session scope independently.
func RewriteRepositoryUpdateHook ¶
func RewriteRepositoryUpdateHook() error
RewriteRepositoryUpdateHook rewrites all repositories' update hook.
func SSHKeyGenParsePublicKey ¶
SSHKeyGenParsePublicKey extracts key type and length using ssh-keygen.
func SSHNativeParsePublicKey ¶
SSHNativeParsePublicKey extracts the key type and length using the golang SSH library. NOTE: ed25519 is not supported.
func SendActivateAccountMail ¶
func SendActivateAccountMail(c *macaron.Context, u *User)
func SendActivateEmailMail ¶
func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress)
SendActivateAccountMail sends confirmation email.
func SendCollaboratorMail ¶
func SendCollaboratorMail(u, doer *User, repo *Repository)
SendCollaboratorMail sends mail notification to new collaborator.
func SendIssueCommentMail ¶
SendIssueCommentMail composes and sends issue comment emails to target receivers.
func SendIssueMentionMail ¶
SendIssueMentionMail composes and sends issue mention emails to target receivers.
func SendRegisterNotifyMail ¶
func SendRegisterNotifyMail(c *macaron.Context, u *User)
SendRegisterNotifyMail triggers a notify e-mail by admin created a account.
func SendResetPasswordMail ¶
func SendResetPasswordMail(c *macaron.Context, u *User)
func SendTestMail ¶
func SendUserMail ¶
func SlackLinkFormatter ¶
func SlackShortTextFormatter ¶
func SlackTextFormatter ¶
func SortReleases ¶
func SortReleases(rels []*Release)
SortReleases sorts releases by number of commits and created time.
func SyncMirrors ¶
func SyncMirrors()
SyncMirrors checks and syncs mirrors. TODO: sync more mirrors at same time.
func TestPullRequests ¶
func TestPullRequests()
TestPullRequests checks and tests untested patches of pull requests. TODO: test more pull requests at same time.
func ToWikiPageName ¶
ToWikiPageName formats a URL back to corresponding wiki page name, and removes leading characters './' to prevent changing files that are not belong to wiki repository.
func ToWikiPageURL ¶
ToWikiPageURL formats a string to corresponding wiki URL name.
func TransferOwnership ¶
func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
TransferOwnership transfers all corresponding setting from old user to new one.
func TransferRepoAction ¶
func TransferRepoAction(doer, oldOwner *User, repo *Repository) error
TransferRepoAction adds new action for transferring repository, the Owner field of repository is assumed to be new owner.
func UnfollowUser ¶
UnfollowUser unmarks someone be another's follower.
func UpdateAccessToken ¶
func UpdateAccessToken(t *AccessToken) error
UpdateAccessToken updates information of access token.
func UpdateComment ¶
UpdateComment updates information of comment.
func UpdateDeployKey ¶
UpdateDeployKey updates deploy key information.
func UpdateHookTask ¶
UpdateHookTask updates information of hook task.
func UpdateIssue ¶
UpdateIssue updates all fields of given issue.
func UpdateIssueCols ¶
UpdateIssueCols only updates values of specific columns for given issue.
func UpdateIssueMentions ¶
UpdateIssueMentions extracts mentioned people from content and updates issue-user relations for them.
func UpdateIssueUserByAssignee ¶
UpdateIssueUserByAssignee updates issue-user relation for assignee.
func UpdateIssueUserByRead ¶
UpdateIssueUserByRead updates issue-user relation for reading.
func UpdateIssueUsersByMentions ¶
UpdateIssueUsersByMentions updates issue-user pairs by mentioning.
func UpdateIssueUsersByStatus ¶
UpdateIssueUsersByStatus updates issue-user relations by issue status.
func UpdateIssuesCommit ¶
func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) error
UpdateIssuesCommit checks if issues are manipulated by commit message.
func UpdateLocalCopyBranch ¶
UpdateLocalCopy pulls latest changes of given branch from repoPath to localPath. It creates a new clone if local copy does not exist. This function checks out target branch by default, it is safe to assume subsequent operations are operating against target branch when caller has confidence for no race condition.
func UpdateMilestone ¶
UpdateMilestone updates information of given milestone.
func UpdateMirror ¶
func UpdatePublicKey ¶
UpdatePublicKey updates given public key.
func UpdateRelease ¶
UpdateRelease updates information of a release.
func UpdateRepository ¶
func UpdateRepository(repo *Repository, visibilityChanged bool) (err error)
func UpdateSource ¶
func UpdateSource(source *LoginSource) error
func UpdateTeam ¶
UpdateTeam updates information of team.
func UpdateWebhook ¶
UpdateWebhook updates information of webhook.
func UploadLocalPath ¶
UploadLocalPath returns where uploads is stored in local file system based on given UUID.
func ValidateCommitsWithEmails ¶
ValidateCommitsWithEmails checks if authors' e-mails of commits are corresponding to users.
Types ¶
type Access ¶
type Access struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"UNIQUE(s)"` RepoID int64 `xorm:"UNIQUE(s)"` Mode AccessMode }
Access represents the highest access level of a user to the repository. The only access type that is not in this table is the real owner of a repository. In case of an organization repository, the members of the owners team are in this table.
type AccessMode ¶
type AccessMode int
const ( ACCESS_MODE_NONE AccessMode = iota // 0 ACCESS_MODE_READ // 1 ACCESS_MODE_WRITE // 2 ACCESS_MODE_ADMIN // 3 ACCESS_MODE_OWNER // 4 )
func AccessLevel ¶
func AccessLevel(u *User, repo *Repository) (AccessMode, error)
AccessLevel returns the Access a user has to a repository. Will return NoneAccess if the user does not have access. User can be nil!
func ParseAccessMode ¶
func ParseAccessMode(permission string) AccessMode
ParseAccessMode returns corresponding access mode to given permission string.
func (AccessMode) String ¶
func (mode AccessMode) String() string
type AccessToken ¶
type AccessToken struct { ID int64 `xorm:"pk autoincr"` UID int64 `xorm:"INDEX"` Name string Sha1 string `xorm:"UNIQUE VARCHAR(40)"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` // Note: Updated must below Created for AfterSet. UpdatedUnix int64 HasRecentActivity bool `xorm:"-"` HasUsed bool `xorm:"-"` }
AccessToken represents a personal access token.
func GetAccessTokenBySHA ¶
func GetAccessTokenBySHA(sha string) (*AccessToken, error)
GetAccessTokenBySHA returns access token by given sha1.
func ListAccessTokens ¶
func ListAccessTokens(uid int64) ([]*AccessToken, error)
ListAccessTokens returns a list of access tokens belongs to given user.
func (*AccessToken) BeforeInsert ¶
func (t *AccessToken) BeforeInsert()
func (*AccessToken) BeforeUpdate ¶
func (t *AccessToken) BeforeUpdate()
type Action ¶
type Action struct { ID int64 `xorm:"pk autoincr"` UserID int64 // Receiver user id. OpType ActionType ActUserID int64 // Action user id. ActUserName string // Action user name. ActAvatar string `xorm:"-"` RepoID int64 RepoUserName string RepoName string RefName string IsPrivate bool `xorm:"NOT NULL DEFAULT false"` Content string `xorm:"TEXT"` Created time.Time `xorm:"-"` CreatedUnix int64 }
Action represents user operation type and other information to repository., it implemented interface base.Actioner so that can be used in template render.
func GetFeeds ¶
GetFeeds returns action list of given user in given context. actorID is the user who's requesting, ctxUserID is the user/org that is requested. actorID can be -1 when isProfile is true or to skip the permission check.
func (*Action) BeforeInsert ¶
func (a *Action) BeforeInsert()
func (*Action) GetActUserName ¶
func (*Action) GetContent ¶
func (*Action) GetIssueContent ¶
func (*Action) GetIssueInfos ¶
func (*Action) GetIssueTitle ¶
func (*Action) GetRepoLink ¶
func (*Action) GetRepoName ¶
func (*Action) GetRepoPath ¶
func (*Action) GetRepoUserName ¶
func (*Action) ShortActUserName ¶
func (*Action) ShortRepoName ¶
func (*Action) ShortRepoPath ¶
func (*Action) ShortRepoUserName ¶
type ActionType ¶
type ActionType int
const ( ACTION_CREATE_REPO ActionType = iota + 1 // 1 ACTION_RENAME_REPO // 2 ACTION_STAR_REPO // 3 ACTION_WATCH_REPO // 4 ACTION_COMMIT_REPO // 5 ACTION_CREATE_ISSUE // 6 ACTION_CREATE_PULL_REQUEST // 7 ACTION_TRANSFER_REPO // 8 ACTION_PUSH_TAG // 9 ACTION_COMMENT_ISSUE // 10 ACTION_MERGE_PULL_REQUEST // 11 ACTION_CLOSE_ISSUE // 12 ACTION_REOPEN_ISSUE // 13 ACTION_CLOSE_PULL_REQUEST // 14 ACTION_REOPEN_PULL_REQUEST // 15 )
type Attachment ¶
type Attachment struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"uuid UNIQUE"` IssueID int64 `xorm:"INDEX"` CommentID int64 ReleaseID int64 `xorm:"INDEX"` Name string Created time.Time `xorm:"-"` CreatedUnix int64 }
Attachment represent a attachment of issue/comment/release.
func GetAttachmentByUUID ¶
func GetAttachmentByUUID(uuid string) (*Attachment, error)
GetAttachmentByUUID returns attachment by given UUID.
func GetAttachmentsByCommentID ¶
func GetAttachmentsByCommentID(commentID int64) ([]*Attachment, error)
GetAttachmentsByCommentID returns all attachments if comment by given ID.
func GetAttachmentsByIssueID ¶
func GetAttachmentsByIssueID(issueID int64) ([]*Attachment, error)
GetAttachmentsByIssueID returns all attachments of an issue.
func NewAttachment ¶
NewAttachment creates a new attachment object.
func (*Attachment) BeforeInsert ¶
func (a *Attachment) BeforeInsert()
func (*Attachment) LocalPath ¶
func (attach *Attachment) LocalPath() string
LocalPath returns where attachment is stored in local file system.
type Branch ¶
func GetBranchesByPath ¶
type Collaboration ¶
type Collaboration struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` UserID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` Mode AccessMode `xorm:"DEFAULT 2 NOT NULL"` }
Collaboration represent the relation between an individual and a repository.
func (*Collaboration) ModeI18nKey ¶
func (c *Collaboration) ModeI18nKey() string
type Collaborator ¶
type Collaborator struct { *User Collaboration *Collaboration }
Collaborator represents a user with collaboration details.
type Comment ¶
type Comment struct { ID int64 `xorm:"pk autoincr"` Type CommentType PosterID int64 Poster *User `xorm:"-"` IssueID int64 `xorm:"INDEX"` CommitID int64 Line int64 Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 // Reference issue in commit message CommitSHA string `xorm:"VARCHAR(40)"` Attachments []*Attachment `xorm:"-"` // For view issue page. ShowTag CommentTag `xorm:"-"` }
Comment represents a comment in commit and issue page.
func CreateComment ¶
func CreateComment(opts *CreateCommentOptions) (comment *Comment, err error)
CreateComment creates comment of issue or commit.
func CreateIssueComment ¶
func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, attachments []string) (*Comment, error)
CreateIssueComment creates a plain issue comment.
func GetCommentByID ¶
GetCommentByID returns the comment by given ID.
func GetCommentsByIssueID ¶
GetCommentsByIssueID returns all comments of an issue.
func GetCommentsByIssueIDSince ¶
GetCommentsByIssueID returns a list of comments of an issue since a given time point.
func (*Comment) AfterDelete ¶
func (c *Comment) AfterDelete()
func (*Comment) BeforeInsert ¶
func (c *Comment) BeforeInsert()
func (*Comment) BeforeUpdate ¶
func (c *Comment) BeforeUpdate()
func (*Comment) MailParticipants ¶
func (cmt *Comment) MailParticipants(opType ActionType, issue *Issue) (err error)
MailParticipants sends new comment emails to repository watchers and mentioned people.
type CommentTag ¶
type CommentTag int
const ( COMMENT_TAG_NONE CommentTag = iota COMMENT_TAG_POSTER COMMENT_TAG_WRITER COMMENT_TAG_OWNER )
type CommentType ¶
type CommentType int
CommentType defines whether a comment is just a simple comment, an action (like close) or a reference.
const ( // Plain comment, can be associated with a commit (CommitID > 0) and a line (LineNum > 0) COMMENT_TYPE_COMMENT CommentType = iota COMMENT_TYPE_REOPEN COMMENT_TYPE_CLOSE // References. COMMENT_TYPE_ISSUE_REF // Reference from a commit (not part of a pull request) COMMENT_TYPE_COMMIT_REF // Reference from a comment COMMENT_TYPE_COMMENT_REF // Reference from a pull request COMMENT_TYPE_PULL_REF )
type CommitRepoActionOptions ¶
type CreateCommentOptions ¶
type CreateCommentOptions struct { Type CommentType Doer *User Repo *Repository Issue *Issue CommitID int64 CommitSHA string LineNum int64 Content string Attachments []string // UUIDs of attachments }
type CreateRepoOptions ¶
type DeleteRepoFileOptions ¶
type DeployKey ¶
type DeployKey struct { ID int64 `xorm:"pk autoincr"` KeyID int64 `xorm:"UNIQUE(s) INDEX"` RepoID int64 `xorm:"UNIQUE(s) INDEX"` Name string Fingerprint string Content string `xorm:"-"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` // Note: Updated must below Created for AfterSet. UpdatedUnix int64 HasRecentActivity bool `xorm:"-"` HasUsed bool `xorm:"-"` }
DeployKey represents deploy key information and its relation with repository.
func AddDeployKey ¶
AddDeployKey add new deploy key to database and authorized_keys file.
func GetDeployKeyByID ¶
GetDeployKeyByID returns deploy key by given ID.
func GetDeployKeyByRepo ¶
GetDeployKeyByRepo returns deploy key by given public key ID and repository ID.
func ListDeployKeys ¶
ListDeployKeys returns all deploy keys by given repository ID.
func (*DeployKey) BeforeInsert ¶
func (k *DeployKey) BeforeInsert()
func (*DeployKey) BeforeUpdate ¶
func (k *DeployKey) BeforeUpdate()
func (*DeployKey) GetContent ¶
GetContent gets associated public key content.
type Diff ¶
func GetDiffCommit ¶
func GetDiffRange ¶
func ParsePatch ¶
TODO: move this function to gogits/git-module
type DiffFile ¶
type DiffFile struct { Name string OldName string Index int Addition, Deletion int Type DiffFileType IsCreated bool IsDeleted bool IsBin bool IsRenamed bool IsSubmodule bool Sections []*DiffSection IsIncomplete bool }
func (*DiffFile) GetHighlightClass ¶
type DiffFileType ¶
type DiffFileType uint8
const ( DIFF_FILE_ADD DiffFileType = iota + 1 DIFF_FILE_CHANGE DIFF_FILE_DEL DIFF_FILE_RENAME )
type DiffLineType ¶
type DiffLineType uint8
const ( DIFF_LINE_PLAIN DiffLineType = iota + 1 DIFF_LINE_ADD DIFF_LINE_DEL DIFF_LINE_SECTION )
type DiffSection ¶
func (*DiffSection) GetComputedInlineDiffFor ¶
func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) template.HTML
computes inline diff for the given line
func (*DiffSection) GetLine ¶
func (diffSection *DiffSection) GetLine(lineType DiffLineType, idx int) *DiffLine
get an specific line by type (add or del) and file line number
type EmailAddress ¶
type EmailAddress struct { ID int64 `xorm:"pk autoincr"` UID int64 `xorm:"INDEX NOT NULL"` Email string `xorm:"UNIQUE NOT NULL"` IsActivated bool IsPrimary bool `xorm:"-"` }
EmailAdresses is the list of all email addresses of a user. Can contain the primary email address, but is not obligatory.
func GetEmailAddresses ¶
func GetEmailAddresses(uid int64) ([]*EmailAddress, error)
GetEmailAddresses returns all email addresses belongs to given user.
func VerifyActiveEmailCode ¶
func VerifyActiveEmailCode(code, email string) *EmailAddress
verify active code when active account
func (*EmailAddress) Activate ¶
func (email *EmailAddress) Activate() error
type Engine ¶
type Engine interface { Delete(interface{}) (int64, error) Exec(string, ...interface{}) (sql.Result, error) Find(interface{}, ...interface{}) error Get(interface{}) (bool, error) Id(interface{}) *xorm.Session In(string, ...interface{}) *xorm.Session Insert(...interface{}) (int64, error) InsertOne(interface{}) (int64, error) Iterate(interface{}, xorm.IterFunc) error Sql(string, ...interface{}) *xorm.Session Where(interface{}, ...interface{}) *xorm.Session }
Engine represents a xorm engine or session.
type ErrAccessTokenEmpty ¶
type ErrAccessTokenEmpty struct { }
func (ErrAccessTokenEmpty) Error ¶
func (err ErrAccessTokenEmpty) Error() string
type ErrAccessTokenNotExist ¶
type ErrAccessTokenNotExist struct {
SHA string
}
func (ErrAccessTokenNotExist) Error ¶
func (err ErrAccessTokenNotExist) Error() string
type ErrAttachmentNotExist ¶
func (ErrAttachmentNotExist) Error ¶
func (err ErrAttachmentNotExist) Error() string
type ErrBranchNotExist ¶
type ErrBranchNotExist struct {
Name string
}
func (ErrBranchNotExist) Error ¶
func (err ErrBranchNotExist) Error() string
type ErrCommentNotExist ¶
func (ErrCommentNotExist) Error ¶
func (err ErrCommentNotExist) Error() string
type ErrDeployKeyAlreadyExist ¶
func (ErrDeployKeyAlreadyExist) Error ¶
func (err ErrDeployKeyAlreadyExist) Error() string
type ErrDeployKeyNameAlreadyUsed ¶
func (ErrDeployKeyNameAlreadyUsed) Error ¶
func (err ErrDeployKeyNameAlreadyUsed) Error() string
type ErrDeployKeyNotExist ¶
func (ErrDeployKeyNotExist) Error ¶
func (err ErrDeployKeyNotExist) Error() string
type ErrEmailAlreadyUsed ¶
type ErrEmailAlreadyUsed struct {
Email string
}
func (ErrEmailAlreadyUsed) Error ¶
func (err ErrEmailAlreadyUsed) Error() string
type ErrInvalidCloneAddr ¶
func (ErrInvalidCloneAddr) Error ¶
func (err ErrInvalidCloneAddr) Error() string
type ErrInvalidTagName ¶
type ErrInvalidTagName struct {
TagName string
}
func (ErrInvalidTagName) Error ¶
func (err ErrInvalidTagName) Error() string
type ErrIssueNotExist ¶
func (ErrIssueNotExist) Error ¶
func (err ErrIssueNotExist) Error() string
type ErrKeyAccessDenied ¶
func (ErrKeyAccessDenied) Error ¶
func (err ErrKeyAccessDenied) Error() string
type ErrKeyAlreadyExist ¶
func (ErrKeyAlreadyExist) Error ¶
func (err ErrKeyAlreadyExist) Error() string
type ErrKeyNameAlreadyUsed ¶
func (ErrKeyNameAlreadyUsed) Error ¶
func (err ErrKeyNameAlreadyUsed) Error() string
type ErrKeyNotExist ¶
type ErrKeyNotExist struct {
ID int64
}
func (ErrKeyNotExist) Error ¶
func (err ErrKeyNotExist) Error() string
type ErrKeyUnableVerify ¶
type ErrKeyUnableVerify struct {
Result string
}
func (ErrKeyUnableVerify) Error ¶
func (err ErrKeyUnableVerify) Error() string
type ErrLabelNotExist ¶
func (ErrLabelNotExist) Error ¶
func (err ErrLabelNotExist) Error() string
type ErrLastOrgOwner ¶
type ErrLastOrgOwner struct {
UID int64
}
func (ErrLastOrgOwner) Error ¶
func (err ErrLastOrgOwner) Error() string
type ErrLoginSourceAlreadyExist ¶
type ErrLoginSourceAlreadyExist struct {
Name string
}
func (ErrLoginSourceAlreadyExist) Error ¶
func (err ErrLoginSourceAlreadyExist) Error() string
type ErrLoginSourceInUse ¶
type ErrLoginSourceInUse struct {
ID int64
}
func (ErrLoginSourceInUse) Error ¶
func (err ErrLoginSourceInUse) Error() string
type ErrLoginSourceNotExist ¶
type ErrLoginSourceNotExist struct {
ID int64
}
func (ErrLoginSourceNotExist) Error ¶
func (err ErrLoginSourceNotExist) Error() string
type ErrMilestoneNotExist ¶
func (ErrMilestoneNotExist) Error ¶
func (err ErrMilestoneNotExist) Error() string
type ErrNamePatternNotAllowed ¶
type ErrNamePatternNotAllowed struct {
Pattern string
}
func (ErrNamePatternNotAllowed) Error ¶
func (err ErrNamePatternNotAllowed) Error() string
type ErrNameReserved ¶
type ErrNameReserved struct {
Name string
}
func (ErrNameReserved) Error ¶
func (err ErrNameReserved) Error() string
type ErrPullRequestNotExist ¶
type ErrPullRequestNotExist struct { ID int64 IssueID int64 HeadRepoID int64 BaseRepoID int64 HeadBarcnh string BaseBranch string }
func (ErrPullRequestNotExist) Error ¶
func (err ErrPullRequestNotExist) Error() string
type ErrReachLimitOfRepo ¶
type ErrReachLimitOfRepo struct {
Limit int
}
func (ErrReachLimitOfRepo) Error ¶
func (err ErrReachLimitOfRepo) Error() string
type ErrReleaseAlreadyExist ¶
type ErrReleaseAlreadyExist struct {
TagName string
}
func (ErrReleaseAlreadyExist) Error ¶
func (err ErrReleaseAlreadyExist) Error() string
type ErrReleaseNotExist ¶
func (ErrReleaseNotExist) Error ¶
func (err ErrReleaseNotExist) Error() string
type ErrRepoAlreadyExist ¶
func (ErrRepoAlreadyExist) Error ¶
func (err ErrRepoAlreadyExist) Error() string
type ErrRepoFileAlreadyExist ¶
type ErrRepoFileAlreadyExist struct {
FileName string
}
func (ErrRepoFileAlreadyExist) Error ¶
func (err ErrRepoFileAlreadyExist) Error() string
type ErrRepoNotExist ¶
func (ErrRepoNotExist) Error ¶
func (err ErrRepoNotExist) Error() string
type ErrTeamAlreadyExist ¶
func (ErrTeamAlreadyExist) Error ¶
func (err ErrTeamAlreadyExist) Error() string
type ErrUpdateTaskNotExist ¶
type ErrUpdateTaskNotExist struct {
UUID string
}
func (ErrUpdateTaskNotExist) Error ¶
func (err ErrUpdateTaskNotExist) Error() string
type ErrUploadNotExist ¶
func (ErrUploadNotExist) Error ¶
func (err ErrUploadNotExist) Error() string
type ErrUserAlreadyExist ¶
type ErrUserAlreadyExist struct {
Name string
}
func (ErrUserAlreadyExist) Error ¶
func (err ErrUserAlreadyExist) Error() string
type ErrUserHasOrgs ¶
type ErrUserHasOrgs struct {
UID int64
}
func (ErrUserHasOrgs) Error ¶
func (err ErrUserHasOrgs) Error() string
type ErrUserNotExist ¶
func (ErrUserNotExist) Error ¶
func (err ErrUserNotExist) Error() string
type ErrUserOwnRepos ¶
type ErrUserOwnRepos struct {
UID int64
}
func (ErrUserOwnRepos) Error ¶
func (err ErrUserOwnRepos) Error() string
type ErrWebhookNotExist ¶
type ErrWebhookNotExist struct {
ID int64
}
func (ErrWebhookNotExist) Error ¶
func (err ErrWebhookNotExist) Error() string
type ErrWikiAlreadyExist ¶
type ErrWikiAlreadyExist struct {
Title string
}
func (ErrWikiAlreadyExist) Error ¶
func (err ErrWikiAlreadyExist) Error() string
type Follow ¶
type Follow struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"UNIQUE(follow)"` FollowID int64 `xorm:"UNIQUE(follow)"` }
Follow represents relations of user and his/her followers.
type HookContentType ¶
type HookContentType int
const ( JSON HookContentType = iota + 1 FORM )
func ToHookContentType ¶
func ToHookContentType(name string) HookContentType
ToHookContentType returns HookContentType by given name.
func (HookContentType) Name ¶
func (t HookContentType) Name() string
type HookEvent ¶
type HookEvent struct { PushOnly bool `json:"push_only"` SendEverything bool `json:"send_everything"` ChooseEvents bool `json:"choose_events"` HookEvents `json:"events"` }
HookEvent represents events that will delivery hook.
type HookEventType ¶
type HookEventType string
const ( HOOK_EVENT_CREATE HookEventType = "create" HOOK_EVENT_PUSH HookEventType = "push" HOOK_EVENT_PULL_REQUEST HookEventType = "pull_request" )
type HookEvents ¶
type HookRequest ¶
HookRequest represents hook task request information.
type HookResponse ¶
type HookResponse struct { Status int `json:"status"` Headers map[string]string `json:"headers"` Body string `json:"body"` }
HookResponse represents hook task response information.
type HookStatus ¶
type HookStatus int
type HookTask ¶
type HookTask struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` HookID int64 UUID string Type HookTaskType URL string `xorm:"TEXT"` api.Payloader `xorm:"-"` PayloadContent string `xorm:"TEXT"` ContentType HookContentType EventType HookEventType IsSSL bool IsDelivered bool Delivered int64 DeliveredString string `xorm:"-"` // History info. IsSucceed bool RequestContent string `xorm:"TEXT"` RequestInfo *HookRequest `xorm:"-"` ResponseContent string `xorm:"TEXT"` ResponseInfo *HookResponse `xorm:"-"` }
HookTask represents a hook task.
func (*HookTask) BeforeUpdate ¶
func (t *HookTask) BeforeUpdate()
func (*HookTask) MarshalJSON ¶
type HookTaskType ¶
type HookTaskType int
const ( GOGS HookTaskType = iota + 1 SLACK )
func ToHookTaskType ¶
func ToHookTaskType(name string) HookTaskType
ToHookTaskType returns HookTaskType by given name.
func (HookTaskType) Name ¶
func (t HookTaskType) Name() string
type Issue ¶
type Issue struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX UNIQUE(repo_index)"` Repo *Repository `xorm:"-"` Index int64 `xorm:"UNIQUE(repo_index)"` // Index in one repository. PosterID int64 Poster *User `xorm:"-"` Title string `xorm:"name"` Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` Labels []*Label `xorm:"-"` MilestoneID int64 Milestone *Milestone `xorm:"-"` Priority int AssigneeID int64 Assignee *User `xorm:"-"` IsClosed bool IsRead bool `xorm:"-"` IsPull bool // Indicates whether is a pull request or not. PullRequest *PullRequest `xorm:"-"` NumComments int Deadline time.Time `xorm:"-"` DeadlineUnix int64 Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 Attachments []*Attachment `xorm:"-"` Comments []*Comment `xorm:"-"` }
Issue represents an issue or pull request of repository.
func GetIssueByID ¶
GetIssueByID returns an issue by given ID.
func GetIssueByIndex ¶
GetIssueByIndex returns issue by index in a repository.
func GetIssueByRef ¶
GetIssueByRef returns an Issue specified by a GFM reference. See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
func GetRawIssueByIndex ¶
GetIssueByIndex returns raw issue without loading attributes by index in a repository.
func Issues ¶
func Issues(opts *IssuesOptions) ([]*Issue, error)
Issues returns a list of issues by given conditions.
func (*Issue) APIFormat ¶
This method assumes some fields assigned with values: Required - Poster, Labels, Optional - Milestone, Assignee, PullRequest
func (*Issue) BeforeInsert ¶
func (issue *Issue) BeforeInsert()
func (*Issue) BeforeUpdate ¶
func (issue *Issue) BeforeUpdate()
func (*Issue) ChangeAssignee ¶
func (*Issue) ChangeContent ¶
func (*Issue) ChangeStatus ¶
func (issue *Issue) ChangeStatus(doer *User, repo *Repository, isClosed bool) (err error)
ChangeStatus changes issue status to open or closed.
func (*Issue) ClearLabels ¶
func (*Issue) GetAssignee ¶
func (*Issue) LoadAttributes ¶
func (*Issue) MailParticipants ¶
MailParticipants sends new issue thread created emails to repository watchers and mentioned people.
func (*Issue) MailSubject ¶
func (*Issue) RemoveLabel ¶
RemoveLabel removes a label from issue by given ID.
func (*Issue) ReplaceLabels ¶
ReplaceLabels removes all current labels and add new labels to the issue.
type IssueLabel ¶
type IssueLabel struct { ID int64 `xorm:"pk autoincr"` IssueID int64 `xorm:"UNIQUE(s)"` LabelID int64 `xorm:"UNIQUE(s)"` }
IssueLabel represetns an issue-lable relation.
func GetIssueLabels ¶
func GetIssueLabels(issueID int64) ([]*IssueLabel, error)
GetIssueLabels returns all issue-label relations of given issue by ID.
type IssueStats ¶
type IssueStats struct {
OpenCount, ClosedCount int64
AllCount int64
AssignCount int64
CreateCount int64
MentionCount int64
}
IssueStats represents issue statistic information.
func GetIssueStats ¶
func GetIssueStats(opts *IssueStatsOptions) *IssueStats
GetIssueStats returns issue statistic information by given conditions.
func GetUserIssueStats ¶
func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPull bool) *IssueStats
GetUserIssueStats returns issue statistic information for dashboard by given conditions.
type IssueStatsOptions ¶
type IssueUser ¶
type IssueUser struct { ID int64 `xorm:"pk autoincr"` UID int64 `xorm:"INDEX"` // User ID. IssueID int64 RepoID int64 `xorm:"INDEX"` MilestoneID int64 IsRead bool IsAssigned bool IsMentioned bool IsPoster bool IsClosed bool }
IssueUser represents an issue-user relation.
func GetIssueUserPairsByMode ¶
func GetIssueUserPairsByMode(uid, rid int64, isClosed bool, page, filterMode int) ([]*IssueUser, error)
GetIssueUserPairsByMode returns issue-user pairs by given repository and user.
func GetIssueUserPairsByRepoIds ¶
GetIssueUserPairsByRepoIds returns issue-user pairs by given repository IDs.
type IssuesOptions ¶
type LDAPConfig ¶
func (*LDAPConfig) FromDB ¶
func (cfg *LDAPConfig) FromDB(bs []byte) error
func (*LDAPConfig) SecurityProtocolName ¶
func (cfg *LDAPConfig) SecurityProtocolName() string
func (*LDAPConfig) ToDB ¶
func (cfg *LDAPConfig) ToDB() ([]byte, error)
type Label ¶
type Label struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` Name string Color string `xorm:"VARCHAR(7)"` NumIssues int NumClosedIssues int NumOpenIssues int `xorm:"-"` IsChecked bool `xorm:"-"` }
Label represents a label of repository for issues.
func GetLabelByID ¶
GetLabelByID returns a label by given ID.
func GetLabelInRepoByID ¶
GetLabelInRepoByID returns a label by ID in given repository.
func GetLabelsByIssueID ¶
GetLabelsByIssueID returns all labels that belong to given issue by ID.
func GetLabelsByRepoID ¶
GetLabelsByRepoID returns all labels that belong to given repository by ID.
func GetLabelsInRepoByIDs ¶
GetLabelsInRepoByIDs returns a list of labels by IDs in given repository, it silently ignores label IDs that are not belong to the repository.
func (*Label) CalOpenIssues ¶
func (label *Label) CalOpenIssues()
CalOpenIssues calculates the open issues of label.
func (*Label) ForegroundColor ¶
ForegroundColor calculates the text color for labels based on their background color.
type LoginSource ¶
type LoginSource struct { ID int64 `xorm:"pk autoincr"` Type LoginType Name string `xorm:"UNIQUE"` IsActived bool `xorm:"NOT NULL DEFAULT false"` Cfg core.Conversion `xorm:"TEXT"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 }
LoginSource represents an external way for authorizing users.
func GetLoginSourceByID ¶
func GetLoginSourceByID(id int64) (*LoginSource, error)
GetLoginSourceByID returns login source by given ID.
func LoginSources ¶
func LoginSources() ([]*LoginSource, error)
func (*LoginSource) BeforeInsert ¶
func (s *LoginSource) BeforeInsert()
func (*LoginSource) BeforeUpdate ¶
func (s *LoginSource) BeforeUpdate()
func (*LoginSource) HasTLS ¶
func (source *LoginSource) HasTLS() bool
func (*LoginSource) IsDLDAP ¶
func (source *LoginSource) IsDLDAP() bool
func (*LoginSource) IsLDAP ¶
func (source *LoginSource) IsLDAP() bool
func (*LoginSource) IsPAM ¶
func (source *LoginSource) IsPAM() bool
func (*LoginSource) IsSMTP ¶
func (source *LoginSource) IsSMTP() bool
func (*LoginSource) LDAP ¶
func (source *LoginSource) LDAP() *LDAPConfig
func (*LoginSource) PAM ¶
func (source *LoginSource) PAM() *PAMConfig
func (*LoginSource) SMTP ¶
func (source *LoginSource) SMTP() *SMTPConfig
func (*LoginSource) SkipVerify ¶
func (source *LoginSource) SkipVerify() bool
func (*LoginSource) TypeName ¶
func (source *LoginSource) TypeName() string
func (*LoginSource) UseTLS ¶
func (source *LoginSource) UseTLS() bool
type MailRender ¶
type MigrateRepoOptions ¶
type Milestone ¶
type Milestone struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` Name string Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` IsClosed bool NumIssues int NumClosedIssues int NumOpenIssues int `xorm:"-"` Completeness int // Percentage(1-100). IsOverDue bool `xorm:"-"` DeadlineString string `xorm:"-"` Deadline time.Time `xorm:"-"` DeadlineUnix int64 ClosedDate time.Time `xorm:"-"` ClosedDateUnix int64 }
Milestone represents a milestone of repository.
func GetMilestoneByRepoID ¶
GetWebhookByRepoID returns the milestone in a repository.
func GetMilestones ¶
GetMilestones returns a list of milestones of given repository and status.
func GetMilestonesByRepoID ¶
GetMilestonesByRepoID returns all milestones of a repository.
func (*Milestone) BeforeInsert ¶
func (m *Milestone) BeforeInsert()
func (*Milestone) BeforeUpdate ¶
func (m *Milestone) BeforeUpdate()
type Mirror ¶
type Mirror struct { ID int64 `xorm:"pk autoincr"` RepoID int64 Repo *Repository `xorm:"-"` Interval int // Hour. EnablePrune bool `xorm:"NOT NULL DEFAULT true"` Updated time.Time `xorm:"-"` UpdatedUnix int64 NextUpdate time.Time `xorm:"-"` NextUpdateUnix int64 // contains filtered or unexported fields }
Mirror represents mirror information of a repository.
func GetMirrorByRepoID ¶
GetMirrorByRepoID returns mirror information of a repository.
func (*Mirror) Address ¶
Address returns mirror address from Git repository config without credentials.
func (*Mirror) BeforeInsert ¶
func (m *Mirror) BeforeInsert()
func (*Mirror) BeforeUpdate ¶
func (m *Mirror) BeforeUpdate()
func (*Mirror) FullAddress ¶
FullAddress returns mirror address from Git repository config.
func (*Mirror) SaveAddress ¶
SaveAddress writes new address to Git repository config.
func (*Mirror) ScheduleNextUpdate ¶
func (m *Mirror) ScheduleNextUpdate()
ScheduleNextUpdate calculates and sets next update time.
type MirrorRepositoryList ¶
type MirrorRepositoryList []*Repository
func (MirrorRepositoryList) LoadAttributes ¶
func (repos MirrorRepositoryList) LoadAttributes() error
type NewIssueOptions ¶
type NewIssueOptions struct { Repo *Repository Issue *Issue LableIDs []int64 Attachments []string // In UUID format. IsPull bool }
type Notice ¶
type Notice struct { ID int64 `xorm:"pk autoincr"` Type NoticeType Description string `xorm:"TEXT"` Created time.Time `xorm:"-"` CreatedUnix int64 }
Notice represents a system notice for admin.
func (*Notice) BeforeInsert ¶
func (n *Notice) BeforeInsert()
type OrgUser ¶
type OrgUser struct { ID int64 `xorm:"pk autoincr"` Uid int64 `xorm:"INDEX UNIQUE(s)"` OrgID int64 `xorm:"INDEX UNIQUE(s)"` IsPublic bool IsOwner bool NumTeams int }
OrgUser represents an organization-user relation.
func GetOrgUsersByOrgID ¶
GetOrgUsersByOrgID returns all organization-user relations by organization ID.
type PublicKey ¶
type PublicKey struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"INDEX NOT NULL"` Name string `xorm:"NOT NULL"` Fingerprint string `xorm:"NOT NULL"` Content string `xorm:"TEXT NOT NULL"` Mode AccessMode `xorm:"NOT NULL DEFAULT 2"` Type KeyType `xorm:"NOT NULL DEFAULT 1"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` // Note: Updated must below Created for AfterSet. UpdatedUnix int64 HasRecentActivity bool `xorm:"-"` HasUsed bool `xorm:"-"` }
PublicKey represents a user or deploy SSH public key.
func AddPublicKey ¶
AddPublicKey adds new public key to database and authorized_keys file.
func GetPublicKeyByID ¶
GetPublicKeyByID returns public key by given ID.
func ListPublicKeys ¶
ListPublicKeys returns a list of public keys belongs to given user.
func SearchPublicKeyByContent ¶
SearchPublicKeyByContent searches content as prefix (leak e-mail part) and returns public key found.
func (*PublicKey) AuthorizedString ¶
AuthorizedString returns formatted public key string for authorized_keys file.
func (*PublicKey) BeforeInsert ¶
func (k *PublicKey) BeforeInsert()
func (*PublicKey) BeforeUpdate ¶
func (k *PublicKey) BeforeUpdate()
type PullRequest ¶
type PullRequest struct { ID int64 `xorm:"pk autoincr"` Type PullRequestType Status PullRequestStatus IssueID int64 `xorm:"INDEX"` Issue *Issue `xorm:"-"` Index int64 HeadRepoID int64 HeadRepo *Repository `xorm:"-"` BaseRepoID int64 BaseRepo *Repository `xorm:"-"` HeadUserName string HeadBranch string BaseBranch string MergeBase string `xorm:"VARCHAR(40)"` HasMerged bool MergedCommitID string `xorm:"VARCHAR(40)"` MergerID int64 Merger *User `xorm:"-"` Merged time.Time `xorm:"-"` MergedUnix int64 }
PullRequest represents relation between pull request and repositories.
func GetPullRequestByID ¶
func GetPullRequestByID(id int64) (*PullRequest, error)
GetPullRequestByID returns a pull request by given ID.
func GetPullRequestByIssueID ¶
func GetPullRequestByIssueID(issueID int64) (*PullRequest, error)
GetPullRequestByIssueID returns pull request by given issue ID.
func GetUnmergedPullRequest ¶
func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error)
GetUnmergedPullRequest returnss a pull request that is open and has not been merged by given head/base and repo/branch.
func GetUnmergedPullRequestsByBaseInfo ¶
func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequest, error)
GetUnmergedPullRequestsByBaseInfo returnss all pull requests that are open and has not been merged by given base information (repo and branch).
func GetUnmergedPullRequestsByHeadInfo ¶
func GetUnmergedPullRequestsByHeadInfo(repoID int64, branch string) ([]*PullRequest, error)
GetUnmergedPullRequestsByHeadInfo returnss all pull requests that are open and has not been merged by given head information (repo and branch).
func (*PullRequest) APIFormat ¶
func (pr *PullRequest) APIFormat() *api.PullRequest
This method assumes following fields have been assigned with valid values: Required - Issue Optional - Merger
func (*PullRequest) AddToTaskQueue ¶
func (pr *PullRequest) AddToTaskQueue()
AddToTaskQueue adds itself to pull request test task queue.
func (*PullRequest) AfterSet ¶
func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell)
Note: don't try to get Issue because will end up recursive querying.
func (*PullRequest) BeforeUpdate ¶
func (pr *PullRequest) BeforeUpdate()
func (*PullRequest) CanAutoMerge ¶
func (pr *PullRequest) CanAutoMerge() bool
CanAutoMerge returns true if this pull request can be merged automatically.
func (*PullRequest) GetBaseRepo ¶
func (pr *PullRequest) GetBaseRepo() (err error)
func (*PullRequest) GetHeadRepo ¶
func (pr *PullRequest) GetHeadRepo() error
func (*PullRequest) IsChecking ¶
func (pr *PullRequest) IsChecking() bool
IsChecking returns true if this pull request is still checking conflict.
func (*PullRequest) LoadAttributes ¶
func (pr *PullRequest) LoadAttributes() error
func (*PullRequest) LoadIssue ¶
func (pr *PullRequest) LoadIssue() (err error)
func (*PullRequest) Merge ¶
func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error)
Merge merges pull request to base repository. FIXME: add repoWorkingPull make sure two merges does not happen at same time.
func (*PullRequest) PushToBaseRepo ¶
func (pr *PullRequest) PushToBaseRepo() (err error)
PushToBaseRepo pushes commits from branches of head repository to corresponding branches of base repository. FIXME: Only push branches that are actually updates?
func (*PullRequest) Update ¶
func (pr *PullRequest) Update() error
Update updates all fields of pull request.
func (*PullRequest) UpdateCols ¶
func (pr *PullRequest) UpdateCols(cols ...string) error
Update updates specific fields of pull request.
func (*PullRequest) UpdatePatch ¶
func (pr *PullRequest) UpdatePatch() (err error)
UpdatePatch generates and saves a new patch.
type PullRequestList ¶
type PullRequestList []*PullRequest
func (PullRequestList) LoadAttributes ¶
func (prs PullRequestList) LoadAttributes() error
type PullRequestStatus ¶
type PullRequestStatus int
const ( PULL_REQUEST_STATUS_CONFLICT PullRequestStatus = iota PULL_REQUEST_STATUS_CHECKING PULL_REQUEST_STATUS_MERGEABLE )
type PullRequestType ¶
type PullRequestType int
const ( PULL_REQUEST_GOGS PullRequestType = iota PLLL_ERQUEST_GIT )
type PushCommit ¶
type PushCommit struct { Sha1 string Message string AuthorEmail string AuthorName string CommitterEmail string CommitterName string Timestamp time.Time }
func CommitToPushCommit ¶
func CommitToPushCommit(commit *git.Commit) *PushCommit
CommitToPushCommit transforms a git.Commit to PushCommit type.
type PushCommits ¶
type PushCommits struct { Len int Commits []*PushCommit CompareURL string // contains filtered or unexported fields }
func ListToPushCommits ¶
func ListToPushCommits(l *list.List) *PushCommits
func NewPushCommits ¶
func NewPushCommits() *PushCommits
func (*PushCommits) AvatarLink ¶
func (push *PushCommits) AvatarLink(email string) string
AvatarLink tries to match user in database with e-mail in order to show custom avatar, and falls back to general avatar link.
func (*PushCommits) ToApiPayloadCommits ¶
func (pc *PushCommits) ToApiPayloadCommits(repoLink string) []*api.PayloadCommit
type PushUpdateOptions ¶
type RawDiffType ¶
type RawDiffType string
const ( RAW_DIFF_NORMAL RawDiffType = "diff" RAW_DIFF_PATCH RawDiffType = "patch" )
type Release ¶
type Release struct { ID int64 `xorm:"pk autoincr"` RepoID int64 PublisherID int64 Publisher *User `xorm:"-"` TagName string LowerTagName string Target string Title string Sha1 string `xorm:"VARCHAR(40)"` NumCommits int64 NumCommitsBehind int64 `xorm:"-"` Note string `xorm:"TEXT"` IsDraft bool `xorm:"NOT NULL DEFAULT false"` IsPrerelease bool Created time.Time `xorm:"-"` CreatedUnix int64 }
Release represents a release of repository.
func GetRelease ¶
GetRelease returns release by given ID.
func GetReleaseByID ¶
GetReleaseByID returns release with given ID.
func GetReleasesByRepoID ¶
GetReleasesByRepoID returns a list of releases of repository.
func (*Release) BeforeInsert ¶
func (r *Release) BeforeInsert()
type ReleaseSorter ¶
type ReleaseSorter struct {
// contains filtered or unexported fields
}
func (*ReleaseSorter) Len ¶
func (rs *ReleaseSorter) Len() int
func (*ReleaseSorter) Less ¶
func (rs *ReleaseSorter) Less(i, j int) bool
func (*ReleaseSorter) Swap ¶
func (rs *ReleaseSorter) Swap(i, j int)
type Repository ¶
type Repository struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s)"` Owner *User `xorm:"-"` LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"` Name string `xorm:"INDEX NOT NULL"` Description string Website string DefaultBranch string NumWatches int NumStars int NumForks int NumIssues int NumClosedIssues int NumOpenIssues int `xorm:"-"` NumPulls int NumClosedPulls int NumOpenPulls int `xorm:"-"` NumMilestones int `xorm:"NOT NULL DEFAULT 0"` NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"` NumOpenMilestones int `xorm:"-"` NumTags int `xorm:"-"` IsPrivate bool IsBare bool IsMirror bool *Mirror `xorm:"-"` // Advanced settings EnableWiki bool `xorm:"NOT NULL DEFAULT true"` EnableExternalWiki bool ExternalWikiURL string EnableIssues bool `xorm:"NOT NULL DEFAULT true"` EnableExternalTracker bool ExternalTrackerFormat string ExternalTrackerStyle string ExternalMetas map[string]string `xorm:"-"` EnablePulls bool `xorm:"NOT NULL DEFAULT true"` IsFork bool `xorm:"NOT NULL DEFAULT false"` ForkID int64 BaseRepo *Repository `xorm:"-"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 }
Repository represents a git repository.
func CleanUpMigrateInfo ¶
func CleanUpMigrateInfo(repo *Repository) (*Repository, error)
Finish migrating repository and/or wiki with things that don't need to be done for mirrors.
func CreateRepository ¶
func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error)
CreateRepository creates a repository for given user or organization.
func ForkRepository ¶
func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)
func GetRecentUpdatedRepositories ¶
func GetRecentUpdatedRepositories(page, pageSize int) (repos []*Repository, err error)
GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
func GetRepositoriesByForkID ¶
func GetRepositoriesByForkID(forkID int64) ([]*Repository, error)
GetRepositoriesByForkID returns all repositories with given fork ID.
func GetRepositoryByID ¶
func GetRepositoryByID(id int64) (*Repository, error)
GetRepositoryByID returns the repository by given id if exists.
func GetRepositoryByName ¶
func GetRepositoryByName(ownerID int64, name string) (*Repository, error)
GetRepositoryByName returns the repository by given name under user if exists.
func GetRepositoryByRef ¶
func GetRepositoryByRef(ref string) (*Repository, error)
GetRepositoryByRef returns a Repository specified by a GFM reference. See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
func GetUserMirrorRepositories ¶
func GetUserMirrorRepositories(userID int64) ([]*Repository, error)
GetUserRepositories returns a list of mirror repositories of given user.
func GetUserRepositories ¶
func GetUserRepositories(userID int64, private bool, page, pageSize int) ([]*Repository, error)
GetUserRepositories returns a list of repositories of given user.
func HasForkedRepo ¶
func HasForkedRepo(ownerID, repoID int64) (*Repository, bool)
HasForkedRepo checks if given user has already forked a repository with given ID.
func MigrateRepository ¶
func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error)
MigrateRepository migrates a existing repository from other project hosting.
func Repositories ¶
func Repositories(page, pageSize int) (_ []*Repository, err error)
func RepositoriesWithUsers ¶
func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error)
RepositoriesWithUsers returns number of repos in given page.
func SearchRepositoryByName ¶
func SearchRepositoryByName(opts *SearchRepoOptions) (repos []*Repository, _ int64, _ error)
SearchRepositoryByName takes keyword and part of repository name to search, it returns results in given range and number of total results.
func (*Repository) APIFormat ¶
func (repo *Repository) APIFormat(permission *api.Permission) *api.Repository
Arguments that are allowed to be nil: permission
func (*Repository) AddCollaborator ¶
func (repo *Repository) AddCollaborator(u *User) error
AddCollaborator adds new collaboration to a repository with default access mode.
func (*Repository) AddWikiPage ¶
func (repo *Repository) AddWikiPage(doer *User, title, content, message string) error
func (*Repository) AllowsPulls ¶
func (repo *Repository) AllowsPulls() bool
AllowPulls returns true if repository meets the requirements of accepting pulls and has them enabled.
func (*Repository) BeforeInsert ¶
func (repo *Repository) BeforeInsert()
func (*Repository) BeforeUpdate ¶
func (repo *Repository) BeforeUpdate()
func (*Repository) CanBeForked ¶
func (repo *Repository) CanBeForked() bool
CanBeForked returns true if repository meets the requirements of being forked.
func (*Repository) CanEnableEditor ¶
func (repo *Repository) CanEnableEditor() bool
CanEnableEditor returns true if repository meets the requirements of web editor.
func (*Repository) CanEnablePulls ¶
func (repo *Repository) CanEnablePulls() bool
CanEnablePulls returns true if repository meets the requirements of accepting pulls.
func (*Repository) ChangeCollaborationAccessMode ¶
func (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode) error
ChangeCollaborationAccessMode sets new access mode for the collaboration.
func (*Repository) CheckoutNewBranch ¶
func (repo *Repository) CheckoutNewBranch(oldBranch, newBranch string) error
func (*Repository) CloneLink ¶
func (repo *Repository) CloneLink() (cl *CloneLink)
CloneLink returns clone URLs of repository.
func (*Repository) ComposeCompareURL ¶
func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string
func (*Repository) ComposeMetas ¶
func (repo *Repository) ComposeMetas() map[string]string
ComposeMetas composes a map of metas for rendering external issue tracker URL.
func (*Repository) CreateNewBranch ¶
func (repo *Repository) CreateNewBranch(doer *User, oldBranchName, branchName string) (err error)
func (*Repository) DeleteCollaboration ¶
func (repo *Repository) DeleteCollaboration(uid int64) (err error)
DeleteCollaboration removes collaboration relation between the user and repository.
func (*Repository) DeleteRepoFile ¶
func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (err error)
func (*Repository) DeleteWiki ¶
func (repo *Repository) DeleteWiki()
DeleteWiki removes the actual and local copy of repository wiki.
func (*Repository) DeleteWikiPage ¶
func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error)
func (*Repository) DescriptionHtml ¶
func (repo *Repository) DescriptionHtml() template.HTML
DescriptionHtml does special handles to description and return HTML string.
func (*Repository) DiscardLocalRepoBranchChanges ¶
func (repo *Repository) DiscardLocalRepoBranchChanges(branch string) error
func (*Repository) EditWikiPage ¶
func (repo *Repository) EditWikiPage(doer *User, oldTitle, title, content, message string) error
func (*Repository) FullName ¶
func (repo *Repository) FullName() string
func (*Repository) GetAssigneeByID ¶
func (repo *Repository) GetAssigneeByID(userID int64) (*User, error)
GetAssigneeByID returns the user that has write access of repository by given ID.
func (*Repository) GetAssignees ¶
func (repo *Repository) GetAssignees() (_ []*User, err error)
GetAssignees returns all users that have write access and can be assigned to issues of the repository,
func (*Repository) GetBaseRepo ¶
func (repo *Repository) GetBaseRepo() (err error)
func (*Repository) GetBranches ¶
func (repo *Repository) GetBranches() ([]*Branch, error)
func (*Repository) GetCollaborators ¶
func (repo *Repository) GetCollaborators() ([]*Collaborator, error)
GetCollaborators returns the collaborators for a repository
func (*Repository) GetDiffPreview ¶
func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *Diff, err error)
GetDiffPreview produces and returns diff result of a file which is not yet committed.
func (*Repository) GetForks ¶
func (repo *Repository) GetForks() ([]*Repository, error)
func (*Repository) GetMilestoneByID ¶
func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)
GetMilestoneByID returns the milestone belongs to repository by given ID.
func (*Repository) GetMirror ¶
func (repo *Repository) GetMirror() (err error)
func (*Repository) GetOwner ¶
func (repo *Repository) GetOwner() error
func (*Repository) GetStargazers ¶
func (repo *Repository) GetStargazers(page int) ([]*User, error)
func (*Repository) GetWatchers ¶
func (repo *Repository) GetWatchers(page int) ([]*User, error)
Repository.GetWatchers returns range of users watching given repository.
func (*Repository) GitConfigPath ¶
func (repo *Repository) GitConfigPath() string
func (*Repository) HTMLURL ¶
func (repo *Repository) HTMLURL() string
func (*Repository) HasAccess ¶
func (repo *Repository) HasAccess(u *User) bool
func (*Repository) HasWiki ¶
func (repo *Repository) HasWiki() bool
HasWiki returns true if repository has wiki.
func (*Repository) InitWiki ¶
func (repo *Repository) InitWiki() error
InitWiki initializes a wiki for repository, it does nothing when repository already has wiki.
func (*Repository) IsOwnedBy ¶
func (repo *Repository) IsOwnedBy(userID int64) bool
func (*Repository) IssueStats ¶
IssueStats returns number of open and closed repository issues by given filter mode.
func (*Repository) Link ¶
func (repo *Repository) Link() string
func (*Repository) LocalCopyPath ¶
func (repo *Repository) LocalCopyPath() string
func (*Repository) LocalWikiPath ¶
func (repo *Repository) LocalWikiPath() string
func (*Repository) MustOwner ¶
func (repo *Repository) MustOwner() *User
MustOwner always returns a valid *User object to avoid conceptually impossible error handling. It creates a fake object that contains error deftail when error occurs.
func (*Repository) NextIssueIndex ¶
func (repo *Repository) NextIssueIndex() int64
FIXME: should have a mutex to prevent producing same index for two issues that are created closely enough.
func (*Repository) PatchPath ¶
func (repo *Repository) PatchPath(index int64) (string, error)
PatchPath returns corresponding patch file path of repository by given issue ID.
func (*Repository) RecalculateAccesses ¶
func (r *Repository) RecalculateAccesses() error
RecalculateAccesses recalculates all accesses for repository.
func (*Repository) RelLink ¶
func (repo *Repository) RelLink() string
func (*Repository) RepoPath ¶
func (repo *Repository) RepoPath() string
func (*Repository) SavePatch ¶
func (repo *Repository) SavePatch(index int64, patch []byte) error
SavePatch saves patch data to corresponding location by given issue ID.
func (*Repository) UpdateLocalCopyBranch ¶
func (repo *Repository) UpdateLocalCopyBranch(branch string) error
UpdateLocalCopyBranch makes sure local copy of repository in given branch is up-to-date.
func (*Repository) UpdateLocalWiki ¶
func (repo *Repository) UpdateLocalWiki() error
UpdateLocalWiki makes sure the local copy of repository wiki is up-to-date.
func (*Repository) UpdateRepoFile ¶
func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (err error)
UpdateRepoFile adds or updates a file in repository.
func (*Repository) UploadRepoFiles ¶
func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) (err error)
func (*Repository) WikiCloneLink ¶
func (repo *Repository) WikiCloneLink() (cl *CloneLink)
WikiCloneLink returns clone URLs of repository wiki.
func (*Repository) WikiPath ¶
func (repo *Repository) WikiPath() string
type RepositoryList ¶
type RepositoryList []*Repository
func (RepositoryList) LoadAttributes ¶
func (repos RepositoryList) LoadAttributes() error
type SMTPConfig ¶
type SMTPConfig struct { Auth string Host string Port int AllowedDomains string `xorm:"TEXT"` TLS bool SkipVerify bool }
func (*SMTPConfig) FromDB ¶
func (cfg *SMTPConfig) FromDB(bs []byte) error
func (*SMTPConfig) ToDB ¶
func (cfg *SMTPConfig) ToDB() ([]byte, error)
type SearchRepoOptions ¶
type SearchUserOptions ¶
type SlackAttachment ¶
type SlackPayload ¶
type SlackPayload struct { Channel string `json:"channel"` Text string `json:"text"` Username string `json:"username"` IconURL string `json:"icon_url"` UnfurlLinks int `json:"unfurl_links"` LinkNames int `json:"link_names"` Attachments []SlackAttachment `json:"attachments"` }
func GetSlackPayload ¶
func GetSlackPayload(p api.Payloader, event HookEventType, meta string) (*SlackPayload, error)
func (*SlackPayload) JSONPayload ¶
func (p *SlackPayload) JSONPayload() ([]byte, error)
func (*SlackPayload) SetSecret ¶
func (p *SlackPayload) SetSecret(_ string)
type Statistic ¶
type Statistic struct { Counter struct { User, Org, PublicKey, Repo, Watch, Star, Action, Access, Issue, Comment, Oauth, Follow, Mirror, Release, LoginSource, Webhook, Milestone, Label, HookTask, Team, UpdateTask, Attachment int64 } }
func GetStatistic ¶
func GetStatistic() (stats Statistic)
type Team ¶
type Team struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` LowerName string Name string Description string Authorize AccessMode Repos []*Repository `xorm:"-"` Members []*User `xorm:"-"` NumRepos int NumMembers int }
Team represents a organization team.
func GetTeamByID ¶
GetTeamByID returns team by given ID.
func GetUserTeams ¶
GetUserTeams returns all teams that user belongs to in given organization.
func (*Team) AddMember ¶
AddMember adds new membership of the team to the organization, the user will have membership to the organization automatically when needed.
func (*Team) AddRepository ¶
func (t *Team) AddRepository(repo *Repository) (err error)
AddRepository adds new repository to team of organization.
func (*Team) GetMembers ¶
GetMembers returns all members in team of organization.
func (*Team) GetRepositories ¶
GetRepositories returns all repositories in team of organization.
func (*Team) HasRepository ¶
HasRepository returns true if given repository belong to team.
func (*Team) IsOwnerTeam ¶
IsOwnerTeam returns true if team is owner team.
func (*Team) RemoveMember ¶
RemoveMember removes member from team of organization.
func (*Team) RemoveRepository ¶
RemoveRepository removes repository from team of organization.
type TeamRepo ¶
type TeamRepo struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` TeamID int64 `xorm:"UNIQUE(s)"` RepoID int64 `xorm:"UNIQUE(s)"` }
TeamRepo represents an team-repository relation.
type TeamUser ¶
type TeamUser struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` TeamID int64 `xorm:"UNIQUE(s)"` Uid int64 `xorm:"UNIQUE(s)"` }
TeamUser represents an team-user relation.
type UpdateRepoFileOptions ¶
type UpdateTask ¶
type UpdateTask struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"index"` RefName string OldCommitID string NewCommitID string }
func GetUpdateTaskByUUID ¶
func GetUpdateTaskByUUID(uuid string) (*UpdateTask, error)
GetUpdateTaskByUUID returns update task by given UUID.
type Upload ¶
Upload represent a uploaded file to a repo to be deleted when moved
func GetUploadByUUID ¶
func GetUploadsByUUIDs ¶
type UploadRepoFileOptions ¶
type User ¶
type User struct { ID int64 `xorm:"pk autoincr"` LowerName string `xorm:"UNIQUE NOT NULL"` Name string `xorm:"UNIQUE NOT NULL"` FullName string // Email is the primary email address (to be used for communication) Email string `xorm:"NOT NULL"` Passwd string `xorm:"NOT NULL"` LoginType LoginType LoginSource int64 `xorm:"NOT NULL DEFAULT 0"` LoginName string Type UserType OwnedOrgs []*User `xorm:"-"` Orgs []*User `xorm:"-"` Repos []*Repository `xorm:"-"` Location string Website string Rands string `xorm:"VARCHAR(10)"` Salt string `xorm:"VARCHAR(10)"` Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 // Remember visibility choice for convenience, true for private LastRepoVisibility bool // Maximum repository creation limit, -1 means use gloabl default MaxRepoCreation int `xorm:"NOT NULL DEFAULT -1"` // Permissions IsActive bool // Activate primary email IsAdmin bool AllowGitHook bool AllowImportLocal bool // Allow migrate repository by local path ProhibitLogin bool // Avatar Avatar string `xorm:"VARCHAR(2048) NOT NULL"` AvatarEmail string `xorm:"NOT NULL"` UseCustomAvatar bool // Counters NumFollowers int NumFollowing int `xorm:"NOT NULL DEFAULT 0"` NumStars int NumRepos int // For organization Description string NumTeams int NumMembers int Teams []*Team `xorm:"-"` Members []*User `xorm:"-"` }
User represents the object of individual and member of organization.
func ExternalUserLogin ¶
func GetAssigneeByID ¶
func GetAssigneeByID(repo *Repository, userID int64) (*User, error)
GetAssigneeByID returns the user with write access of repository by given ID.
func GetOrgByName ¶
GetOrgByName returns organization by given name.
func GetOrgsByUserID ¶
GetOrgsByUserID returns a list of organizations that the given user ID has joined.
func GetOrgsByUserIDDesc ¶
GetOrgsByUserIDDesc returns a list of organizations that the given user ID has joined, ordered descending by the given condition.
func GetOwnedOrgsByUserID ¶
GetOwnedOrgsByUserID returns a list of organizations are owned by given user ID.
func GetOwnedOrgsByUserIDDesc ¶
GetOwnedOrganizationsByUserIDDesc returns a list of organizations are owned by given user ID, ordered descending by the given condition.
func GetTeamMembers ¶
GetTeamMembers returns all members in given team of organization.
func GetUserByEmail ¶
GetUserByEmail returns the user object by given e-mail if exists.
func GetUserByID ¶
GetUserByID returns the user object by given ID if exists.
func GetUserByKeyID ¶
func GetUserByName ¶
GetUserByName returns user by given name.
func LoginViaLDAP ¶
func LoginViaLDAP(user *User, login, passowrd string, source *LoginSource, autoRegister bool) (*User, error)
LoginViaLDAP queries if login/password is valid against the LDAP directory pool, and create a local user if success when enabled.
func LoginViaPAM ¶
func LoginViaPAM(user *User, login, password string, sourceID int64, cfg *PAMConfig, autoRegister bool) (*User, error)
LoginViaPAM queries if login/password is valid against the PAM, and create a local user if success when enabled.
func LoginViaSMTP ¶
func LoginViaSMTP(user *User, login, password string, sourceID int64, cfg *SMTPConfig, autoRegister bool) (*User, error)
LoginViaSMTP queries if login/password is valid against the SMTP, and create a local user if success when enabled.
func NewGhostUser ¶
func NewGhostUser() *User
NewGhostUser creates and returns a fake user for someone has deleted his/her account.
func Organizations ¶
Organizations returns number of organizations in given page.
func SearchUserByName ¶
func SearchUserByName(opts *SearchUserOptions) (users []*User, _ int64, _ error)
SearchUserByName takes keyword and part of user name to search, it returns results in given range and number of total results.
func UserSignIn ¶
UserSignIn validates user name and password.
func ValidateCommitWithEmail ¶
func ValidateCommitWithEmail(c *git.Commit) *User
ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user.
func VerifyUserActiveCode ¶
verify active code when active account
func (*User) AvatarLink ¶
AvatarLink returns user avatar absolute link.
func (*User) BeforeInsert ¶
func (u *User) BeforeInsert()
func (*User) BeforeUpdate ¶
func (u *User) BeforeUpdate()
func (*User) CanCreateRepo ¶
func (*User) CanEditGitHook ¶
CanEditGitHook returns true if user can edit Git hooks.
func (*User) CanImportLocal ¶
CanImportLocal returns true if user can migrate repository by local path.
func (*User) CustomAvatarPath ¶
CustomAvatarPath returns user custom avatar file path.
func (*User) DashboardLink ¶
DashboardLink returns the user dashboard page link.
func (*User) DeleteAvatar ¶
DeleteAvatar deletes the user's custom avatar.
func (*User) DisplayName ¶
DisplayName returns full name if it's not empty, returns username otherwise.
func (*User) EncodePasswd ¶
func (u *User) EncodePasswd()
EncodePasswd encodes password to safe format.
func (*User) GenerateActivateCode ¶
GenerateActivateCode generates an activate code based on user information.
func (*User) GenerateEmailActivateCode ¶
GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
func (*User) GenerateRandomAvatar ¶
GenerateRandomAvatar generates a random avatar for user.
func (*User) GetAccessibleRepositories ¶
func (user *User) GetAccessibleRepositories(limit int) (repos []*Repository, _ error)
GetAccessibleRepositories finds repositories which the user has access but does not own. If limit is smaller than 1 means returns all found results.
func (*User) GetFollowers ¶
User.GetFollwoers returns range of user's followers.
func (*User) GetFollowing ¶
GetFollowing returns range of user's following.
func (*User) GetMembers ¶
GetMembers returns all members of organization.
func (*User) GetMirrorRepositories ¶
func (u *User) GetMirrorRepositories() ([]*Repository, error)
GetRepositories returns mirror repositories that user owns, including private repositories.
func (*User) GetOrganizationCount ¶
GetOrganizationCount returns count of membership of organization of user.
func (*User) GetOrganizations ¶
GetOrganizations returns all organizations that user belongs to.
func (*User) GetOwnedOrganizations ¶
GetOwnedOrganizations returns all organizations that user owns.
func (*User) GetOwnerTeam ¶
GetOwnerTeam returns owner team of organization.
func (*User) GetRepositories ¶
GetRepositories returns repositories that user owns, including private repositories.
func (*User) GetRepositoryAccesses ¶
func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error)
GetRepositoryAccesses finds all repositories with their access mode where a user has access but does not own.
func (*User) GetUserMirrorRepositories ¶
func (org *User) GetUserMirrorRepositories(userID int64) ([]*Repository, error)
GetUserRepositories returns mirror repositories of the organization that the user with the given userID has access to.
func (*User) GetUserRepositories ¶
func (org *User) GetUserRepositories(userID int64, page, pageSize int) ([]*Repository, int64, error)
GetUserRepositories returns a range of repositories in organization that the user with the given userID has access to, and total number of records based on given condition.
func (*User) GetUserTeamIDs ¶
GetUserTeamIDs returns of all team IDs of the organization that user is memeber of.
func (*User) GetUserTeams ¶
GetTeams returns all teams that belong to organization, and that the user has joined.
func (*User) HasForkedRepo ¶
HasForkedRepo checks if user has already forked a repository with given ID.
func (*User) IsAdminOfRepo ¶
func (u *User) IsAdminOfRepo(repo *Repository) bool
IsAdminOfRepo returns true if user has admin or higher access of repository.
func (*User) IsFollowing ¶
func (*User) IsOrgMember ¶
IsOrgMember returns true if given user is member of organization.
func (*User) IsOrganization ¶
IsOrganization returns true if user is actually a organization.
func (*User) IsPublicMember ¶
IsPublicMember returns true if user public his/her membership in give organization.
func (*User) IsUserOrgOwner ¶
IsUserOrgOwner returns true if user is in the owner team of given organization.
func (*User) IsWriterOfRepo ¶
func (u *User) IsWriterOfRepo(repo *Repository) bool
IsWriterOfRepo returns true if user has write access to given repository.
func (*User) NewGitSig ¶
func (u *User) NewGitSig() *git.Signature
NewGitSig generates and returns the signature of given user.
func (*User) RelAvatarLink ¶
RelAvatarLink returns relative avatar link to the site domain, which includes app sub-url as prefix. However, it is possible to return full URL if user enables Gravatar-like service.
func (*User) RemoveMember ¶
RemoveMember removes member from organization.
func (*User) RemoveOrgRepo ¶
RemoveOrgRepo removes all team-repository relations of organization.
func (*User) RepoCreationNum ¶
func (*User) UploadAvatar ¶
UploadAvatar saves custom avatar for user. FIXME: split uploads to different subdirs in case we have massive users.
func (*User) ValidatePassword ¶
ValidatePassword checks if given password matches the one belongs to the user.
type UserCommit ¶
type UserCommit struct { User *User *git.Commit }
UserCommit represents a commit with validation of user.
type Watch ¶
type Watch struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"UNIQUE(watch)"` RepoID int64 `xorm:"UNIQUE(watch)"` }
Watch is connection request for receiving repository notification.
func GetWatchers ¶
GetWatchers returns all watchers of given repository.
type Webhook ¶
type Webhook struct { ID int64 `xorm:"pk autoincr"` RepoID int64 OrgID int64 URL string `xorm:"url TEXT"` ContentType HookContentType Secret string `xorm:"TEXT"` Events string `xorm:"TEXT"` *HookEvent `xorm:"-"` IsSSL bool `xorm:"is_ssl"` IsActive bool HookTaskType HookTaskType Meta string `xorm:"TEXT"` // store hook-specific attributes LastStatus HookStatus // Last delivery status Created time.Time `xorm:"-"` CreatedUnix int64 Updated time.Time `xorm:"-"` UpdatedUnix int64 }
Webhook represents a web hook object.
func GetActiveWebhooksByOrgID ¶
GetActiveWebhooksByOrgID returns all active webhooks for an organization.
func GetActiveWebhooksByRepoID ¶
GetActiveWebhooksByRepoID returns all active webhooks of repository.
func GetWebhookByOrgID ¶
GetWebhookByOrgID returns webhook of organization by given ID.
func GetWebhookByRepoID ¶
GetWebhookByRepoID returns webhook of repository by given ID.
func GetWebhooksByOrgID ¶
GetWebhooksByOrgID returns all webhooks for an organization.
func GetWebhooksByRepoID ¶
GetWebhooksByRepoID returns all webhooks of a repository.
func (*Webhook) BeforeInsert ¶
func (w *Webhook) BeforeInsert()
func (*Webhook) BeforeUpdate ¶
func (w *Webhook) BeforeUpdate()
func (*Webhook) EventsArray ¶
func (*Webhook) GetSlackHook ¶
func (*Webhook) HasCreateEvent ¶
HasCreateEvent returns true if hook enabled create event.
func (*Webhook) HasPullRequestEvent ¶
HasPullRequestEvent returns true if hook enabled pull request event.
func (*Webhook) HasPushEvent ¶
HasPushEvent returns true if hook enabled push event.
func (*Webhook) UpdateEvent ¶
UpdateEvent handles conversion from HookEvent to Events.
Source Files ¶
- access.go
- action.go
- admin.go
- error.go
- git_diff.go
- issue.go
- issue_comment.go
- issue_label.go
- issue_mail.go
- login_source.go
- mail.go
- models.go
- org.go
- org_team.go
- pull.go
- release.go
- repo.go
- repo_branch.go
- repo_collaboration.go
- repo_editor.go
- repo_mirror.go
- ssh_key.go
- token.go
- update.go
- user.go
- user_mail.go
- webhook.go
- webhook_slack.go
- wiki.go