aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2020-08-11 10:48:13 -0400
committerGitHub <noreply@github.com>2020-08-11 10:48:13 -0400
commit22c952ac7a6cfb5e4fd8ab536cbfef1543b1be91 (patch)
treecc7a278ce1bd3a2dbfea28567b12b1e46b1debc6
parent73b155d5f21813abc788a54aee0ee72459e7c7c9 (diff)
downloadgitea-22c952ac7a6cfb5e4fd8ab536cbfef1543b1be91.tar.gz
gitea-22c952ac7a6cfb5e4fd8ab536cbfef1543b1be91.zip
Make dashboard newsfeed list length a configurable item (#12469)
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
-rw-r--r--custom/conf/app.example.ini2
-rw-r--r--docs/content/doc/advanced/config-cheat-sheet.en-us.md1
-rw-r--r--models/action.go4
-rw-r--r--modules/setting/setting.go2
4 files changed, 7 insertions, 2 deletions
diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini
index a15b9be54f..f8c631ee07 100644
--- a/custom/conf/app.example.ini
+++ b/custom/conf/app.example.ini
@@ -164,6 +164,8 @@ EXPLORE_PAGING_NUM = 20
ISSUE_PAGING_NUM = 10
; Number of maximum commits displayed in one activity feed
FEED_MAX_COMMIT_NUM = 5
+; Number of items that are displayed in home feed
+FEED_PAGING_NUM = 20
; Number of maximum commits displayed in commit graph.
GRAPH_MAX_COMMIT_NUM = 100
; Number of line of codes shown for a code comment
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index b659b5daac..39fc350e4f 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -127,6 +127,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `ISSUE_PAGING_NUM`: **10**: Number of issues that are shown in one page (for all pages that list issues).
- `MEMBERS_PAGING_NUM`: **20**: Number of members that are shown in organization members.
- `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed.
+- `FEED_PAGING_NUM`: **20**: Number of items that are displayed in home feed.
- `GRAPH_MAX_COMMIT_NUM`: **100**: Number of maximum commits shown in the commit graph.
- `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install.
- `THEMES`: **gitea,arc-green**: All available themes. Allow users select personalized themes
diff --git a/models/action.go b/models/action.go
index d6dbcdc671..f4d163afa3 100644
--- a/models/action.go
+++ b/models/action.go
@@ -339,9 +339,9 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) {
cond = cond.And(builder.Eq{"is_deleted": false})
}
- actions := make([]*Action, 0, 20)
+ actions := make([]*Action, 0, setting.UI.FeedPagingNum)
- if err := x.Limit(20).Desc("id").Where(cond).Find(&actions); err != nil {
+ if err := x.Limit(setting.UI.FeedPagingNum).Desc("id").Where(cond).Find(&actions); err != nil {
return nil, fmt.Errorf("Find: %v", err)
}
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index f4b10feee8..d4ce13079a 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -166,6 +166,7 @@ var (
RepoSearchPagingNum int
MembersPagingNum int
FeedMaxCommitNum int
+ FeedPagingNum int
GraphMaxCommitNum int
CodeCommentLines int
ReactionMaxUserNum int
@@ -207,6 +208,7 @@ var (
RepoSearchPagingNum: 10,
MembersPagingNum: 20,
FeedMaxCommitNum: 5,
+ FeedPagingNum: 20,
GraphMaxCommitNum: 100,
CodeCommentLines: 4,
ReactionMaxUserNum: 10,