summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit/models')
-rw-r--r--src/main/java/com/gitblit/models/DailyLogEntry.java22
-rw-r--r--src/main/java/com/gitblit/models/PushLogEntry.java4
-rw-r--r--src/main/java/com/gitblit/models/RepositoryModel.java4
3 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/models/DailyLogEntry.java b/src/main/java/com/gitblit/models/DailyLogEntry.java
index db605268..a459d76f 100644
--- a/src/main/java/com/gitblit/models/DailyLogEntry.java
+++ b/src/main/java/com/gitblit/models/DailyLogEntry.java
@@ -19,6 +19,7 @@ import java.io.Serializable;
import java.util.Date;
import org.eclipse.jgit.lib.PersonIdent;
+import org.eclipse.jgit.transport.ReceiveCommand;
/**
* Model class to simulate a push for presentation in the push log news feed
@@ -56,4 +57,25 @@ public class DailyLogEntry extends PushLogEntry implements Serializable {
return super.getAuthorIdent();
}
+
+ /**
+ * Tracks the change type for the specified ref.
+ *
+ * @param ref
+ * @param type
+ * @param oldId
+ * @param newId
+ */
+ public void updateRef(String ref, ReceiveCommand.Type type, String oldId, String newId) {
+ // daily digests are filled from most recent to oldest
+ String preservedNewId = getNewId(ref);
+ if (preservedNewId == null) {
+ // no preserved new id, this is newest commit
+ // for this ref
+ preservedNewId = newId;
+ }
+ refUpdates.put(ref, type);
+ refIdChanges.put(ref, oldId + "-" + preservedNewId);
+ }
+
}
diff --git a/src/main/java/com/gitblit/models/PushLogEntry.java b/src/main/java/com/gitblit/models/PushLogEntry.java
index 8b006d96..77bed386 100644
--- a/src/main/java/com/gitblit/models/PushLogEntry.java
+++ b/src/main/java/com/gitblit/models/PushLogEntry.java
@@ -51,9 +51,9 @@ public class PushLogEntry implements Serializable, Comparable<PushLogEntry> {
private final Set<RepositoryCommit> commits;
- private final Map<String, ReceiveCommand.Type> refUpdates;
+ protected final Map<String, ReceiveCommand.Type> refUpdates;
- private final Map<String, String> refIdChanges;
+ protected final Map<String, String> refIdChanges;
private int authorCount;
diff --git a/src/main/java/com/gitblit/models/RepositoryModel.java b/src/main/java/com/gitblit/models/RepositoryModel.java
index 6e1e226a..0e39d912 100644
--- a/src/main/java/com/gitblit/models/RepositoryModel.java
+++ b/src/main/java/com/gitblit/models/RepositoryModel.java
@@ -186,6 +186,10 @@ public class RepositoryModel implements Serializable, Comparable<RepositoryModel
return !accessRestriction.atLeast(AccessRestrictionType.VIEW);
}
+ public boolean isShowActivity() {
+ return maxActivityCommits > -1;
+ }
+
public boolean isSparkleshared() {
return !StringUtils.isEmpty(sparkleshareId);
}