fix ruby reshare model; extract sortOrder in app.models.Stream.
This commit is contained in:
parent
fa5424653a
commit
de757db48b
2 changed files with 6 additions and 3 deletions
|
|
@ -42,7 +42,7 @@ class Reshare < Post
|
|||
end
|
||||
|
||||
def photos
|
||||
self.root ? root.photos : super
|
||||
self.root ? root.photos : nil
|
||||
end
|
||||
|
||||
def receive(recipient, sender)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,11 @@ app.models.Stream = Backbone.Collection.extend({
|
|||
|
||||
maxTime: function(){
|
||||
var lastPost = _.last(this.posts.models);
|
||||
var isOnParticipateStream = this.basePath().match(/participate/);
|
||||
return (isOnParticipateStream == null) ? lastPost.createdAt() : lastPost.interactedAt();
|
||||
return lastPost[this.sortOrder()]()
|
||||
},
|
||||
|
||||
sortOrder : function() {
|
||||
return this.basePath().match(/participate/) ? "interactedAt" : "createdAt"
|
||||
},
|
||||
|
||||
add : function(models){
|
||||
|
|
|
|||
Loading…
Reference in a new issue