Skip to content

Commit

Permalink
fix array prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
teharrison committed Apr 5, 2017
1 parent fe5490b commit 26bf67d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shock-server/node/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,10 @@ func (node *Node) Save() (err error) {
// only add to revisions if not new and has changed and allow revisions
if (previousVersion != "") && (previousVersion != node.Version) && (conf.MAX_REVISIONS != 0) {
n := Node{node.Id, node.Version, node.File, node.Attributes, node.Indexes, node.Acl, node.VersionParts, node.Tags, nil, node.Linkages, node.Priority, node.CreatedOn, node.LastModified, node.Expiration, node.Type, node.Subset, node.Parts}
newRevisions := append([]Node{n}, node.Revisions) // prepend, latest revisions in front
newRevisions := []Node{n}
if len(node.Revisions) > 0 {
newRevisions = append(newRevisions, node.Revisions...) // prepend, latest revisions in front
}
// adjust revisions based on config
// <0 keep all ; >0 keep max
if (conf.MAX_REVISIONS < 0) || (len(newRevisions) <= conf.MAX_REVISIONS) {
Expand Down

0 comments on commit 26bf67d

Please sign in to comment.