From ff2fd08228dd6323ac4a1cbd2f37f8ae15733eab Mon Sep 17 00:00:00 2001 From: Gusted Date: Mon, 20 Dec 2021 05:41:31 +0100 Subject: Simplify parameter types (#18006) Remove repeated type declarations in function definitions. --- models/issue_milestone.go | 2 +- models/issues/content_history.go | 4 ++-- models/user.go | 4 ++-- models/user/setting.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'models') diff --git a/models/issue_milestone.go b/models/issue_milestone.go index f0949e8b1f..c79a99eb6f 100644 --- a/models/issue_milestone.go +++ b/models/issue_milestone.go @@ -448,7 +448,7 @@ func GetMilestones(opts GetMilestonesOption) (MilestoneList, int64, error) { } // SearchMilestones search milestones -func SearchMilestones(repoCond builder.Cond, page int, isClosed bool, sortType string, keyword string) (MilestoneList, error) { +func SearchMilestones(repoCond builder.Cond, page int, isClosed bool, sortType, keyword string) (MilestoneList, error) { miles := make([]*Milestone, 0, setting.UI.IssuePagingNum) sess := db.GetEngine(db.DefaultContext).Where("is_closed = ?", isClosed) if len(keyword) > 0 { diff --git a/models/issues/content_history.go b/models/issues/content_history.go index b423fb8fcf..721ce11f85 100644 --- a/models/issues/content_history.go +++ b/models/issues/content_history.go @@ -146,7 +146,7 @@ type IssueContentListItem struct { } // FetchIssueContentHistoryList fetch list -func FetchIssueContentHistoryList(dbCtx context.Context, issueID int64, commentID int64) ([]*IssueContentListItem, error) { +func FetchIssueContentHistoryList(dbCtx context.Context, issueID, commentID int64) ([]*IssueContentListItem, error) { res := make([]*IssueContentListItem, 0) err := db.GetEngine(dbCtx).Select("u.id as user_id, u.name as user_name,"+ "h.id as history_id, h.edited_unix, h.is_first_created, h.is_deleted"). @@ -168,7 +168,7 @@ func FetchIssueContentHistoryList(dbCtx context.Context, issueID int64, commentI } // HasIssueContentHistory check if a ContentHistory entry exists -func HasIssueContentHistory(dbCtx context.Context, issueID int64, commentID int64) (bool, error) { +func HasIssueContentHistory(dbCtx context.Context, issueID, commentID int64) (bool, error) { exists, err := db.GetEngine(dbCtx).Cols("id").Exist(&ContentHistory{ IssueID: issueID, CommentID: commentID, diff --git a/models/user.go b/models/user.go index ddd63bf5fe..2e7a84273f 100644 --- a/models/user.go +++ b/models/user.go @@ -316,11 +316,11 @@ func GetWatchedRepos(userID int64, private bool, listOptions db.ListOptions) ([] } // IsUserVisibleToViewer check if viewer is able to see user profile -func IsUserVisibleToViewer(u *user_model.User, viewer *user_model.User) bool { +func IsUserVisibleToViewer(u, viewer *user_model.User) bool { return isUserVisibleToViewer(db.GetEngine(db.DefaultContext), u, viewer) } -func isUserVisibleToViewer(e db.Engine, u *user_model.User, viewer *user_model.User) bool { +func isUserVisibleToViewer(e db.Engine, u, viewer *user_model.User) bool { if viewer != nil && viewer.IsAdmin { return true } diff --git a/models/user/setting.go b/models/user/setting.go index c5a3d482b5..5ff18f8265 100644 --- a/models/user/setting.go +++ b/models/user/setting.go @@ -76,7 +76,7 @@ func SetSetting(setting *Setting) error { return upsertSettingValue(setting.UserID, setting.SettingKey, setting.SettingValue) } -func upsertSettingValue(userID int64, key string, value string) error { +func upsertSettingValue(userID int64, key, value string) error { return db.WithTx(func(ctx context.Context) error { e := db.GetEngine(ctx) -- cgit v1.2.3