summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--releases.moxie6
-rw-r--r--src/main/distrib/data/gitblit.properties5
-rw-r--r--src/main/java/com/gitblit/wicket/pages/BasePage.java4
-rw-r--r--src/main/java/com/gitblit/wicket/pages/MyDashboardPage.java4
-rw-r--r--src/main/java/com/gitblit/wicket/pages/RootPage.java8
5 files changed, 26 insertions, 1 deletions
diff --git a/releases.moxie b/releases.moxie
index fcbdb7b7..fea44995 100644
--- a/releases.moxie
+++ b/releases.moxie
@@ -18,11 +18,15 @@ r19: {
- Added pptx extension for tree page icon lookup
- Fixed project links on dashboard page when web.mountParameters=false
changes: ~
- additions: ~
+ additions:
+ - Add setting for maximum number of days of activity to that may be requested
dependencyChanges: ~
contributors:
- github/guriguri
- Doug Ayers
+ - Ori Livneh
+ settings:
+ - { name: 'web.activityDurationMaximum', defaultValue: 30 }
}
#
diff --git a/src/main/distrib/data/gitblit.properties b/src/main/distrib/data/gitblit.properties
index 7f2f8b48..770bd39d 100644
--- a/src/main/distrib/data/gitblit.properties
+++ b/src/main/distrib/data/gitblit.properties
@@ -882,6 +882,11 @@ web.activityDuration = 7
# SINCE 1.3.0
web.activityDurationChoices = 1 3 7 14 21 28
+# Maximum number of days of activity that may be displayed on the activity page.
+#
+# SINCE 1.3.2
+web.activityDurationMaximum = 30
+
# The number of days of commits to cache in memory for the dashboard, activity,
# and project pages. A value of 0 will disable all caching and will parse commits
# in each repository per-request. If the value > 0 these pages will try to fulfill
diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.java b/src/main/java/com/gitblit/wicket/pages/BasePage.java
index c9e11b08..2bab1183 100644
--- a/src/main/java/com/gitblit/wicket/pages/BasePage.java
+++ b/src/main/java/com/gitblit/wicket/pages/BasePage.java
@@ -325,6 +325,7 @@ public abstract class BasePage extends SessionPage {
String regex = WicketUtils.getRegEx(params);
String team = WicketUtils.getTeam(params);
int daysBack = params.getInt("db", 0);
+ int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);
List<ProjectModel> availableModels = getProjectModels();
Set<ProjectModel> models = new HashSet<ProjectModel>();
@@ -372,6 +373,9 @@ public abstract class BasePage extends SessionPage {
// time-filter the list
if (daysBack > 0) {
+ if (maxDaysBack > 0 && daysBack > maxDaysBack) {
+ daysBack = maxDaysBack;
+ }
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
diff --git a/src/main/java/com/gitblit/wicket/pages/MyDashboardPage.java b/src/main/java/com/gitblit/wicket/pages/MyDashboardPage.java
index 32c128da..0768b2ac 100644
--- a/src/main/java/com/gitblit/wicket/pages/MyDashboardPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/MyDashboardPage.java
@@ -96,9 +96,13 @@ public class MyDashboardPage extends DashboardPage {
// parameters
int daysBack = params == null ? 0 : WicketUtils.getDaysBack(params);
+ int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);
if (daysBack < 1) {
daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
}
+ if (maxDaysBack > 0 && daysBack > maxDaysBack) {
+ daysBack = maxDaysBack;
+ }
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, -1*daysBack);
Date minimumDate = c.getTime();
diff --git a/src/main/java/com/gitblit/wicket/pages/RootPage.java b/src/main/java/com/gitblit/wicket/pages/RootPage.java
index 7739e6df..a81d63f4 100644
--- a/src/main/java/com/gitblit/wicket/pages/RootPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/RootPage.java
@@ -345,9 +345,13 @@ public abstract class RootPage extends BasePage {
protected List<DropDownMenuItem> getTimeFilterItems(PageParameters params) {
// days back choices - additive parameters
int daysBack = GitBlit.getInteger(Keys.web.activityDuration, 7);
+ int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);
if (daysBack < 1) {
daysBack = 7;
}
+ if (daysBack > maxDaysBack) {
+ daysBack = maxDaysBack;
+ }
PageParameters clonedParams;
if (params == null) {
clonedParams = new PageParameters();
@@ -397,6 +401,7 @@ public abstract class RootPage extends BasePage {
String regex = WicketUtils.getRegEx(params);
String team = WicketUtils.getTeam(params);
int daysBack = params.getInt("db", 0);
+ int maxDaysBack = GitBlit.getInteger(Keys.web.activityDurationMaximum, 30);
List<RepositoryModel> availableModels = getRepositoryModels();
Set<RepositoryModel> models = new HashSet<RepositoryModel>();
@@ -487,6 +492,9 @@ public abstract class RootPage extends BasePage {
// time-filter the list
if (daysBack > 0) {
+ if (maxDaysBack > 0 && daysBack > maxDaysBack) {
+ daysBack = maxDaysBack;
+ }
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);