Documentation ¶
Index ¶
- Constants
- Variables
- func AddAssigneeIfNotAssigned(issue *Issue, doer *User, assigneeID int64) (err error)
- func AddDeletePRBranchComment(doer *User, repo *Repository, issueID int64, branchName string) error
- func AddEmailAddress(email *EmailAddress) error
- func AddEmailAddresses(emails []*EmailAddress) error
- func AddOrgUser(orgID, uid int64) error
- func AddTeamMember(team *Team, userID int64) error
- func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool)
- func AddUserOpenID(openid *UserOpenID) error
- func AssertCount(t testing.TB, bean interface{}, expected interface{})
- func AssertExistsAndLoadBean(t testing.TB, bean interface{}, conditions ...interface{}) interface{}
- func AssertExistsIf(t *testing.T, expected bool, bean interface{}, conditions ...interface{})
- func AssertInt64InRange(t testing.TB, low, high, value int64)
- func AssertNotExistsBean(t testing.TB, bean interface{}, conditions ...interface{})
- func AssertSuccessfulInsert(t testing.TB, beans ...interface{})
- func AttachmentLocalPath(uuid string) string
- func BeanExists(t testing.TB, bean interface{}, conditions ...interface{}) bool
- func CancelStopwatch(user *User, issue *Issue) error
- func Cell2Int64(val xorm.Cell) int64
- func ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (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 CheckConsistencyFor(t *testing.T, beansToCheck ...interface{})
- func CheckConsistencyForAll(t *testing.T)
- func CheckLFSAccessForRepo(u *User, repo *Repository, mode AccessMode) error
- func CheckPublicKeyString(content string) (_ string, err error)
- func CheckRepoStats()
- func CommentHashTag(id int64) string
- func CommitRepoAction(opts CommitRepoActionOptions) error
- func ComposeHTTPSCloneURL(owner, repo string) string
- func Cond(query interface{}, args ...interface{}) interface{}
- func CountIssuesByRepo(opts *IssuesOptions) (map[int64]int64, error)
- func CountLoginSources() int64
- func CountNotices() int64
- func CountOrganizations() int64
- func CountRepoClosedMilestones(repoID int64) (int64, error)
- func CountRepositories(private bool) int64
- func CountUserRepositories(userID int64, private bool) int64
- func CountUsers() int64
- func CreateHookTask(t *HookTask) error
- func CreateIssueDependency(user *User, issue, dep *Issue) error
- func CreateLoginSource(source *LoginSource) error
- func CreateNotice(tp NoticeType, desc string) error
- func CreateOrStopIssueStopwatch(user *User, issue *Issue) error
- func CreateOrUpdateIssueNotifications(issue *Issue, notificationAuthorID int64) error
- func CreateOrUpdateIssueWatch(userID, issueID int64, isWatching bool) 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, attachmentUUIDs []string) error
- func CreateRepositoryNotice(desc string) error
- func CreateUser(u *User) (err error)
- func CreateWebhook(w *Webhook) error
- func CutDiffAroundLine(originalDiff io.Reader, line int64, old bool, numbersOfLine int) string
- func DeleteAccessTokenByID(id, userID 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 DeleteComment(doer *User, comment *Comment) error
- func DeleteCommentReaction(doer *User, issue *Issue, comment *Comment, content string) error
- func DeleteDeployKey(doer *User, id int64) error
- func DeleteEmailAddress(email *EmailAddress) (err error)
- func DeleteEmailAddresses(emails []*EmailAddress) (err error)
- func DeleteGPGKey(doer *User, id int64) (err error)
- func DeleteInactivateUsers() (err error)
- func DeleteIssueLabel(issue *Issue, label *Label, doer *User) (err error)
- func DeleteIssueReaction(doer *User, issue *Issue, content string) error
- func DeleteLabel(repoID, labelID int64) error
- func DeleteMilestoneByRepoID(repoID, id int64) error
- func DeleteMirrorByRepoID(repoID int64) error
- func DeleteMissingRepositories(doer *User) error
- func DeleteNotPassedAssignee(issue *Issue, doer *User, assignees []*User) (err error)
- func DeleteNotice(id int64) error
- func DeleteNotices(start, end int64) error
- func DeleteNoticesByIDs(ids []int64) error
- func DeleteOldRepositoryArchives()
- func DeleteOrganization(org *User) (err error)
- func DeletePublicKey(doer *User, id int64) (err error)
- func DeleteReaction(opts *ReactionOptions) error
- func DeleteRegistration(reg *U2FRegistration) error
- func DeleteReleaseByID(id int64, u *User, delTag bool) error
- func DeleteRepoFromIndexer(repo *Repository)
- func DeleteRepository(doer *User, uid, repoID int64) error
- func DeleteRepositoryArchives() error
- func DeleteSource(source *LoginSource) error
- func DeleteTeam(t *Team) error
- func DeleteTwoFactorByID(id, userID int64) error
- func DeleteUpload(u *Upload) error
- func DeleteUploadByUUID(uuid string) error
- func DeleteUploads(uploads ...*Upload) (err error)
- func DeleteUser(u *User) (err error)
- func DeleteUserOpenID(openid *UserOpenID) (err error)
- func DeleteWebhookByOrgID(orgID, id int64) error
- func DeleteWebhookByRepoID(repoID, id int64) error
- func DeliverHooks()
- func DumpDatabase(filePath string, dbType string) error
- func FindUserAccessibleRepoIDs(userID int64) ([]int64, error)
- func FollowUser(userID, followID int64) (err error)
- func GetActiveOAuth2Providers() ([]string, map[string]OAuth2Provider, error)
- func GetCount(t testing.TB, bean interface{}, conditions ...interface{}) int
- func GetExternalLogin(externalLoginUser *ExternalLoginUser) (bool, error)
- func GetLabelTemplateFile(name string) ([][3]string, error)
- func GetNotificationCount(user *User, status NotificationStatus) (int64, error)
- func GetPrivateRepositoryCount(u *User) (int64, error)
- func GetPublicRepositoryCount(u *User) (int64, error)
- func GetRawDiff(repoPath, commitID string, diffType RawDiffType, writer io.Writer) error
- func GetRawDiffForFile(repoPath, startCommit, endCommit string, diffType RawDiffType, file string, ...) error
- func GetReleaseAttachments(rels ...*Release) (err error)
- func GetReleaseCountByRepoID(repoID int64, opts FindReleasesOptions) (int64, error)
- func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64)
- func GetRepositoriesMapByIDs(ids []int64) (map[int64]*Repository, error)
- func GetRepositoryCount(u *User) (int64, error)
- func GetUser(user *User) (bool, error)
- func GetUserEmailsByNames(names []string) []string
- func GetUserIDsByNames(names []string) []int64
- func GetUserSalt() (string, error)
- func GitConfigPath(repoPath string) string
- func GitFsck()
- func GitGcRepos() error
- func HasAccess(userID int64, 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 InitFixtures(helper testfixtures.Helper, dir string) (err error)
- func InitIssueIndexer()
- func InitMailRender(tmpls *template.Template)
- func InitOAuth2() error
- func InitRepoIndexer()
- 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 IsErrBranchAlreadyExists(err error) bool
- func IsErrBranchNameConflict(err error) bool
- func IsErrBranchNotExist(err error) bool
- func IsErrCircularDependency(err error) bool
- func IsErrCommentNotExist(err error) bool
- func IsErrDependenciesLeft(err error) bool
- func IsErrDependencyExists(err error) bool
- func IsErrDependencyNotExists(err error) bool
- func IsErrDeployKeyAlreadyExist(err error) bool
- func IsErrDeployKeyNameAlreadyUsed(err error) bool
- func IsErrDeployKeyNotExist(err error) bool
- func IsErrEmailAlreadyUsed(err error) bool
- func IsErrExternalLoginUserAlreadyExist(err error) bool
- func IsErrExternalLoginUserNotExist(err error) bool
- func IsErrGPGKeyAccessDenied(err error) bool
- func IsErrGPGKeyIDAlreadyUsed(err error) bool
- func IsErrGPGKeyNotExist(err error) bool
- func IsErrGPGKeyParsing(err error) bool
- func IsErrGPGNoEmailFound(err error) bool
- func IsErrInvalidCloneAddr(err error) bool
- func IsErrInvalidMergeStyle(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 IsErrLFSLockAlreadyExist(err error) bool
- func IsErrLFSLockNotExist(err error) bool
- func IsErrLFSUnauthorizedAction(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 IsErrNotAllowedToMerge(err error) bool
- func IsErrOpenIDAlreadyUsed(err error) bool
- func IsErrOpenIDConnectInitialize(err error) bool
- func IsErrOrgNotExist(err error) bool
- func IsErrPullRequestAlreadyExists(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 IsErrRepoRedirectNotExist(err error) bool
- func IsErrReviewNotExist(err error) bool
- func IsErrSSHDisabled(err error) bool
- func IsErrStopwatchNotExist(err error) bool
- func IsErrTagAlreadyExists(err error) bool
- func IsErrTeamAlreadyExist(err error) bool
- func IsErrTopicNotExist(err error) bool
- func IsErrTrackedTimeNotExist(err error) bool
- func IsErrTwoFactorNotEnrolled(err error) bool
- func IsErrU2FRegistrationNotExist(err error) bool
- func IsErrUnknownDependencyType(err error) bool
- func IsErrUpdateTaskNotExist(err error) bool
- func IsErrUploadNotExist(err error) bool
- func IsErrUserAlreadyExist(err error) bool
- func IsErrUserDoesNotHaveAccessToRepo(err error) bool
- func IsErrUserHasOrgs(err error) bool
- func IsErrUserNotAllowedCreateOrg(err error) bool
- func IsErrUserNotExist(err error) bool
- func IsErrUserOwnRepos(err error) bool
- func IsErrWebhookNotExist(err error) bool
- func IsErrWikiAlreadyExist(err error) bool
- func IsErrWikiInvalidFileName(err error) bool
- func IsErrWikiReservedName(err error) bool
- func IsFollowing(userID, followID int64) bool
- func IsOpenIDUsed(openid string) (bool, error)
- func IsOrganizationMember(orgID, uid int64) (bool, error)
- func IsOrganizationOwner(orgID, uid int64) (bool, error)
- func IsPublicMembership(orgID, uid int64) (bool, error)
- 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, userID int64) (bool, error)
- func IsUsableRepoName(name string) error
- func IsUsableTeamName(name string) error
- func IsUsableUsername(name string) error
- func IsUserAssignedToIssue(issue *Issue, user *User) (isAssigned bool, err error)
- func IsUserExist(uid int64, name string) (bool, error)
- func IsUserInTeams(userID int64, teamIDs []int64) (bool, error)
- func IsValidHookContentType(name string) bool
- func IsValidHookTaskType(name string) bool
- func IsWatching(userID, repoID int64) bool
- func IssueNoDependenciesLeft(issue *Issue) (bool, error)
- func LinkAccountToUser(user *User, gothUser goth.User) error
- func LoadConfigs()
- func LoadFixtures() error
- func LoadRepoConfig()
- func LocalCopyPath() string
- func LocalWikiPath() string
- func LookupRepoRedirect(ownerID int64, repoName string) (int64, error)
- func MainTest(m *testing.M, pathToGiteaRoot string)
- func MakeAssigneeList(issue *Issue) (assigneeList string, err error)
- func MakeEmailPrimary(email *EmailAddress) error
- func MakeIDsFromAPIAssigneesToAdd(oneAssignee string, multipleAssignees []string) (assigneeIDs []int64, err error)
- func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error
- func MilestoneStats(repoID int64) (open int64, closed int64, err error)
- func MirrorSyncCreateAction(repo *Repository, refName string) error
- func MirrorSyncDeleteAction(repo *Repository, refName string) error
- func MirrorSyncPushAction(repo *Repository, opts MirrorSyncPushActionOptions) error
- func MirrorUpdate()
- func NewAccessToken(t *AccessToken) error
- func NewCommitStatus(repo *Repository, creator *User, sha string, status *CommitStatus) error
- func NewEngine(migrateFunc func(*xorm.Engine) error) (err error)
- func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, assigneeIDs []int64, ...) (err error)
- func NewIssueLabel(issue *Issue, label *Label, doer *User) (err error)
- func NewIssueLabels(issue *Issue, labels []*Label, doer *User) (err error)
- func NewLabel(label *Label) 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 NewRepoRedirect(ownerID, repoID int64, oldRepoName, newRepoName string) error
- func NewTeam(t *Team) (err error)
- func NewTestEngine(x *xorm.Engine) (err error)
- func NewTwoFactor(t *TwoFactor) error
- func NormalizeWikiName(name string) string
- func NotifyWatchers(act *Action) error
- func ParseCommitsWithSignature(oldCommits *list.List) *list.List
- func ParseCommitsWithStatus(oldCommits *list.List, repo *Repository) *list.List
- func Ping() error
- func PrepareTestDatabase() error
- func PrepareTestEnv(t testing.TB)
- func PrepareWebhook(w *Webhook, repo *Repository, event HookEventType, p api.Payloader) error
- func PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error
- func PushUpdate(branch string, opt PushUpdateOptions) error
- func ReinitMissingRepositories() error
- func RemoveAccountLink(user *User, loginSourceID int64) (int64, error)
- func RemoveAllWithNotice(title, path string)
- func RemoveIssueDependency(user *User, issue *Issue, dep *Issue, depType DependencyType) (err error)
- func RemoveOldDeletedBranches()
- func RemoveOrgUser(orgID, userID int64) error
- func RemoveTeamMember(team *Team, userID int64) error
- func RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error
- func RepoPath(userName, repoName string) string
- func RewriteAllPublicKeys() error
- func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error
- func SSHKeyGenParsePublicKey(key string) (string, int, error)
- func SSHNativeParsePublicKey(keyLine string) (string, int, error)
- func SaveTopics(repoID int64, topicNames ...string) error
- func SecToTime(duration int64) string
- 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, content string, comment *Comment, tos []string)
- func SendIssueMentionMail(issue *Issue, doer *User, content string, comment *Comment, 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 SetNotificationStatus(notificationID int64, user *User, status NotificationStatus) error
- func SlackLinkFormatter(url string, text string) string
- func SlackLinkToRef(repoURL, ref string) string
- func SlackShortTextFormatter(s string) string
- func SlackTextFormatter(s string) string
- func SortReleases(rels []*Release)
- func StarRepo(userID, repoID int64, star bool) error
- func StopwatchExists(userID int64, issueID int64) bool
- func SyncExternalUsers()
- func SyncMirrors()
- func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error
- func SyncRepositoryHooks() error
- func TestPullRequests()
- func ToggleUserOpenIDVisibility(id int64) (err error)
- func TotalTimes(options FindTrackedTimesOptions) (map[*User]string, error)
- 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 UpdateAPIAssignee(issue *Issue, oneAssignee string, multipleAssignees []string, doer *User) (err error)
- func UpdateAccessToken(t *AccessToken) error
- func UpdateAssignee(issue *Issue, doer *User, assigneeID int64) (err error)
- func UpdateAttachment(atta *Attachment) error
- func UpdateComment(doer *User, c *Comment, oldContent string) error
- func UpdateDeployKey(key *DeployKey) error
- func UpdateDeployKeyCols(key *DeployKey, cols ...string) error
- func UpdateHookTask(t *HookTask) error
- func UpdateIssue(issue *Issue) error
- func UpdateIssueCols(issue *Issue, cols ...string) error
- func UpdateIssueDeadline(issue *Issue, deadlineUnix util.TimeStamp, doer *User) (err error)
- func UpdateIssueIndexer(issueID int64)
- func UpdateIssueIndexerCols(issueID int64, cols ...string)
- func UpdateIssueMentions(e Engine, issueID int64, mentions []string) error
- func UpdateIssueUserByRead(uid, issueID int64) error
- func UpdateIssueUsersByMentions(e Engine, issueID int64, uids []int64) 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 UpdateNotificationStatuses(user *User, currentStatus NotificationStatus, desiredStatus NotificationStatus) error
- func UpdateProtectBranch(repo *Repository, protectBranch *ProtectedBranch, ...) (err error)
- func UpdatePublicKeyUpdated(id int64) error
- func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachmentUUIDs []string) (err error)
- func UpdateRepoIndexer(repo *Repository)
- func UpdateRepository(repo *Repository, visibilityChanged bool) (err error)
- func UpdateRepositoryUnits(repo *Repository, units []RepoUnit) (err error)
- func UpdateReview(r *Review) error
- func UpdateSource(source *LoginSource) error
- func UpdateTeam(t *Team, authChanged bool) (err error)
- func UpdateTeamUnits(team *Team, units []TeamUnit) (err error)
- func UpdateTwoFactor(t *TwoFactor) error
- func UpdateUser(u *User) error
- func UpdateUserCols(u *User, cols ...string) error
- func UpdateUserSetting(u *User) error
- func UpdateWebhook(w *Webhook) error
- func UpdateWebhookLastStatus(w *Webhook) error
- func UploadLocalPath(uuid string) string
- func UserPath(userName string) string
- func ValidateCommitsWithEmails(oldCommits *list.List) *list.List
- func ValidateTopic(topic string) bool
- func WatchRepo(userID, repoID int64, watch bool) (err error)
- func WikiFilenameToName(filename string) (string, error)
- func WikiNameToFilename(name string) string
- func WikiNameToSubURL(name string) string
- func WikiPath(userName, repoName string) string
- type Access
- type AccessMode
- type AccessToken
- type AccessibleReposEnvironment
- type Action
- func (a *Action) GetActAvatar() string
- func (a *Action) GetActFullName() string
- func (a *Action) GetActUserName() string
- func (a *Action) GetBranch() string
- func (a *Action) GetCommentLink() string
- func (a *Action) GetContent() string
- func (a *Action) GetCreate() time.Time
- func (a *Action) GetIssueContent() string
- func (a *Action) GetIssueInfos() []string
- func (a *Action) GetIssueTitle() string
- func (a *Action) GetOpType() ActionType
- 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 ActionList
- type ActionType
- type ActivityStats
- func (stats *ActivityStats) ActiveIssueCount() int
- func (stats *ActivityStats) ActivePRCount() int
- func (stats *ActivityStats) ClosedIssueCount() int
- func (stats *ActivityStats) ClosedIssuePerc() int
- func (stats *ActivityStats) FillIssues(repoID int64, fromTime time.Time) error
- func (stats *ActivityStats) FillPullRequests(repoID int64, fromTime time.Time) error
- func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
- func (stats *ActivityStats) FillUnresolvedIssues(repoID int64, fromTime time.Time, issues, prs bool) error
- func (stats *ActivityStats) MergedPRCount() int
- func (stats *ActivityStats) MergedPRPerc() int
- func (stats *ActivityStats) OpenedIssueCount() int
- func (stats *ActivityStats) OpenedIssuePerc() int
- func (stats *ActivityStats) OpenedPRCount() int
- func (stats *ActivityStats) OpenedPRPerc() int
- func (stats *ActivityStats) PublishedReleaseCount() int
- func (stats *ActivityStats) UnresolvedIssueCount() int
- type Attachment
- func GetAttachmentByID(id int64) (*Attachment, error)
- func GetAttachmentByUUID(uuid string) (*Attachment, error)
- func GetAttachmentsByCommentID(commentID int64) ([]*Attachment, error)
- func GetAttachmentsByIssueID(issueID int64) ([]*Attachment, error)
- func NewAttachment(name string, buf []byte, file multipart.File) (_ *Attachment, err error)
- type Branch
- type CloneLink
- type CodeComments
- type Collaboration
- type Collaborator
- type Comment
- func CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, treePath string, ...) (*Comment, error)
- func CreateComment(opts *CreateCommentOptions) (comment *Comment, err error)
- func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, ...) (*Comment, error)
- func FindComments(opts FindCommentsOptions) ([]*Comment, error)
- func GetCommentByID(id int64) (*Comment, error)
- func GetCommentsByIssueID(issueID int64) ([]*Comment, error)
- func GetCommentsByIssueIDSince(issueID, since int64) ([]*Comment, error)
- func GetCommentsByRepoIDSince(repoID, since int64) ([]*Comment, error)
- func (c *Comment) APIFormat() *api.Comment
- func (c *Comment) AfterDelete()
- func (c *Comment) AfterLoad(session *xorm.Session)
- func (c *Comment) AsDiff() (*Diff, error)
- func (c *Comment) CheckInvalidation(repo *git.Repository, doer *User, branch string) error
- func (c *Comment) CodeCommentURL() string
- func (c *Comment) DiffSide() string
- func (c *Comment) EventTag() string
- func (c *Comment) HTMLURL() string
- func (c *Comment) HashTag() string
- func (c *Comment) IssueURL() string
- func (c *Comment) LoadAssigneeUser() error
- func (c *Comment) LoadDepIssueDetails() (err error)
- func (c *Comment) LoadIssue() (err error)
- func (c *Comment) LoadLabel() error
- func (c *Comment) LoadMilestone() error
- func (c *Comment) LoadReactions() error
- func (c *Comment) LoadReview() error
- func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (err error)
- func (c *Comment) MustAsDiff() *Diff
- func (c *Comment) PRURL() string
- func (c *Comment) UnsignedLine() uint64
- type CommentTag
- type CommentType
- type CommitRepoActionOptions
- type CommitStatus
- func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus
- func GetCommitStatus(repo *Repository, sha string, status *CommitStatus) (*CommitStatus, error)
- func GetCommitStatuses(repo *Repository, sha string, page int) ([]*CommitStatus, error)
- func GetLatestCommitStatus(repo *Repository, sha string, page int) ([]*CommitStatus, error)
- type CommitStatusState
- type CommitVerification
- type CreateCommentOptions
- type CreateRepoOptions
- type CreateReviewOptions
- type DeleteRepoFileOptions
- type DeletedBranch
- type DependencyType
- type DeployKey
- type Diff
- func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)
- func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, ...) (*Diff, error)
- func GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID string, ...) (*Diff, error)
- func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error)
- type DiffFile
- type DiffFileType
- type DiffLine
- type DiffLineType
- type DiffSection
- type DingtalkPayload
- type DiscordEmbed
- type DiscordEmbedAuthor
- type DiscordEmbedField
- type DiscordEmbedFooter
- type DiscordMeta
- type DiscordPayload
- type EmailAddress
- type Engine
- type ErrAccessTokenEmpty
- type ErrAccessTokenNotExist
- type ErrAttachmentNotExist
- type ErrBranchAlreadyExists
- type ErrBranchNameConflict
- type ErrBranchNotExist
- type ErrCircularDependency
- type ErrCommentNotExist
- type ErrDependenciesLeft
- type ErrDependencyExists
- type ErrDependencyNotExists
- type ErrDeployKeyAlreadyExist
- type ErrDeployKeyNameAlreadyUsed
- type ErrDeployKeyNotExist
- type ErrEmailAlreadyUsed
- type ErrExternalLoginUserAlreadyExist
- type ErrExternalLoginUserNotExist
- type ErrGPGKeyAccessDenied
- type ErrGPGKeyIDAlreadyUsed
- type ErrGPGKeyNotExist
- type ErrGPGKeyParsing
- type ErrGPGNoEmailFound
- type ErrInvalidCloneAddr
- type ErrInvalidMergeStyle
- type ErrInvalidTagName
- type ErrIssueNotExist
- type ErrKeyAccessDenied
- type ErrKeyAlreadyExist
- type ErrKeyNameAlreadyUsed
- type ErrKeyNotExist
- type ErrKeyUnableVerify
- type ErrLFSLockAlreadyExist
- type ErrLFSLockNotExist
- type ErrLFSUnauthorizedAction
- type ErrLabelNotExist
- type ErrLastOrgOwner
- type ErrLoginSourceAlreadyExist
- type ErrLoginSourceInUse
- type ErrLoginSourceNotExist
- type ErrMilestoneNotExist
- type ErrNamePatternNotAllowed
- type ErrNameReserved
- type ErrNotAllowedToMerge
- type ErrOpenIDAlreadyUsed
- type ErrOpenIDConnectInitialize
- type ErrOrgNotExist
- type ErrPullRequestAlreadyExists
- type ErrPullRequestNotExist
- type ErrReachLimitOfRepo
- type ErrReleaseAlreadyExist
- type ErrReleaseNotExist
- type ErrRepoAlreadyExist
- type ErrRepoFileAlreadyExist
- type ErrRepoNotExist
- type ErrRepoRedirectNotExist
- type ErrReviewNotExist
- type ErrSSHDisabled
- type ErrStopwatchNotExist
- type ErrTagAlreadyExists
- type ErrTeamAlreadyExist
- type ErrTopicNotExist
- type ErrTrackedTimeNotExist
- type ErrTwoFactorNotEnrolled
- type ErrU2FRegistrationNotExist
- type ErrUnknownDependencyType
- type ErrUpdateTaskNotExist
- type ErrUploadNotExist
- type ErrUserAlreadyExist
- type ErrUserDoesNotHaveAccessToRepo
- type ErrUserHasOrgs
- type ErrUserNotAllowedCreateOrg
- type ErrUserNotExist
- type ErrUserOwnRepos
- type ErrWebhookNotExist
- type ErrWikiAlreadyExist
- type ErrWikiInvalidFileName
- type ErrWikiReservedName
- type ExternalLoginUser
- type ExternalTrackerConfig
- type ExternalWikiConfig
- type FindCommentsOptions
- type FindReactionsOptions
- type FindReleasesOptions
- type FindReviewOptions
- type FindTopicOptions
- type FindTrackedTimesOptions
- type Follow
- type GPGKey
- type GetFeedsOptions
- type GraphItem
- type GraphItems
- 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) APIURL() string
- func (issue *Issue) AddLabel(doer *User, label *Label) error
- func (issue *Issue) AddLabels(doer *User, labels []*Label) error
- func (issue *Issue) BlockedByDependencies() ([]*Issue, error)
- func (issue *Issue) BlockingDependencies() ([]*Issue, error)
- 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 (issue *Issue) DiffURL() string
- func (issue *Issue) GetIsRead(userID int64) error
- func (issue *Issue) GetPullRequest() (pr *PullRequest, err error)
- func (issue *Issue) GetTasks() int
- func (issue *Issue) GetTasksDone() int
- func (issue *Issue) HTMLURL() string
- func (issue *Issue) HasLabel(labelID int64) bool
- func (issue *Issue) HashTag() string
- func (issue *Issue) IsOverdue() bool
- func (issue *Issue) IsPoster(uid int64) bool
- func (issue *Issue) IsTimetrackerEnabled() bool
- func (issue *Issue) LoadAttributes() error
- func (issue *Issue) MailParticipants() (err error)
- func (issue *Issue) PatchURL() string
- func (issue *Issue) ReadBy(userID int64) error
- func (issue *Issue) RemoveLabel(doer *User, label *Label) error
- func (issue *Issue) ReplaceLabels(labels []*Label, doer *User) (err error)
- func (issue *Issue) State() api.StateType
- type IssueAssignees
- type IssueDependency
- type IssueLabel
- type IssueList
- type IssueStats
- type IssueStatsOptions
- type IssueUser
- type IssueWatch
- type IssuesConfig
- type IssuesOptions
- type KeyType
- type LDAPConfig
- type LFSLock
- func CreateLFSLock(lock *LFSLock) (*LFSLock, error)
- func DeleteLFSLockByID(id int64, u *User, force bool) (*LFSLock, error)
- func GetLFSLock(repo *Repository, path string) (*LFSLock, error)
- func GetLFSLockByID(id int64) (*LFSLock, error)
- func GetLFSLockByRepoID(repoID int64) (locks []*LFSLock, err error)
- type LFSMetaObject
- type LFSTokenResponse
- type Label
- func GetLabelByID(id int64) (*Label, error)
- func GetLabelInRepoByID(repoID, labelID int64) (*Label, error)
- func GetLabelInRepoByName(repoID int64, labelName string) (*Label, error)
- func GetLabelsByIssueID(issueID int64) ([]*Label, error)
- func GetLabelsByRepoID(repoID int64, sortType string) ([]*Label, error)
- func GetLabelsInRepoByIDs(repoID int64, labelIDs []int64) ([]*Label, error)
- type LoginSource
- func (source *LoginSource) BeforeSet(colName string, val xorm.Cell)
- func (source *LoginSource) HasTLS() bool
- func (source *LoginSource) IsDLDAP() bool
- func (source *LoginSource) IsLDAP() bool
- func (source *LoginSource) IsOAuth2() bool
- func (source *LoginSource) IsPAM() bool
- func (source *LoginSource) IsSMTP() bool
- func (source *LoginSource) LDAP() *LDAPConfig
- func (source *LoginSource) OAuth2() *OAuth2Config
- 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 MergeStyle
- type MigrateRepoOptions
- type Milestone
- type MilestoneList
- type Mirror
- type MirrorRepositoryList
- type MirrorSyncPushActionOptions
- type NewCommitStatusOptions
- type NewIssueOptions
- type Notice
- type NoticeType
- type Notification
- type NotificationSource
- type NotificationStatus
- type OAuth2Config
- type OAuth2Provider
- type OrgUser
- type PAMConfig
- type ProtectedBranch
- type PublicKey
- func AddPublicKey(ownerID int64, name, content string, LoginSourceID int64) (*PublicKey, error)
- func GetPublicKeyByID(keyID int64) (*PublicKey, error)
- func ListPublicKeys(uid int64) ([]*PublicKey, error)
- func ListPublicLdapSSHKeys(uid int64, LoginSourceID int64) ([]*PublicKey, error)
- func SearchPublicKeyByContent(content string) (*PublicKey, error)
- type PullRequest
- func GetPullRequestByID(id int64) (*PullRequest, error)
- func GetPullRequestByIndex(repoID int64, index 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 PullRequests(baseRepoID int64, opts *PullRequestsOptions) ([]*PullRequest, int64, error)
- func (pr *PullRequest) APIFormat() *api.PullRequest
- func (pr *PullRequest) AddToTaskQueue()
- func (pr *PullRequest) CanAutoMerge() bool
- func (pr *PullRequest) CheckUserAllowedToMerge(doer *User) (err error)
- func (pr *PullRequest) GetBaseRepo() (err error)
- func (pr *PullRequest) GetDefaultMergeMessage() string
- func (pr *PullRequest) GetDefaultSquashMessage() string
- func (pr *PullRequest) GetGitRefName() string
- func (pr *PullRequest) GetHeadRepo() error
- func (pr *PullRequest) GetWorkInProgressPrefix() string
- func (pr *PullRequest) IsChecking() bool
- func (pr *PullRequest) IsWorkInProgress() bool
- func (pr *PullRequest) LoadAttributes() error
- func (pr *PullRequest) LoadIssue() (err error)
- func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle MergeStyle, message string) (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 PullRequestsConfig
- type PullRequestsOptions
- type PushCommit
- type PushCommits
- type PushUpdateOptions
- type RawDiffType
- type Reaction
- type ReactionList
- type ReactionOptions
- type Release
- type RepoIndexerStatus
- type RepoRedirect
- type RepoTopic
- type RepoUnit
- func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell)
- func (r *RepoUnit) CodeConfig() *UnitConfig
- func (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig
- func (r *RepoUnit) ExternalWikiConfig() *ExternalWikiConfig
- func (r *RepoUnit) IssuesConfig() *IssuesConfig
- func (r *RepoUnit) PullRequestsConfig() *PullRequestsConfig
- func (r *RepoUnit) ReleasesConfig() *UnitConfig
- func (r *RepoUnit) Unit() Unit
- type Repository
- func CleanUpMigrateInfo(repo *Repository) (*Repository, error)
- func CreateRepository(doer, u *User, opts CreateRepoOptions) (_ *Repository, err error)
- func ForkRepository(doer, u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)
- func GetRepositoriesByForkID(forkID int64) ([]*Repository, error)
- func GetRepositoryByID(id int64) (*Repository, error)
- func GetRepositoryByName(ownerID int64, name string) (*Repository, error)
- func GetRepositoryByOwnerAndName(ownerName, repoName string) (*Repository, error)
- func GetStarredRepos(userID int64, private bool) ([]*Repository, error)
- func GetUserMirrorRepositories(userID int64) ([]*Repository, error)
- func GetUserRepositories(userID int64, private bool, page, pageSize int, orderBy string) ([]*Repository, error)
- func GetWatchedRepos(userID int64, private bool) ([]*Repository, error)
- func HasForkedRepo(ownerID, repoID int64) (*Repository, bool)
- func MigrateRepository(doer, u *User, opts MigrateRepoOptions) (*Repository, error)
- func (repo *Repository) APIFormat(mode AccessMode) *api.Repository
- func (repo *Repository) APIURL() string
- func (repo *Repository) AddCollaborator(u *User) error
- func (repo *Repository) AddDeletedBranch(branchName, commit string, deletedByID int64) error
- func (repo *Repository) AddWikiPage(doer *User, wikiName, content, message string) error
- func (repo *Repository) AfterLoad()
- func (repo *Repository) AllowOnlyContributorsToTrackTime() bool
- func (repo *Repository) AllowsPulls() bool
- func (repo *Repository) AnyUnitEnabled(tps ...UnitType) bool
- func (repo *Repository) CanBeForked() bool
- func (repo *Repository) CanCreateBranch() bool
- func (repo *Repository) CanEnableEditor() bool
- func (repo *Repository) CanEnablePulls() bool
- func (repo *Repository) CanEnableTimetracker() bool
- func (repo *Repository) CanUserFork(user *User) (bool, error)
- func (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode) error
- func (repo *Repository) CheckBranchName(name string) error
- func (repo *Repository) CheckUnitUser(userID int64, isAdmin bool, unitType UnitType) bool
- 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) CreateNewBranchFromCommit(doer *User, commit, branchName string) (err error)
- func (repo *Repository) DeleteCollaboration(uid int64) (err error)
- func (repo *Repository) DeleteProtectedBranch(id int64) (err error)
- func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (err error)
- func (repo *Repository) DeleteWiki() error
- func (repo *Repository) DeleteWikiPage(doer *User, wikiName string) (err error)
- func (repo *Repository) DescriptionHTML() template.HTML
- func (repo *Repository) DiscardLocalRepoBranchChanges(branch string) error
- func (repo *Repository) EditWikiPage(doer *User, oldWikiName, newWikiName, content, message string) error
- func (repo *Repository) FullName() string
- func (repo *Repository) GetAssignees() (_ []*User, err error)
- func (repo *Repository) GetBaseRepo() (err error)
- func (repo *Repository) GetBranch(branch string) (*Branch, error)
- func (repo *Repository) GetBranches() ([]*Branch, error)
- func (repo *Repository) GetCollaborators() ([]*Collaborator, error)
- func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string
- func (repo *Repository) GetDeletedBranchByID(ID int64) (*DeletedBranch, error)
- func (repo *Repository) GetDeletedBranches() ([]*DeletedBranch, error)
- func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *Diff, err error)
- func (repo *Repository) GetForks() ([]*Repository, error)
- func (repo *Repository) GetLFSMetaObjectByOid(oid string) (*LFSMetaObject, error)
- func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)
- func (repo *Repository) GetMirror() (err error)
- func (repo *Repository) GetOwner() error
- func (repo *Repository) GetOwnerName() error
- func (repo *Repository) GetProtectedBranches() ([]*ProtectedBranch, error)
- func (repo *Repository) GetStargazers(page int) ([]*User, error)
- func (repo *Repository) GetUnit(tp UnitType) (*RepoUnit, error)
- func (repo *Repository) GetUserFork(userID int64) (*Repository, error)
- func (repo *Repository) GetUserIfHasWriteAccess(userID int64) (*User, error)
- func (repo *Repository) GetWatchers(page int) ([]*User, error)
- func (repo *Repository) GetWriters() (_ []*User, err 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) IsCollaborator(userID int64) (bool, error)
- func (repo *Repository) IsDependenciesEnabled() bool
- func (repo *Repository) IsOwnedBy(userID int64) bool
- func (repo *Repository) IsProtectedBranch(branchName string, doer *User) (bool, error)
- func (repo *Repository) IsProtectedBranchForMerging(branchName string, doer *User) (bool, error)
- func (repo *Repository) IsProtectedBranchForPush(branchName string, doer *User) (bool, error)
- func (repo *Repository) IsTimetrackerEnabled() bool
- func (repo *Repository) IssueStats(uid int64, filterMode int, isPull bool) (int64, int64)
- func (repo *Repository) Link() string
- func (repo *Repository) LoadUnitsByUserID(userID int64, isAdmin bool) error
- func (repo *Repository) LocalCopyPath() string
- func (repo *Repository) LocalWikiPath() string
- func (repo *Repository) MustGetUnit(tp UnitType) *RepoUnit
- func (repo *Repository) MustOwner() *User
- func (repo *Repository) MustOwnerName() string
- func (repo *Repository) NextIssueIndex() int64
- func (repo *Repository) PatchPath(index int64) (string, error)
- func (repo *Repository) RecalculateAccesses() error
- func (repo *Repository) RelLink() string
- func (repo *Repository) RemoveDeletedBranch(id int64) (err error)
- func (repo *Repository) RemoveLFSMetaObjectByOid(oid string) error
- func (repo *Repository) RepoPath() string
- func (repo *Repository) SavePatch(index int64, patch []byte) error
- func (repo *Repository) UnitEnabled(tp UnitType) bool
- func (repo *Repository) UpdateDefaultBranch() error
- func (repo *Repository) UpdateLocalCopyBranch(branch string) error
- func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (err error)
- func (repo *Repository) UpdateSize() error
- func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) (err error)
- func (repo *Repository) WikiCloneLink() *CloneLink
- func (repo *Repository) WikiPath() string
- type RepositoryList
- type Review
- type ReviewType
- type SMTPConfig
- type SearchOrderBy
- type SearchRepoOptions
- type SearchUserOptions
- type SignCommit
- type SignCommitWithStatuses
- type SlackAttachment
- type SlackMeta
- type SlackPayload
- type Star
- type Statistic
- type Stopwatch
- type Team
- func (t *Team) AddMember(userID 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) HasWriteAccess() bool
- func (t *Team) IsMember(userID int64) bool
- func (t *Team) IsOwnerTeam() bool
- func (t *Team) RemoveMember(userID int64) error
- func (t *Team) RemoveRepository(repoID int64) error
- func (t *Team) UnitEnabled(tp UnitType) bool
- type TeamRepo
- type TeamUnit
- type TeamUser
- type Topic
- type TrackedTime
- type TwoFactor
- type U2FRegistration
- type U2FRegistrationList
- type Unit
- type UnitConfig
- type UnitType
- type UpdateRepoFileOptions
- type Upload
- type UploadRepoFileOptions
- type User
- func ExternalUserLogin(user *User, login, password string, source *LoginSource, autoRegister bool) (*User, error)
- func GetAssigneesByIssue(issue *Issue) (assignees []*User, err error)
- func GetOrgByName(name string) (*User, error)
- func GetOrgsByUserID(userID int64, showAll bool) ([]*User, error)
- func GetOwnedOrgsByUserID(userID int64) ([]*User, error)
- func GetOwnedOrgsByUserIDDesc(userID int64, desc string) ([]*User, error)
- func GetParticipantsByIssueID(issueID int64) ([]*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 GetUserByOpenID(uri string) (*User, error)
- func GetUserIfHasWriteAccess(repo *Repository, userID int64) (*User, error)
- func GetUsersByIDs(ids []int64) ([]*User, error)
- func LoginViaLDAP(user *User, login, password 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 SearchUsers(opts *SearchUserOptions) (users []*User, _ int64, _ error)
- func UserSignIn(username, password string) (*User, error)
- func ValidateCommitWithEmail(c *git.Commit) *User
- func VerifyUserActiveCode(code string) (user *User)
- func (u *User) APIFormat() *api.User
- func (org *User) AccessibleReposEnv(userID int64) (AccessibleReposEnvironment, error)
- func (org *User) AddMember(uid int64) error
- func (u *User) AvatarLink() string
- func (u *User) BeforeUpdate()
- func (u *User) CanCreateOrganization() bool
- 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) GenerateActivateCode() string
- func (u *User) GenerateEmailActivateCode(email string) string
- func (u *User) GenerateRandomAvatar() error
- func (u *User) GetAccessRepoIDs(units ...UnitType) ([]int64, 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) GetOrgRepositoryIDs(units ...UnitType) ([]int64, 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 (user *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error)
- func (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error)
- func (u *User) GetStarredRepoCount(private bool) (int64, error)
- func (u *User) GetStarredRepos(private bool, page, pageSize int, orderBy string) (repos RepositoryList, err error)
- func (org *User) GetTeam(name string) (*Team, error)
- func (org *User) GetTeams() error
- func (org *User) GetUserTeamIDs(userID int64) ([]int64, error)
- func (org *User) GetUserTeams(userID int64) ([]*Team, error)
- func (u *User) HTMLURL() string
- func (u *User) HasForkedRepo(repoID int64) bool
- func (u *User) HashPassword(passwd string)
- 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 (u *User) IsMailable() bool
- func (u *User) IsOAuth2() bool
- func (org *User) IsOrgMember(uid int64) (bool, error)
- func (u *User) IsOrganization() bool
- func (org *User) IsOwnedBy(uid int64) (bool, error)
- func (u *User) IsPasswordSet() 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) MaxCreationLimit() int
- 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) SetLastLogin()
- func (u *User) ShortName(length int) string
- func (u *User) SizedRelAvatarLink(size int) string
- func (org *User) TeamsWithAccessToRepo(repoID int64, mode AccessMode) ([]*Team, error)
- func (u *User) UpdateDiffViewStyle(style string) error
- func (u *User) UploadAvatar(data []byte) error
- func (u *User) ValidatePassword(passwd string) bool
- type UserCommit
- type UserIssueStatsOptions
- type UserOpenID
- type UserType
- type Watch
- type Webhook
- func GetActiveWebhooksByOrgID(orgID int64) (ws []*Webhook, err error)
- func GetActiveWebhooksByRepoID(repoID int64) ([]*Webhook, error)
- func GetWebhookByID(id 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) AfterLoad()
- func (w *Webhook) EventsArray() []string
- func (w *Webhook) GetDiscordHook() *DiscordMeta
- func (w *Webhook) GetSlackHook() *SlackMeta
- func (w *Webhook) HasCreateEvent() bool
- func (w *Webhook) HasDeleteEvent() bool
- func (w *Webhook) HasForkEvent() bool
- func (w *Webhook) HasIssueCommentEvent() bool
- func (w *Webhook) HasIssuesEvent() bool
- func (w *Webhook) HasPullRequestEvent() bool
- func (w *Webhook) HasPushEvent() bool
- func (w *Webhook) HasReleaseEvent() bool
- func (w *Webhook) HasRepositoryEvent() bool
- func (w *Webhook) History(page int) ([]*HookTask, error)
- func (w *Webhook) UpdateEvent() error
Examples ¶
Constants ¶
const ( FilterModeAll = iota FilterModeAssign FilterModeCreate FilterModeMention )
Filter modes.
const ( // LFSMetaFileIdentifier is the string appearing at the first line of LFS pointer files. // https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md LFSMetaFileIdentifier = "version https://git-lfs.github.com/spec/v1" // LFSMetaFileOidPrefix appears in LFS pointer files on a line before the sha256 hash. LFSMetaFileOidPrefix = "oid sha256:" )
const ( SMTPPlain = "PLAIN" SMTPLogin = "LOGIN" )
SMTP authentication type names.
const ( SearchOrderByAlphabetically SearchOrderBy = "name ASC" SearchOrderByAlphabeticallyReverse = "name DESC" SearchOrderByLeastUpdated = "updated_unix ASC" SearchOrderByRecentUpdated = "updated_unix DESC" SearchOrderByOldest = "created_unix ASC" SearchOrderByNewest = "created_unix DESC" SearchOrderBySize = "size ASC" SearchOrderBySizeReverse = "size DESC" SearchOrderByID = "id ASC" SearchOrderByIDReverse = "id DESC" SearchOrderByStars = "num_stars ASC" SearchOrderByStarsReverse = "num_stars DESC" SearchOrderByForks = "num_forks ASC" SearchOrderByForksReverse = "num_forks DESC" )
Strings for sorting result
const ( // KeyTypeUser specifies the user key KeyTypeUser = iota + 1 // KeyTypeDeploy specifies the deploy key KeyTypeDeploy )
const ( EnvRepoName = "GITEA_REPO_NAME" EnvRepoUsername = "GITEA_REPO_USER_NAME" EnvRepoIsWiki = "GITEA_REPO_IS_WIKI" EnvPusherName = "GITEA_PUSHER_NAME" EnvPusherEmail = "GITEA_PUSHER_EMAIL" EnvPusherID = "GITEA_PUSHER_ID" )
env keys for git hooks need
const ( HookStatusNone = iota HookStatusSucceed HookStatusFail )
Possible statuses of a web hook
const NonexistentID = int64(math.MaxInt64)
NonexistentID an ID that will never exist
const (
// ProtectedBranchRepoID protected Repo ID
ProtectedBranchRepoID = "GITEA_REPO_ID"
)
const RepositoryListDefaultPageSize = 64
RepositoryListDefaultPageSize is the default number of repositories to load in memory when running administrative tasks on all (or almost all) of them. The number should be low enough to avoid filling up all RAM with repository data...
Variables ¶
var ( // HasEngine specifies if we have a xorm.Engine HasEngine bool // DbCfg holds the database settings DbCfg struct { Type, Host, Name, User, Passwd, Path, SSLMode string Timeout int } // EnableSQLite3 use SQLite3 EnableSQLite3 bool // EnableTiDB enable TiDB EnableTiDB bool )
var ( // ErrMirrorNotExist mirror does not exist error ErrMirrorNotExist = errors.New("Mirror does not exist") // ErrNameEmpty name is empty error ErrNameEmpty = errors.New("Name is empty") )
var ( // Gitignores contains the gitiginore files Gitignores []string // Licenses contains the license files Licenses []string // Readmes contains the readme files Readmes []string // LabelTemplates contains the label template files LabelTemplates []string // ItemsPerPage maximum items per page in forks, watchers and stars of a repo ItemsPerPage = 40 )
var ( UnitCode = Unit{ UnitTypeCode, "repo.code", "/", "repo.code.desc", 0, } UnitIssues = Unit{ UnitTypeIssues, "repo.issues", "/issues", "repo.issues.desc", 1, } UnitExternalTracker = Unit{ UnitTypeExternalTracker, "repo.ext_issues", "/issues", "repo.ext_issues.desc", 1, } UnitPullRequests = Unit{ UnitTypePullRequests, "repo.pulls", "/pulls", "repo.pulls.desc", 2, } UnitReleases = Unit{ UnitTypeReleases, "repo.releases", "/releases", "repo.releases.desc", 3, } UnitWiki = Unit{ UnitTypeWiki, "repo.wiki", "/wiki", "repo.wiki.desc", 4, } UnitExternalWiki = Unit{ UnitTypeExternalWiki, "repo.ext_wiki", "/wiki", "repo.ext_wiki.desc", 4, } // Units contains all the units Units = map[UnitType]Unit{ UnitTypeCode: UnitCode, UnitTypeIssues: UnitIssues, UnitTypeExternalTracker: UnitExternalTracker, UnitTypePullRequests: UnitPullRequests, UnitTypeReleases: UnitReleases, UnitTypeWiki: UnitWiki, UnitTypeExternalWiki: UnitExternalWiki, } )
Enumerate all the units
var ( // ErrUserNotKeyOwner user does not own this key error ErrUserNotKeyOwner = errors.New("User does not own this public key") // ErrEmailNotExist e-mail does not exist error ErrEmailNotExist = errors.New("E-mail does not exist") // ErrEmailNotActivated e-mail address has not been activated error ErrEmailNotActivated = errors.New("E-mail address has not been activated") // ErrUserNameIllegal user name contains illegal characters error ErrUserNameIllegal = errors.New("User name contains illegal characters") // ErrLoginSourceNotActived login source is not actived error ErrLoginSourceNotActived = errors.New("Login source is not actived") // ErrUnsupportedLoginType login source is unknown error ErrUnsupportedLoginType = errors.New("Login source is unknown") )
var ( // ErrEmailAddressNotExist email address not exist ErrEmailAddressNotExist = errors.New("Email address does not exist") )
var ( // ErrLFSObjectNotExist is returned from lfs models functions in order // to differentiate between database and missing object errors. ErrLFSObjectNotExist = errors.New("LFS Meta object does not exist") )
var ( // ErrOpenIDNotExist openid is not known ErrOpenIDNotExist = errors.New("OpenID is unknown") )
var ( // ErrTeamNotExist team does not exist ErrTeamNotExist = errors.New("Team does not exist") )
var ( // ErrUnitNotExist organization does not exist ErrUnitNotExist = errors.New("Unit does not exist") )
var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)
HookQueue is a global queue of web hooks
var LoginNames = map[LoginType]string{ LoginLDAP: "LDAP (via BindDN)", LoginDLDAP: "LDAP (simple auth)", LoginSMTP: "SMTP", LoginPAM: "PAM", LoginOAuth2: "OAuth2", }
LoginNames contains the name of LoginType values.
var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)
MirrorQueue holds an UniqueQueue object of the mirror
var ( // MustRepoUnits contains the units could not be disabled currently MustRepoUnits = []UnitType{ UnitTypeCode, UnitTypeReleases, } )
var OAuth2DefaultCustomURLMappings = map[string]*oauth2.CustomURLMapping{ "github": OAuth2Providers["github"].CustomURLMapping, "gitlab": OAuth2Providers["gitlab"].CustomURLMapping, }
OAuth2DefaultCustomURLMappings contains the map of default URL's for OAuth2 providers that are allowed to have custom urls key is used to map the OAuth2Provider value is the mapping as defined for the OAuth2Provider
var OAuth2Providers = map[string]OAuth2Provider{ "bitbucket": {Name: "bitbucket", DisplayName: "Bitbucket", Image: "/img/auth/bitbucket.png"}, "dropbox": {Name: "dropbox", DisplayName: "Dropbox", Image: "/img/auth/dropbox.png"}, "facebook": {Name: "facebook", DisplayName: "Facebook", Image: "/img/auth/facebook.png"}, "github": {Name: "github", DisplayName: "GitHub", Image: "/img/auth/github.png", CustomURLMapping: &oauth2.CustomURLMapping{ TokenURL: oauth2.GetDefaultTokenURL("github"), AuthURL: oauth2.GetDefaultAuthURL("github"), ProfileURL: oauth2.GetDefaultProfileURL("github"), EmailURL: oauth2.GetDefaultEmailURL("github"), }, }, "gitlab": {Name: "gitlab", DisplayName: "GitLab", Image: "/img/auth/gitlab.png", CustomURLMapping: &oauth2.CustomURLMapping{ TokenURL: oauth2.GetDefaultTokenURL("gitlab"), AuthURL: oauth2.GetDefaultAuthURL("gitlab"), ProfileURL: oauth2.GetDefaultProfileURL("gitlab"), }, }, "gplus": {Name: "gplus", DisplayName: "Google+", Image: "/img/auth/google_plus.png"}, "openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.png"}, "twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"}, }
OAuth2Providers contains the map of registered OAuth2 providers in Gitea (based on goth) key is used to map the OAuth2Provider with the goth provider type (also in LoginSource.OAuth2Config.Provider) value is used to store display data
var SMTPAuths = []string{SMTPPlain, SMTPLogin}
SMTPAuths contains available SMTP authentication type names.
var SecurityProtocolNames = map[ldap.SecurityProtocol]string{ ldap.SecurityProtocolUnencrypted: "Unencrypted", ldap.SecurityProtocolLDAPS: "LDAPS", ldap.SecurityProtocolStartTLS: "StartTLS", }
SecurityProtocolNames contains the name of SecurityProtocol values.
Functions ¶
func AddAssigneeIfNotAssigned ¶ added in v1.5.0
AddAssigneeIfNotAssigned adds an assignee only if he isn't aleady assigned to the issue
func AddDeletePRBranchComment ¶ added in v1.1.0
func AddDeletePRBranchComment(doer *User, repo *Repository, issueID int64, branchName string) error
AddDeletePRBranchComment adds delete branch comment for pull request issue
func AddEmailAddress ¶
func AddEmailAddress(email *EmailAddress) error
AddEmailAddress adds an email address to given user.
func AddEmailAddresses ¶
func AddEmailAddresses(emails []*EmailAddress) error
AddEmailAddresses adds an email address to given user.
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 AddTestPullRequestTask ¶
AddTestPullRequestTask adds new test tasks by given head/base repository and head/base branch, and generate new patch for testing as needed.
func AddUserOpenID ¶ added in v1.2.0
func AddUserOpenID(openid *UserOpenID) error
AddUserOpenID adds an pre-verified/normalized OpenID URI to given user.
func AssertCount ¶ added in v1.2.0
AssertCount assert the count of a bean
func AssertExistsAndLoadBean ¶ added in v1.2.0
AssertExistsAndLoadBean assert that a bean exists and load it from the test database
func AssertExistsIf ¶ added in v1.4.0
AssertExistsIf asserts that a bean exists or does not exist, depending on what is expected.
func AssertInt64InRange ¶ added in v1.2.0
AssertInt64InRange assert value is in range [low, high]
func AssertNotExistsBean ¶ added in v1.2.0
AssertNotExistsBean assert that a bean does not exist in the test database
func AssertSuccessfulInsert ¶ added in v1.2.0
AssertSuccessfulInsert assert that beans is successfully inserted
func AttachmentLocalPath ¶
AttachmentLocalPath returns where attachment is stored in local file system based on given UUID.
func BeanExists ¶ added in v1.2.0
BeanExists for testing, check if a bean exists
func CancelStopwatch ¶ added in v1.3.0
CancelStopwatch removes the given stopwatch and logs it into issue's timeline.
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 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 ChangeUsernameInPullRequests ¶
ChangeUsernameInPullRequests changes the name of head_user_name
func CheckConsistencyFor ¶ added in v1.2.0
CheckConsistencyFor test that all matching database entries are consistent
func CheckConsistencyForAll ¶ added in v1.2.0
CheckConsistencyForAll test that the entire database is consistent
func CheckLFSAccessForRepo ¶ added in v1.4.0
func CheckLFSAccessForRepo(u *User, repo *Repository, mode AccessMode) error
CheckLFSAccessForRepo check needed access mode base on action
func CheckPublicKeyString ¶
CheckPublicKeyString checks if the given public key string is recognized by SSH. It returns the actual public key line on success.
func CommentHashTag ¶ added in v1.5.0
CommentHashTag returns unique hash tag for comment id.
func CommitRepoAction ¶
func CommitRepoAction(opts CommitRepoActionOptions) error
CommitRepoAction adds new commit action to the repository, and prepare corresponding webhooks.
func ComposeHTTPSCloneURL ¶
ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
func Cond ¶ added in v1.2.0
func Cond(query interface{}, args ...interface{}) interface{}
Cond create a condition with arguments for a test
func CountIssuesByRepo ¶ added in v1.2.0
func CountIssuesByRepo(opts *IssuesOptions) (map[int64]int64, error)
CountIssuesByRepo map from repoID to number of issues matching the options
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 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 CreateIssueDependency ¶ added in v1.6.0
CreateIssueDependency creates a new dependency for an issue
func CreateLoginSource ¶
func CreateLoginSource(source *LoginSource) error
CreateLoginSource inserts a LoginSource in the DB if not already existing with the given name.
func CreateNotice ¶
func CreateNotice(tp NoticeType, desc string) error
CreateNotice creates new system notice.
func CreateOrStopIssueStopwatch ¶ added in v1.3.0
CreateOrStopIssueStopwatch will create or remove a stopwatch and will log it into issue's timeline.
func CreateOrUpdateIssueNotifications ¶ added in v1.1.0
CreateOrUpdateIssueNotifications creates an issue notification for each watcher, or updates it if already exists
func CreateOrUpdateIssueWatch ¶ added in v1.2.0
CreateOrUpdateIssueWatch set watching for a user and issue
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 ¶
func CreateRelease(gitRepo *git.Repository, rel *Release, attachmentUUIDs []string) error
CreateRelease creates a new release of repository.
func CreateRepositoryNotice ¶
CreateRepositoryNotice creates new system notice with type NoticeRepository.
func CutDiffAroundLine ¶ added in v1.6.0
CutDiffAroundLine cuts a diff of a file in way that only the given line + numberOfLine above it will be shown it also recalculates hunks and adds the appropriate headers to the new diff. Warning: Only one-file diffs are allowed.
Example ¶
const diff = `diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # gitea-github-migrator + + Build Status - Latest Release Docker Pulls + cut off + cut off` result := CutDiffAroundLine(strings.NewReader(diff), 4, false, 3) println(result)
Output:
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 DeleteComment ¶ added in v1.1.0
DeleteComment deletes the comment
func DeleteCommentReaction ¶ added in v1.4.0
DeleteCommentReaction deletes a reaction on comment.
func DeleteDeployKey ¶
DeleteDeployKey deletes deploy key from its repository authorized_keys file if needed.
func DeleteEmailAddress ¶
func DeleteEmailAddress(email *EmailAddress) (err error)
DeleteEmailAddress deletes an email address of given user.
func DeleteEmailAddresses ¶
func DeleteEmailAddresses(emails []*EmailAddress) (err error)
DeleteEmailAddresses deletes multiple email addresses
func DeleteGPGKey ¶ added in v1.2.0
DeleteGPGKey deletes GPG key information in database.
func DeleteInactivateUsers ¶
func DeleteInactivateUsers() (err error)
DeleteInactivateUsers deletes all inactivate users and email addresses.
func DeleteIssueLabel ¶
DeleteIssueLabel deletes issue-label relation.
func DeleteIssueReaction ¶ added in v1.4.0
DeleteIssueReaction deletes a reaction on issue.
func DeleteLabel ¶
DeleteLabel delete a label of given repository.
func DeleteMilestoneByRepoID ¶
DeleteMilestoneByRepoID deletes a milestone from a repository.
func DeleteMirrorByRepoID ¶
DeleteMirrorByRepoID deletes a mirror by repoID
func DeleteMissingRepositories ¶
DeleteMissingRepositories deletes all repository records that lost Git files.
func DeleteNotPassedAssignee ¶ added in v1.5.0
DeleteNotPassedAssignee deletes all assignees who aren't passed via the "assignees" array
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 DeleteOldRepositoryArchives ¶ added in v1.1.0
func DeleteOldRepositoryArchives()
DeleteOldRepositoryArchives deletes old repository archives.
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 DeleteReaction ¶ added in v1.4.0
func DeleteReaction(opts *ReactionOptions) error
DeleteReaction deletes reaction for issue or comment.
func DeleteRegistration ¶ added in v1.5.0
func DeleteRegistration(reg *U2FRegistration) error
DeleteRegistration will delete U2FRegistration
func DeleteReleaseByID ¶
DeleteReleaseByID deletes a release and corresponding Git tag by given ID.
func DeleteRepoFromIndexer ¶ added in v1.3.0
func DeleteRepoFromIndexer(repo *Repository)
DeleteRepoFromIndexer remove all of a repository's entries from the indexer
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
DeleteSource deletes a LoginSource record in DB.
func DeleteTeam ¶
DeleteTeam deletes given team. It's caller's responsibility to assign organization ID.
func DeleteTwoFactorByID ¶ added in v1.1.0
DeleteTwoFactorByID deletes two-factor authentication token by given ID.
func DeleteUploadByUUID ¶
DeleteUploadByUUID deletes a upload by UUID
func DeleteUploads ¶
DeleteUploads deletes multiple uploads
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 DeleteUserOpenID ¶ added in v1.2.0
func DeleteUserOpenID(openid *UserOpenID) (err error)
DeleteUserOpenID deletes an openid address of given user.
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 according the special database SQL syntax to file system.
func FindUserAccessibleRepoIDs ¶ added in v1.5.0
FindUserAccessibleRepoIDs find all accessible repositories' ID by user's id
func FollowUser ¶
FollowUser marks someone be another's follower.
func GetActiveOAuth2Providers ¶ added in v1.1.0
func GetActiveOAuth2Providers() ([]string, map[string]OAuth2Provider, error)
GetActiveOAuth2Providers returns the map of configured active OAuth2 providers key is used as technical name (like in the callbackURL) values to display
func GetExternalLogin ¶ added in v1.1.0
func GetExternalLogin(externalLoginUser *ExternalLoginUser) (bool, error)
GetExternalLogin checks if a externalID in loginSourceID scope already exists
func GetLabelTemplateFile ¶
GetLabelTemplateFile loads the label template file by given name, then parses and returns a list of name-color pairs and optionally description.
func GetNotificationCount ¶ added in v1.1.0
func GetNotificationCount(user *User, status NotificationStatus) (int64, error)
GetNotificationCount returns the notification count for user
func GetPrivateRepositoryCount ¶ added in v1.1.0
GetPrivateRepositoryCount returns the total number of private repositories of user.
func GetPublicRepositoryCount ¶ added in v1.1.0
GetPublicRepositoryCount returns the total number of public repositories of user.
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 GetRawDiffForFile ¶ added in v1.6.0
func GetRawDiffForFile(repoPath, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error
GetRawDiffForFile dumps diff results of file in given commit ID to io.Writer. TODO: move this function to gogits/git-module
func GetReleaseAttachments ¶ added in v1.1.0
GetReleaseAttachments retrieves the attachments for releases
func GetReleaseCountByRepoID ¶ added in v1.2.0
func GetReleaseCountByRepoID(repoID int64, opts FindReleasesOptions) (int64, error)
GetReleaseCountByRepoID returns the count of releases of repository
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 GetRepositoriesMapByIDs ¶ added in v1.5.0
func GetRepositoriesMapByIDs(ids []int64) (map[int64]*Repository, error)
GetRepositoriesMapByIDs returns the repositories by given id slice.
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 GitConfigPath ¶ added in v1.3.1
GitConfigPath returns the path to a repository's git config/ directory
func GitGcRepos ¶
func GitGcRepos() error
GitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository
func HasAccess ¶
func HasAccess(userID int64, repo *Repository, testMode AccessMode) (bool, error)
HasAccess returns true if user has access to repo
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 InitFixtures ¶ added in v1.2.0
InitFixtures initialize test fixtures for a test database
func InitIssueIndexer ¶ added in v1.1.0
func InitIssueIndexer()
InitIssueIndexer initialize issue indexer
func InitMailRender ¶
InitMailRender initializes the macaron mail renderer
func InitOAuth2 ¶ added in v1.1.0
func InitOAuth2() error
InitOAuth2 initialize the OAuth2 lib and register all active OAuth2 providers in the library
func InitRepoIndexer ¶ added in v1.3.0
func InitRepoIndexer()
InitRepoIndexer initialize the repo indexer
func InitSyncMirrors ¶
func InitSyncMirrors()
InitSyncMirrors initializes a go routine to sync the mirrors
func InitTestPullRequests ¶
func InitTestPullRequests()
InitTestPullRequests runs the task to test all the checking status pull requests
func IsEmailUsed ¶
IsEmailUsed returns true if the email has been used.
func IsErrAccessTokenEmpty ¶
IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.
func IsErrAccessTokenNotExist ¶
IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.
func IsErrAttachmentNotExist ¶
IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
func IsErrBranchAlreadyExists ¶ added in v1.3.0
IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
func IsErrBranchNameConflict ¶ added in v1.3.0
IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
func IsErrBranchNotExist ¶
IsErrBranchNotExist checks if an error is a ErrBranchNotExist.
func IsErrCircularDependency ¶ added in v1.6.0
IsErrCircularDependency checks if an error is a ErrCircularDependency.
func IsErrCommentNotExist ¶
IsErrCommentNotExist checks if an error is a ErrCommentNotExist.
func IsErrDependenciesLeft ¶ added in v1.6.0
IsErrDependenciesLeft checks if an error is a ErrDependenciesLeft.
func IsErrDependencyExists ¶ added in v1.6.0
IsErrDependencyExists checks if an error is a ErrDependencyExists.
func IsErrDependencyNotExists ¶ added in v1.6.0
IsErrDependencyNotExists checks if an error is a ErrDependencyExists.
func IsErrDeployKeyAlreadyExist ¶
IsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.
func IsErrDeployKeyNameAlreadyUsed ¶
IsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.
func IsErrDeployKeyNotExist ¶
IsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.
func IsErrEmailAlreadyUsed ¶
IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.
func IsErrExternalLoginUserAlreadyExist ¶ added in v1.1.0
IsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.
func IsErrExternalLoginUserNotExist ¶ added in v1.1.0
IsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.
func IsErrGPGKeyAccessDenied ¶ added in v1.2.0
IsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.
func IsErrGPGKeyIDAlreadyUsed ¶ added in v1.2.0
IsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
func IsErrGPGKeyNotExist ¶ added in v1.2.0
IsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.
func IsErrGPGKeyParsing ¶ added in v1.2.0
IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.
func IsErrGPGNoEmailFound ¶ added in v1.2.3
IsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.
func IsErrInvalidCloneAddr ¶
IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
func IsErrInvalidMergeStyle ¶ added in v1.4.0
IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
func IsErrInvalidTagName ¶
IsErrInvalidTagName checks if an error is a ErrInvalidTagName.
func IsErrIssueNotExist ¶
IsErrIssueNotExist checks if an error is a ErrIssueNotExist.
func IsErrKeyAccessDenied ¶
IsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.
func IsErrKeyAlreadyExist ¶
IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.
func IsErrKeyNameAlreadyUsed ¶
IsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
func IsErrKeyNotExist ¶
IsErrKeyNotExist checks if an error is a ErrKeyNotExist.
func IsErrKeyUnableVerify ¶
IsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.
func IsErrLFSLockAlreadyExist ¶ added in v1.4.0
IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
func IsErrLFSLockNotExist ¶ added in v1.4.0
IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
func IsErrLFSUnauthorizedAction ¶ added in v1.4.0
IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
func IsErrLabelNotExist ¶
IsErrLabelNotExist checks if an error is a ErrLabelNotExist.
func IsErrLastOrgOwner ¶
IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.
func IsErrLoginSourceAlreadyExist ¶
IsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.
func IsErrLoginSourceInUse ¶
IsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.
func IsErrLoginSourceNotExist ¶
IsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.
func IsErrMilestoneNotExist ¶
IsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.
func IsErrNamePatternNotAllowed ¶
IsErrNamePatternNotAllowed checks if an error is an ErrNamePatternNotAllowed.
func IsErrNameReserved ¶
IsErrNameReserved checks if an error is a ErrNameReserved.
func IsErrNotAllowedToMerge ¶ added in v1.5.0
IsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.
func IsErrOpenIDAlreadyUsed ¶ added in v1.2.0
IsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.
func IsErrOpenIDConnectInitialize ¶ added in v1.2.0
IsErrOpenIDConnectInitialize checks if an error is a ExternalLoginUserAlreadyExist.
func IsErrOrgNotExist ¶ added in v1.2.0
IsErrOrgNotExist checks if an error is a ErrOrgNotExist.
func IsErrPullRequestAlreadyExists ¶ added in v1.0.0
IsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.
func IsErrPullRequestNotExist ¶
IsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.
func IsErrReachLimitOfRepo ¶
IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
func IsErrReleaseAlreadyExist ¶
IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
func IsErrReleaseNotExist ¶
IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
func IsErrRepoAlreadyExist ¶
IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
func IsErrRepoFileAlreadyExist ¶
IsErrRepoFileAlreadyExist checks if an error is a ErrRepoFileAlreadyExist.
func IsErrRepoNotExist ¶
IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
func IsErrRepoRedirectNotExist ¶ added in v1.1.0
IsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist
func IsErrReviewNotExist ¶ added in v1.6.0
IsErrReviewNotExist checks if an error is a ErrReviewNotExist.
func IsErrSSHDisabled ¶ added in v1.4.0
IsErrSSHDisabled checks if an error is a ErrSSHDisabled.
func IsErrStopwatchNotExist ¶ added in v1.3.0
IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.
func IsErrTagAlreadyExists ¶ added in v1.3.0
IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.
func IsErrTeamAlreadyExist ¶
IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.
func IsErrTopicNotExist ¶ added in v1.5.0
IsErrTopicNotExist checks if an error is an ErrTopicNotExist.
func IsErrTrackedTimeNotExist ¶ added in v1.3.0
IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.
func IsErrTwoFactorNotEnrolled ¶ added in v1.1.0
IsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.
func IsErrU2FRegistrationNotExist ¶ added in v1.5.0
IsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.
func IsErrUnknownDependencyType ¶ added in v1.6.0
IsErrUnknownDependencyType checks if an error is ErrUnknownDependencyType
func IsErrUpdateTaskNotExist ¶
IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.
func IsErrUploadNotExist ¶
IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
func IsErrUserAlreadyExist ¶
IsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.
func IsErrUserDoesNotHaveAccessToRepo ¶ added in v1.5.0
IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExist.
func IsErrUserHasOrgs ¶
IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.
func IsErrUserNotAllowedCreateOrg ¶ added in v1.1.0
IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.
func IsErrUserNotExist ¶
IsErrUserNotExist checks if an error is a ErrUserNotExist.
func IsErrUserOwnRepos ¶
IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
func IsErrWebhookNotExist ¶
IsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.
func IsErrWikiAlreadyExist ¶
IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
func IsErrWikiInvalidFileName ¶ added in v1.4.0
IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
func IsErrWikiReservedName ¶ added in v1.4.0
IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
func IsFollowing ¶
IsFollowing returns true if user is following followID.
func IsOpenIDUsed ¶ added in v1.2.0
IsOpenIDUsed returns true if the openid has been used.
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 ¶
IsUsableRepoName returns true when repository is usable
func IsUsableTeamName ¶ added in v1.0.0
IsUsableTeamName tests if a name could be as team name
func IsUsableUsername ¶
IsUsableUsername returns an error when a username is reserved
func IsUserAssignedToIssue ¶ added in v1.5.0
IsUserAssignedToIssue returns true when the user is assigned to the issue
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 IsUserInTeams ¶ added in v1.3.0
IsUserInTeams returns if a user in some teams
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 IssueNoDependenciesLeft ¶ added in v1.6.0
IssueNoDependenciesLeft checks if issue can be closed
func LinkAccountToUser ¶ added in v1.1.0
LinkAccountToUser link the gothUser to the user
func LoadFixtures ¶ added in v1.2.0
func LoadFixtures() error
LoadFixtures load fixtures for a test database
func LocalCopyPath ¶ added in v1.4.0
func LocalCopyPath() string
LocalCopyPath returns the local repository copy path.
func LocalWikiPath ¶ added in v1.4.0
func LocalWikiPath() string
LocalWikiPath returns the local wiki repository copy path.
func LookupRepoRedirect ¶ added in v1.1.0
LookupRepoRedirect look up if a repository has a redirect name
func MainTest ¶ added in v1.4.0
MainTest a reusable TestMain(..) function for unit tests that need to use a test database. Creates the test database, and sets necessary settings.
func MakeAssigneeList ¶ added in v1.5.0
MakeAssigneeList concats a string with all names of the assignees. Useful for logs.
func MakeEmailPrimary ¶
func MakeEmailPrimary(email *EmailAddress) error
MakeEmailPrimary sets primary email address of given user.
func MakeIDsFromAPIAssigneesToAdd ¶ added in v1.5.0
func MakeIDsFromAPIAssigneesToAdd(oneAssignee string, multipleAssignees []string) (assigneeIDs []int64, err error)
MakeIDsFromAPIAssigneesToAdd returns an array with all assignee IDs
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 MirrorSyncCreateAction ¶ added in v1.6.0
func MirrorSyncCreateAction(repo *Repository, refName string) error
MirrorSyncCreateAction adds new action for mirror synchronization of new reference.
func MirrorSyncDeleteAction ¶ added in v1.6.0
func MirrorSyncDeleteAction(repo *Repository, refName string) error
MirrorSyncDeleteAction adds new action for mirror synchronization of delete reference.
func MirrorSyncPushAction ¶ added in v1.6.0
func MirrorSyncPushAction(repo *Repository, opts MirrorSyncPushActionOptions) error
MirrorSyncPushAction adds new action for mirror synchronization of pushed commits.
func NewAccessToken ¶
func NewAccessToken(t *AccessToken) error
NewAccessToken creates new access token.
func NewCommitStatus ¶ added in v1.2.0
func NewCommitStatus(repo *Repository, creator *User, sha string, status *CommitStatus) error
NewCommitStatus creates a new CommitStatus given a bunch of parameters NOTE: All text-values will be trimmed from whitespaces. Requires: Repo, Creator, SHA
func NewIssue ¶
func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, assigneeIDs []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 NewMilestone ¶
NewMilestone creates new milestone of repository.
func NewPullRequest ¶
func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, pr *PullRequest, patch []byte, assigneeIDs []int64) (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 NewRepoRedirect ¶ added in v1.1.0
NewRepoRedirect create a new repo redirect
func NewTeam ¶
NewTeam creates a record of new team. It's caller's responsibility to assign organization ID.
func NewTestEngine ¶
NewTestEngine sets a new test xorm.Engine
func NewTwoFactor ¶ added in v1.1.0
NewTwoFactor creates a new two-factor authentication token.
func NormalizeWikiName ¶ added in v1.4.0
NormalizeWikiName normalizes a wiki name
func NotifyWatchers ¶
NotifyWatchers creates batch of actions for every watcher.
func ParseCommitsWithSignature ¶ added in v1.2.0
ParseCommitsWithSignature checks if signaute of commits are corresponding to users gpg keys.
func ParseCommitsWithStatus ¶ added in v1.2.0
func ParseCommitsWithStatus(oldCommits *list.List, repo *Repository) *list.List
ParseCommitsWithStatus checks commits latest statuses and calculates its worst status state
func PrepareTestDatabase ¶ added in v1.2.0
func PrepareTestDatabase() error
PrepareTestDatabase load test fixtures into test database
func PrepareTestEnv ¶ added in v1.4.0
PrepareTestEnv prepares the environment for unit tests. Can only be called by tests that use the above MainTest(..) function.
func PrepareWebhook ¶ added in v1.3.0
func PrepareWebhook(w *Webhook, repo *Repository, event HookEventType, p api.Payloader) error
PrepareWebhook adds special webhook to task queue for given payload.
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(branch string, opt PushUpdateOptions) 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 RemoveAccountLink ¶ added in v1.1.0
RemoveAccountLink will remove all external login sources for the given user
func RemoveAllWithNotice ¶
func RemoveAllWithNotice(title, path string)
RemoveAllWithNotice removes all directories in given path and creates a system notice when error occurs.
func RemoveIssueDependency ¶ added in v1.6.0
func RemoveIssueDependency(user *User, issue *Issue, dep *Issue, depType DependencyType) (err error)
RemoveIssueDependency removes a dependency from an issue
func RemoveOldDeletedBranches ¶ added in v1.3.0
func RemoveOldDeletedBranches()
RemoveOldDeletedBranches removes old deleted branches
func RemoveOrgUser ¶
RemoveOrgUser removes user from given organization.
func RemoveTeamMember ¶
RemoveTeamMember removes member from given team of given organization.
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 outside any session scope independently.
func SMTPAuth ¶
func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error
SMTPAuth performs an SMTP authentication.
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.
func SaveTopics ¶ added in v1.5.0
SaveTopics save topics to a repository
func SecToTime ¶ added in v1.5.0
SecToTime converts an amount of seconds to a human-readable string (example: 66s -> 1min 6s)
func SendActivateAccountMail ¶
func SendActivateAccountMail(c *macaron.Context, u *User)
SendActivateAccountMail sends an activation mail to the user (new user registration)
func SendActivateEmailMail ¶
func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress)
SendActivateEmailMail sends confirmation email to confirm new email address
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)
SendResetPasswordMail sends a password reset mail to the user
func SendUserMail ¶
SendUserMail sends a mail to the user
func SetNotificationStatus ¶ added in v1.1.0
func SetNotificationStatus(notificationID int64, user *User, status NotificationStatus) error
SetNotificationStatus change the notification status
func SlackLinkFormatter ¶
SlackLinkFormatter creates a link compatible with slack
func SlackLinkToRef ¶ added in v1.3.0
SlackLinkToRef slack-formatter link to a repo ref
func SlackShortTextFormatter ¶
SlackShortTextFormatter replaces &, <, > with HTML characters
func SlackTextFormatter ¶
SlackTextFormatter replaces &, <, > with HTML characters see: https://api.slack.com/docs/formatting
func SortReleases ¶
func SortReleases(rels []*Release)
SortReleases sorts releases by number of commits and created time.
func StopwatchExists ¶ added in v1.3.0
StopwatchExists returns true if the stopwatch exists
func SyncExternalUsers ¶ added in v1.2.0
func SyncExternalUsers()
SyncExternalUsers is used to synchronize users with external authorization source
func SyncMirrors ¶
func SyncMirrors()
SyncMirrors checks and syncs mirrors. TODO: sync more mirrors at same time.
func SyncReleasesWithTags ¶ added in v1.2.0
func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error
SyncReleasesWithTags synchronizes release table with repository tags
func SyncRepositoryHooks ¶ added in v1.1.0
func SyncRepositoryHooks() error
SyncRepositoryHooks rewrites all repositories' pre-receive, update and post-receive hooks to make sure the binary and custom conf path are up-to-date.
func TestPullRequests ¶
func TestPullRequests()
TestPullRequests checks and tests untested patches of pull requests. TODO: test more pull requests at same time.
func ToggleUserOpenIDVisibility ¶ added in v1.2.0
ToggleUserOpenIDVisibility toggles visibility of an openid address of given user.
func TotalTimes ¶ added in v1.3.0
func TotalTimes(options FindTrackedTimesOptions) (map[*User]string, error)
TotalTimes returns the spent time for each user by an issue
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 as another's follower.
func UpdateAPIAssignee ¶ added in v1.5.0
func UpdateAPIAssignee(issue *Issue, oneAssignee string, multipleAssignees []string, doer *User) (err error)
UpdateAPIAssignee is a helper function to add or delete one or multiple issue assignee(s) Deleting is done the Github way (quote from their api documentation): https://developer.github.com/v3/issues/#edit-an-issue "assignees" (array): Logins for Users to assign to this issue. Pass one or more user logins to replace the set of assignees on this Issue. Send an empty array ([]) to clear all assignees from the Issue.
func UpdateAccessToken ¶
func UpdateAccessToken(t *AccessToken) error
UpdateAccessToken updates information of access token.
func UpdateAssignee ¶ added in v1.5.0
UpdateAssignee deletes or adds an assignee to an issue
func UpdateAttachment ¶ added in v1.5.0
func UpdateAttachment(atta *Attachment) error
UpdateAttachment updates the given attachment in database
func UpdateComment ¶
UpdateComment updates information of comment.
func UpdateDeployKey ¶
UpdateDeployKey updates deploy key information.
func UpdateDeployKeyCols ¶ added in v1.4.0
UpdateDeployKeyCols updates deploy key information in the specified columns.
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 UpdateIssueDeadline ¶ added in v1.5.0
UpdateIssueDeadline updates an issue deadline and adds comments. Setting a deadline to 0 means deleting it.
func UpdateIssueIndexer ¶ added in v1.1.0
func UpdateIssueIndexer(issueID int64)
UpdateIssueIndexer add/update an issue to the issue indexer
func UpdateIssueIndexerCols ¶ added in v1.4.0
UpdateIssueIndexerCols update an issue in the issue indexer, given changes to the specified columns
func UpdateIssueMentions ¶
UpdateIssueMentions extracts mentioned people from content and updates issue-user relations for them.
func UpdateIssueUserByRead ¶
UpdateIssueUserByRead updates issue-user relation for reading.
func UpdateIssueUsersByMentions ¶
UpdateIssueUsersByMentions updates issue-user pairs by mentioning.
func UpdateIssuesCommit ¶
func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) error
UpdateIssuesCommit checks if issues are manipulated by commit message.
func UpdateLocalCopyBranch ¶
UpdateLocalCopyBranch 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 UpdateNotificationStatuses ¶ added in v1.4.0
func UpdateNotificationStatuses(user *User, currentStatus NotificationStatus, desiredStatus NotificationStatus) error
UpdateNotificationStatuses updates the statuses of all of a user's notifications that are of the currentStatus type to the desiredStatus
func UpdateProtectBranch ¶ added in v1.3.0
func UpdateProtectBranch(repo *Repository, protectBranch *ProtectedBranch, whitelistUserIDs, whitelistTeamIDs, mergeWhitelistUserIDs, mergeWhitelistTeamIDs []int64) (err error)
UpdateProtectBranch saves branch protection options of repository. If ID is 0, it creates a new record. Otherwise, updates existing record. This function also performs check if whitelist user and team's IDs have been changed to avoid unnecessary whitelist delete and regenerate.
func UpdatePublicKeyUpdated ¶ added in v1.2.0
UpdatePublicKeyUpdated updates public key use time.
func UpdateRelease ¶
func UpdateRelease(doer *User, gitRepo *git.Repository, rel *Release, attachmentUUIDs []string) (err error)
UpdateRelease updates information of a release.
func UpdateRepoIndexer ¶ added in v1.3.0
func UpdateRepoIndexer(repo *Repository)
UpdateRepoIndexer update a repository's entries in the indexer
func UpdateRepository ¶
func UpdateRepository(repo *Repository, visibilityChanged bool) (err error)
UpdateRepository updates a repository
func UpdateRepositoryUnits ¶ added in v1.1.0
func UpdateRepositoryUnits(repo *Repository, units []RepoUnit) (err error)
UpdateRepositoryUnits updates a repository's units
func UpdateReview ¶ added in v1.6.0
UpdateReview will update all cols of the given review in db
func UpdateSource ¶
func UpdateSource(source *LoginSource) error
UpdateSource updates a LoginSource record in DB.
func UpdateTeam ¶
UpdateTeam updates information of team.
func UpdateTeamUnits ¶ added in v1.5.0
UpdateTeamUnits updates a teams's units
func UpdateTwoFactor ¶ added in v1.1.0
UpdateTwoFactor updates a two-factor authentication token.
func UpdateUserCols ¶ added in v1.2.0
UpdateUserCols update user according special columns
func UpdateUserSetting ¶ added in v1.1.0
UpdateUserSetting updates user's settings.
func UpdateWebhook ¶
UpdateWebhook updates information of webhook.
func UpdateWebhookLastStatus ¶ added in v1.3.0
UpdateWebhookLastStatus updates last status 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.
func ValidateTopic ¶ added in v1.5.0
ValidateTopic checks topics by length and match pattern rules
func WikiFilenameToName ¶ added in v1.4.0
WikiFilenameToName converts a wiki filename to its corresponding page name.
func WikiNameToFilename ¶ added in v1.4.0
WikiNameToFilename converts a wiki name to its corresponding filename.
func WikiNameToSubURL ¶ added in v1.4.0
WikiNameToSubURL converts a wiki name to its corresponding sub-URL.
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
AccessMode specifies the users access mode
const ( // AccessModeNone no access AccessModeNone AccessMode = iota // 0 // AccessModeRead read access AccessModeRead // 1 // AccessModeWrite write access AccessModeWrite // 2 // AccessModeAdmin admin access AccessModeAdmin // 3 // AccessModeOwner owner access AccessModeOwner // 4 )
func AccessLevel ¶
func AccessLevel(userID int64, repo *Repository) (AccessMode, error)
AccessLevel returns the Access a user has to a repository. Will return NoneAccess if the user does not have access.
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)"` CreatedUnix util.TimeStamp `xorm:"INDEX created"` UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` 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) AfterLoad ¶ added in v1.3.0
func (t *AccessToken) AfterLoad()
AfterLoad is invoked from XORM after setting the values of all fields of this object.
type AccessibleReposEnvironment ¶ added in v1.1.0
type AccessibleReposEnvironment interface { CountRepos() (int64, error) RepoIDs(page, pageSize int) ([]int64, error) Repos(page, pageSize int) ([]*Repository, error) MirrorRepos() ([]*Repository, error) }
AccessibleReposEnvironment operations involving the repositories that are accessible to a particular user
type Action ¶
type Action struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"INDEX"` // Receiver user id. OpType ActionType ActUserID int64 `xorm:"INDEX"` // Action user id. ActUser *User `xorm:"-"` RepoID int64 `xorm:"INDEX"` Repo *Repository `xorm:"-"` CommentID int64 `xorm:"INDEX"` Comment *Comment `xorm:"-"` IsDeleted bool `xorm:"INDEX NOT NULL DEFAULT false"` RefName string IsPrivate bool `xorm:"INDEX NOT NULL DEFAULT false"` Content string `xorm:"TEXT"` CreatedUnix util.TimeStamp `xorm:"INDEX created"` }
Action represents user operation type and other information to repository. It implemented interface base.Actioner so that can be used in template render.
func GetFeeds ¶
func GetFeeds(opts GetFeedsOptions) ([]*Action, error)
GetFeeds returns actions according to the provided options
func (*Action) GetActAvatar ¶ added in v1.2.0
GetActAvatar the action's user's avatar link
func (*Action) GetActFullName ¶ added in v1.6.0
GetActFullName gets the action's user full name.
func (*Action) GetActUserName ¶
GetActUserName gets the action's user name.
func (*Action) GetCommentLink ¶ added in v1.2.0
GetCommentLink returns link to action comment.
func (*Action) GetContent ¶
GetContent returns the action's content.
func (*Action) GetIssueContent ¶
GetIssueContent returns the content of first issue associated with this action.
func (*Action) GetIssueInfos ¶
GetIssueInfos returns a list of issues associated with the action.
func (*Action) GetIssueTitle ¶
GetIssueTitle returns the title of first issue associated with the action.
func (*Action) GetOpType ¶
func (a *Action) GetOpType() ActionType
GetOpType gets the ActionType of this action.
func (*Action) GetRepoLink ¶
GetRepoLink returns relative link to action repository.
func (*Action) GetRepoName ¶
GetRepoName returns the name of the action repository.
func (*Action) GetRepoPath ¶
GetRepoPath returns the virtual path to the action repository.
func (*Action) GetRepoUserName ¶
GetRepoUserName returns the name of the action repository owner.
func (*Action) ShortActUserName ¶
ShortActUserName gets the action's user name trimmed to max 20 chars.
func (*Action) ShortRepoName ¶
ShortRepoName returns the name of the action repository trimmed to max 33 chars.
func (*Action) ShortRepoPath ¶
ShortRepoPath returns the virtual path to the action repository trimmed to max 20 + 1 + 33 chars.
func (*Action) ShortRepoUserName ¶
ShortRepoUserName returns the name of the action repository owner trimmed to max 20 chars.
type ActionList ¶ added in v1.4.0
type ActionList []*Action
ActionList defines a list of actions
func (ActionList) LoadAttributes ¶ added in v1.4.0
func (actions ActionList) LoadAttributes() error
LoadAttributes loads attributes of the actions
func (ActionList) LoadRepositories ¶ added in v1.4.0
func (actions ActionList) LoadRepositories() ([]*Repository, error)
LoadRepositories loads actions' all repositories
func (ActionList) LoadUsers ¶ added in v1.4.0
func (actions ActionList) LoadUsers() ([]*User, error)
LoadUsers loads actions' all users
type ActionType ¶
type ActionType int
ActionType represents the type of an action.
const ( ActionCreateRepo ActionType = iota + 1 // 1 ActionRenameRepo // 2 ActionStarRepo // 3 ActionWatchRepo // 4 ActionCommitRepo // 5 ActionCreateIssue // 6 ActionCreatePullRequest // 7 ActionTransferRepo // 8 ActionPushTag // 9 ActionCommentIssue // 10 ActionMergePullRequest // 11 ActionCloseIssue // 12 ActionReopenIssue // 13 ActionClosePullRequest // 14 ActionReopenPullRequest // 15 ActionDeleteTag // 16 ActionDeleteBranch // 17 ActionMirrorSyncPush // 18 ActionMirrorSyncCreate // 19 ActionMirrorSyncDelete // 20 )
Possible action types.
type ActivityStats ¶ added in v1.3.0
type ActivityStats struct { OpenedPRs PullRequestList OpenedPRAuthorCount int64 MergedPRs PullRequestList MergedPRAuthorCount int64 OpenedIssues IssueList OpenedIssueAuthorCount int64 ClosedIssues IssueList ClosedIssueAuthorCount int64 UnresolvedIssues IssueList PublishedReleases []*Release PublishedReleaseAuthorCount int64 }
ActivityStats represets issue and pull request information.
func GetActivityStats ¶ added in v1.3.0
func GetActivityStats(repoID int64, timeFrom time.Time, releases, issues, prs bool) (*ActivityStats, error)
GetActivityStats return stats for repository at given time range
func (*ActivityStats) ActiveIssueCount ¶ added in v1.3.0
func (stats *ActivityStats) ActiveIssueCount() int
ActiveIssueCount returns total active issue count
func (*ActivityStats) ActivePRCount ¶ added in v1.3.0
func (stats *ActivityStats) ActivePRCount() int
ActivePRCount returns total active pull request count
func (*ActivityStats) ClosedIssueCount ¶ added in v1.3.0
func (stats *ActivityStats) ClosedIssueCount() int
ClosedIssueCount returns closed issue count
func (*ActivityStats) ClosedIssuePerc ¶ added in v1.3.0
func (stats *ActivityStats) ClosedIssuePerc() int
ClosedIssuePerc returns closed issue count percent from total active
func (*ActivityStats) FillIssues ¶ added in v1.3.0
func (stats *ActivityStats) FillIssues(repoID int64, fromTime time.Time) error
FillIssues returns issue information for activity page
func (*ActivityStats) FillPullRequests ¶ added in v1.3.0
func (stats *ActivityStats) FillPullRequests(repoID int64, fromTime time.Time) error
FillPullRequests returns pull request information for activity page
func (*ActivityStats) FillReleases ¶ added in v1.3.0
func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
FillReleases returns release information for activity page
func (*ActivityStats) FillUnresolvedIssues ¶ added in v1.3.0
func (stats *ActivityStats) FillUnresolvedIssues(repoID int64, fromTime time.Time, issues, prs bool) error
FillUnresolvedIssues returns unresolved issue and pull request information for activity page
func (*ActivityStats) MergedPRCount ¶ added in v1.3.0
func (stats *ActivityStats) MergedPRCount() int
MergedPRCount returns merged pull request count
func (*ActivityStats) MergedPRPerc ¶ added in v1.3.0
func (stats *ActivityStats) MergedPRPerc() int
MergedPRPerc returns merged pull request percent from total active
func (*ActivityStats) OpenedIssueCount ¶ added in v1.3.0
func (stats *ActivityStats) OpenedIssueCount() int
OpenedIssueCount returns open issue count
func (*ActivityStats) OpenedIssuePerc ¶ added in v1.3.0
func (stats *ActivityStats) OpenedIssuePerc() int
OpenedIssuePerc returns open issue count percent from total active
func (*ActivityStats) OpenedPRCount ¶ added in v1.3.0
func (stats *ActivityStats) OpenedPRCount() int
OpenedPRCount returns opened pull request count
func (*ActivityStats) OpenedPRPerc ¶ added in v1.3.0
func (stats *ActivityStats) OpenedPRPerc() int
OpenedPRPerc returns opened pull request percents from total active
func (*ActivityStats) PublishedReleaseCount ¶ added in v1.3.0
func (stats *ActivityStats) PublishedReleaseCount() int
PublishedReleaseCount returns published release count
func (*ActivityStats) UnresolvedIssueCount ¶ added in v1.3.0
func (stats *ActivityStats) UnresolvedIssueCount() int
UnresolvedIssueCount returns unresolved issue and pull request count
type Attachment ¶
type Attachment struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"uuid UNIQUE"` IssueID int64 `xorm:"INDEX"` ReleaseID int64 `xorm:"INDEX"` CommentID int64 Name string DownloadCount int64 `xorm:"DEFAULT 0"` Size int64 `xorm:"DEFAULT 0"` CreatedUnix util.TimeStamp `xorm:"created"` }
Attachment represent a attachment of issue/comment/release.
func GetAttachmentByID ¶ added in v1.5.0
func GetAttachmentByID(id int64) (*Attachment, error)
GetAttachmentByID returns attachment by given id
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) APIFormat ¶ added in v1.5.0
func (a *Attachment) APIFormat() *api.Attachment
APIFormat converts models.Attachment to api.Attachment
func (*Attachment) DownloadURL ¶ added in v1.5.0
func (a *Attachment) DownloadURL() string
DownloadURL returns the download url of the attached file
func (*Attachment) IncreaseDownloadCount ¶ added in v1.2.0
func (a *Attachment) IncreaseDownloadCount() error
IncreaseDownloadCount is update download count + 1
func (*Attachment) LocalPath ¶
func (a *Attachment) LocalPath() string
LocalPath returns where attachment is stored in local file system.
type Branch ¶
Branch holds the branch information
func GetBranchesByPath ¶
GetBranchesByPath returns a branch by it's path
type CodeComments ¶ added in v1.6.0
CodeComments represents comments on code by using this structure: FILENAME -> LINE (+ == proposed; - == previous) -> COMMENTS
func FetchCodeComments ¶ added in v1.6.0
func FetchCodeComments(issue *Issue, currentUser *User) (CodeComments, error)
FetchCodeComments will return a 2d-map: ["Path"]["Line"] = Comments at line
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
ModeI18nKey returns the collaboration mode I18n Key
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 `xorm:"INDEX"` Poster *User `xorm:"-"` IssueID int64 `xorm:"INDEX"` Issue *Issue `xorm:"-"` LabelID int64 Label *Label `xorm:"-"` OldMilestoneID int64 MilestoneID int64 OldMilestone *Milestone `xorm:"-"` Milestone *Milestone `xorm:"-"` AssigneeID int64 RemovedAssignee bool Assignee *User `xorm:"-"` OldTitle string NewTitle string DependentIssueID int64 DependentIssue *Issue `xorm:"-"` CommitID int64 Line int64 // - previous line / + proposed line TreePath string Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` // Path represents the 4 lines of code cemented by this comment Patch string `xorm:"TEXT"` CreatedUnix util.TimeStamp `xorm:"INDEX created"` UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` // Reference issue in commit message CommitSHA string `xorm:"VARCHAR(40)"` Attachments []*Attachment `xorm:"-"` Reactions ReactionList `xorm:"-"` // For view issue page. ShowTag CommentTag `xorm:"-"` Review *Review `xorm:"-"` ReviewID int64 Invalidated bool }
Comment represents a comment in commit and issue page.
func CreateCodeComment ¶ added in v1.6.0
func CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, treePath string, line, reviewID int64) (*Comment, error)
CreateCodeComment creates a plain code comment at the specified line / path
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 FindComments ¶ added in v1.2.0
func FindComments(opts FindCommentsOptions) ([]*Comment, error)
FindComments returns all comments according options
func GetCommentByID ¶
GetCommentByID returns the comment by given ID.
func GetCommentsByIssueID ¶
GetCommentsByIssueID returns all comments of an issue.
func GetCommentsByIssueIDSince ¶
GetCommentsByIssueIDSince returns a list of comments of an issue since a given time point.
func GetCommentsByRepoIDSince ¶ added in v1.0.0
GetCommentsByRepoIDSince returns a list of comments for all issues in a repo since a given time point.
func (*Comment) AfterDelete ¶
func (c *Comment) AfterDelete()
AfterDelete is invoked from XORM after the object is deleted.
func (*Comment) AfterLoad ¶ added in v1.3.0
AfterLoad is invoked from XORM after setting the values of all fields of this object.
func (*Comment) CheckInvalidation ¶ added in v1.6.0
CheckInvalidation checks if the line of code comment got changed by another commit. If the line got changed the comment is going to be invalidated.
func (*Comment) CodeCommentURL ¶ added in v1.6.0
CodeCommentURL returns the url to a comment in code
func (*Comment) DiffSide ¶ added in v1.6.0
DiffSide returns "previous" if Comment.Line is a LOC of the previous changes and "proposed" if it is a LOC of the proposed changes.
func (*Comment) LoadAssigneeUser ¶ added in v1.5.0
LoadAssigneeUser if comment.Type is CommentTypeAssignees, then load assignees
func (*Comment) LoadDepIssueDetails ¶ added in v1.6.0
LoadDepIssueDetails loads Dependent Issue Details
func (*Comment) LoadLabel ¶ added in v1.1.0
LoadLabel if comment.Type is CommentTypeLabel, then load Label
func (*Comment) LoadMilestone ¶ added in v1.1.0
LoadMilestone if comment.Type is CommentTypeMilestone, then load milestone
func (*Comment) LoadReactions ¶ added in v1.4.0
LoadReactions loads comment reactions
func (*Comment) LoadReview ¶ added in v1.6.0
LoadReview loads the associated review
func (*Comment) MailParticipants ¶
func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (err error)
MailParticipants sends new comment emails to repository watchers and mentioned people.
func (*Comment) MustAsDiff ¶ added in v1.6.0
MustAsDiff executes AsDiff and logs the error instead of returning
func (*Comment) UnsignedLine ¶ added in v1.6.0
UnsignedLine returns the LOC of the code comment without + or -
type CommentTag ¶
type CommentTag int
CommentTag defines comment tag type
const ( CommentTagNone CommentTag = iota CommentTagPoster CommentTagWriter CommentTagOwner )
Enumerate all the comment tag types
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) CommentTypeComment CommentType = iota CommentTypeReopen CommentTypeClose // References. CommentTypeIssueRef // Reference from a commit (not part of a pull request) CommentTypeCommitRef // Reference from a comment CommentTypeCommentRef // Reference from a pull request CommentTypePullRef // Labels changed CommentTypeLabel // Milestone changed CommentTypeMilestone // Assignees changed CommentTypeAssignees // Change Title CommentTypeChangeTitle // Delete Branch CommentTypeDeleteBranch // Start a stopwatch for time tracking CommentTypeStartTracking // Stop a stopwatch for time tracking CommentTypeStopTracking // Add time manual for time tracking CommentTypeAddTimeManual // Cancel a stopwatch for time tracking CommentTypeCancelTracking // Added a due date CommentTypeAddedDeadline // Modified the due date CommentTypeModifiedDeadline // Removed a due date CommentTypeRemovedDeadline // Dependency added CommentTypeAddDependency //Dependency removed CommentTypeRemoveDependency // Comment a line of code CommentTypeCode // Reviews a pull request by giving general feedback CommentTypeReview )
Enumerate all the comment types
const (
CommentTypeUnknown CommentType = -1
)
define unknown comment type
type CommitRepoActionOptions ¶
type CommitRepoActionOptions struct { PusherName string RepoOwnerID int64 RepoName string RefFullName string OldCommitID string NewCommitID string Commits *PushCommits }
CommitRepoActionOptions represent options of a new commit action.
type CommitStatus ¶ added in v1.2.0
type CommitStatus struct { ID int64 `xorm:"pk autoincr"` Index int64 `xorm:"INDEX UNIQUE(repo_sha_index)"` RepoID int64 `xorm:"INDEX UNIQUE(repo_sha_index)"` Repo *Repository `xorm:"-"` State CommitStatusState `xorm:"VARCHAR(7) NOT NULL"` SHA string `xorm:"VARCHAR(64) NOT NULL INDEX UNIQUE(repo_sha_index)"` TargetURL string `xorm:"TEXT"` Description string `xorm:"TEXT"` Context string `xorm:"TEXT"` Creator *User `xorm:"-"` CreatorID int64 CreatedUnix util.TimeStamp `xorm:"INDEX created"` UpdatedUnix util.TimeStamp `xorm:"INDEX updated"` }
CommitStatus holds a single Status of a single Commit
func CalcCommitStatus ¶ added in v1.3.0
func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus
CalcCommitStatus returns commit status state via some status, the commit statues should order by id desc
func GetCommitStatus ¶ added in v1.2.0
func GetCommitStatus(repo *Repository, sha string, status *CommitStatus) (*CommitStatus, error)
GetCommitStatus populates a given status for a given commit. NOTE: If ID or Index isn't given, and only Context, TargetURL and/or Description
is given, the CommitStatus created _last_ will be returned.
func GetCommitStatuses ¶ added in v1.2.0
func GetCommitStatuses(repo *Repository, sha string, page int) ([]*CommitStatus, error)
GetCommitStatuses returns all statuses for a given commit.
func GetLatestCommitStatus ¶ added in v1.2.0
func GetLatestCommitStatus(repo *Repository, sha string, page int) ([]*CommitStatus, error)
GetLatestCommitStatus returns all statuses with a unique context for a given commit.
func (*CommitStatus) APIFormat ¶ added in v1.2.0
func (status *CommitStatus) APIFormat() *api.Status
APIFormat assumes some fields assigned with values: Required - Repo, Creator
func (*CommitStatus) APIURL ¶ added in v1.2.0
func (status *CommitStatus) APIURL() string
APIURL returns the absolute APIURL to this commit-status.
type CommitStatusState ¶ added in v1.2.0
type CommitStatusState string
CommitStatusState holds the state of a Status It can be "pending", "success", "error", "failure", and "warning"
const ( // CommitStatusPending is for when the Status is Pending CommitStatusPending CommitStatusState = "pending" // CommitStatusSuccess is for when the Status is Success CommitStatusSuccess CommitStatusState = "success" // CommitStatusError is for when the Status is Error CommitStatusError CommitStatusState = "error" // CommitStatusFailure is for when the Status is Failure CommitStatusFailure CommitStatusState = "failure" // CommitStatusWarning is for when the Status is Warning CommitStatusWarning CommitStatusState = "warning" )
func (CommitStatusState) IsWorseThan ¶ added in v1.2.0
func (css CommitStatusState) IsWorseThan(css2 CommitStatusState) bool
IsWorseThan returns true if this State is worse than the given State
type CommitVerification ¶ added in v1.2.0
CommitVerification represents a commit validation of signature
func ParseCommitWithSignature ¶ added in v1.2.0
func ParseCommitWithSignature(c *git.Commit) *CommitVerification
ParseCommitWithSignature check if signature is good against keystore.
type CreateCommentOptions ¶
type CreateCommentOptions struct { Type CommentType Doer *User Repo *Repository Issue *Issue Label *Label DependentIssueID int64 OldMilestoneID int64 MilestoneID int64 AssigneeID int64 RemovedAssignee bool OldTitle string NewTitle string CommitID int64 CommitSHA string Patch string LineNum int64 TreePath string ReviewID int64 Content string Attachments []string // UUIDs of attachments }
CreateCommentOptions defines options for creating comment
type CreateRepoOptions ¶
type CreateRepoOptions struct { Name string Description string Gitignores string License string Readme string IsPrivate bool IsMirror bool AutoInit bool }
CreateRepoOptions contains the create repository options
type CreateReviewOptions ¶ added in v1.6.0
type CreateReviewOptions struct { Content string Type ReviewType Issue *Issue Reviewer *User }
CreateReviewOptions represent the options to create a review. Type, Issue and Reviewer are required.
type DeleteRepoFileOptions ¶
type DeleteRepoFileOptions struct { LastCommitID string OldBranch string NewBranch string TreePath string Message string }
DeleteRepoFileOptions holds the repository delete file options
type DeletedBranch ¶ added in v1.3.0
type DeletedBranch struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` Name string `xorm:"UNIQUE(s) NOT NULL"` Commit string `xorm:"UNIQUE(s) NOT NULL"` DeletedByID int64 `xorm:"INDEX"` DeletedBy *User `xorm:"-"` DeletedUnix util.TimeStamp `xorm:"INDEX created"` }
DeletedBranch struct
func (*DeletedBranch) LoadUser ¶ added in v1.3.0
func (deletedBranch *DeletedBranch) LoadUser()
LoadUser loads the user that deleted the branch When there's no user found it returns a NewGhostUser
type DependencyType ¶ added in v1.6.0
type DependencyType int
DependencyType Defines Dependency Type Constants
const ( DependencyTypeBlockedBy DependencyType = iota DependencyTypeBlocking )
Define Dependency Types
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:"-"` Mode AccessMode `xorm:"NOT NULL DEFAULT 1"` CreatedUnix util.TimeStamp `xorm:"created"` UpdatedUnix util.TimeStamp `xorm:"updated"` 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) AfterLoad ¶ added in v1.3.0
func (key *DeployKey) AfterLoad()
AfterLoad is invoked from XORM after setting the values of all fields of this object.
func (*DeployKey) GetContent ¶
GetContent gets associated public key content.
func (*DeployKey) IsReadOnly ¶ added in v1.4.0
IsReadOnly checks if the key can only be used for read operations
type Diff ¶
Diff represents a difference between two git trees.
func GetDiffCommit ¶
func GetDiffCommit(repoPath, commitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)
GetDiffCommit builds a Diff representing the given commitID.
func GetDiffRange ¶
func GetDiffRange(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int) (*Diff, error)
GetDiffRange builds a Diff between two commits of a repository. passing the empty string as beforeCommitID returns a diff from the parent commit.
func GetDiffRangeWithWhitespaceBehavior ¶ added in v1.6.0
func GetDiffRangeWithWhitespaceBehavior(repoPath, beforeCommitID, afterCommitID string, maxLines, maxLineCharacters, maxFiles int, whitespaceBehavior string) (*Diff, error)
GetDiffRangeWithWhitespaceBehavior builds a Diff between two commits of a repository. Passing the empty string as beforeCommitID returns a diff from the parent commit. The whitespaceBehavior is either an empty string or a git flag
func ParsePatch ¶
ParsePatch builds a Diff object from a io.Reader and some parameters. TODO: move this function to gogits/git-module
func (*Diff) LoadComments ¶ added in v1.6.0
LoadComments loads comments into each line
type DiffFile ¶
type DiffFile struct { Name string OldName string Index int Addition, Deletion int Type DiffFileType IsCreated bool IsDeleted bool IsBin bool IsLFSFile bool IsRenamed bool IsSubmodule bool Sections []*DiffSection IsIncomplete bool }
DiffFile represents a file diff.
func (*DiffFile) GetHighlightClass ¶
GetHighlightClass returns highlight class for a filename.
type DiffFileType ¶
type DiffFileType uint8
DiffFileType represents the type of a DiffFile.
const ( DiffFileAdd DiffFileType = iota + 1 DiffFileChange DiffFileDel DiffFileRename )
DiffFileType possible values.
type DiffLine ¶
type DiffLine struct { LeftIdx int RightIdx int Type DiffLineType Content string Comments []*Comment }
DiffLine represents a line difference in a DiffSection.
func (*DiffLine) CanComment ¶ added in v1.6.0
CanComment returns whether or not a line can get commented
func (*DiffLine) GetCommentSide ¶ added in v1.6.0
GetCommentSide returns the comment side of the first comment, if not set returns empty string
type DiffLineType ¶
type DiffLineType uint8
DiffLineType represents the type of a DiffLine.
const ( DiffLinePlain DiffLineType = iota + 1 DiffLineAdd DiffLineDel DiffLineSection )
DiffLineType possible values.
type DiffSection ¶
DiffSection represents a section of a DiffFile.
func (*DiffSection) GetComputedInlineDiffFor ¶
func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) template.HTML
GetComputedInlineDiffFor computes inline diff for the given line.
func (*DiffSection) GetLine ¶
func (diffSection *DiffSection) GetLine(lineType DiffLineType, idx int) *DiffLine
GetLine gets a specific line by type (add or del) and file line number
type DingtalkPayload ¶ added in v1.4.0
DingtalkPayload represents
func GetDingtalkPayload ¶ added in v1.4.0
func GetDingtalkPayload(p api.Payloader, event HookEventType, meta string) (*DingtalkPayload, error)
GetDingtalkPayload converts a ding talk webhook into a DingtalkPayload
func (*DingtalkPayload) JSONPayload ¶ added in v1.4.0
func (p *DingtalkPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the DingtalkPayload to json
func (*DingtalkPayload) SetSecret ¶ added in v1.4.0
func (p *DingtalkPayload) SetSecret(_ string)
SetSecret sets the dingtalk secret
type DiscordEmbed ¶ added in v1.3.0
type DiscordEmbed struct { Title string `json:"title"` Description string `json:"description"` URL string `json:"url"` Color int `json:"color"` Author DiscordEmbedAuthor `json:"author"` Fields []DiscordEmbedField `json:"fields"` }
DiscordEmbed is for Embed Structure
type DiscordEmbedAuthor ¶ added in v1.3.0
type DiscordEmbedAuthor struct { Name string `json:"name"` URL string `json:"url"` IconURL string `json:"icon_url"` }
DiscordEmbedAuthor for Embed Author Structure
type DiscordEmbedField ¶ added in v1.3.0
DiscordEmbedField for Embed Field Structure
type DiscordEmbedFooter ¶ added in v1.3.0
type DiscordEmbedFooter struct {
}DiscordEmbedFooter for Embed Footer Structure.
type DiscordMeta ¶ added in v1.3.0
DiscordMeta contains the discord metadata
type DiscordPayload ¶ added in v1.3.0
type DiscordPayload struct { Wait bool `json:"wait"` Content string `json:"content"` Username string `json:"username"` AvatarURL string `json:"avatar_url"` TTS bool `json:"tts"` Embeds []DiscordEmbed `json:"embeds"` }
DiscordPayload represents
func GetDiscordPayload ¶ added in v1.3.0
func GetDiscordPayload(p api.Payloader, event HookEventType, meta string) (*DiscordPayload, error)
GetDiscordPayload converts a discord webhook into a DiscordPayload
func (*DiscordPayload) JSONPayload ¶ added in v1.3.0
func (p *DiscordPayload) JSONPayload() ([]byte, error)
JSONPayload Marshals the DiscordPayload to json
func (*DiscordPayload) SetSecret ¶ added in v1.3.0
func (p *DiscordPayload) SetSecret(_ string)
SetSecret sets the discord secret
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:"-"` }
EmailAddress 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
VerifyActiveEmailCode verifies active email code when active account
func (*EmailAddress) Activate ¶
func (email *EmailAddress) Activate() error
Activate activates the email address to given user.