fix markup display on reshares. DERP. [ci skip]
This commit is contained in:
parent
f83076850b
commit
fa5424653a
4 changed files with 18 additions and 28 deletions
|
|
@ -35,13 +35,7 @@ class Post < ActiveRecord::Base
|
||||||
t.add :o_embed_cache
|
t.add :o_embed_cache
|
||||||
t.add :user_like
|
t.add :user_like
|
||||||
t.add :mentioned_people
|
t.add :mentioned_people
|
||||||
t.add lambda { |post|
|
t.add :photos
|
||||||
if post.respond_to?(:photos)
|
|
||||||
post.photos
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
}, :as => :photos
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xml_attr :provider_display_name
|
xml_attr :provider_display_name
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,10 @@ class Reshare < Post
|
||||||
self.root ? root.mentioned_people : super
|
self.root ? root.mentioned_people : super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def photos
|
||||||
|
self.root ? root.photos : super
|
||||||
|
end
|
||||||
|
|
||||||
def receive(recipient, sender)
|
def receive(recipient, sender)
|
||||||
local_reshare = Reshare.where(:guid => self.guid).first
|
local_reshare = Reshare.where(:guid => self.guid).first
|
||||||
if local_reshare && local_reshare.root.author_id == recipient.person.id
|
if local_reshare && local_reshare.root.author_id == recipient.person.id
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,12 @@
|
||||||
{{t "stream.reshares" count=reshares_count}}
|
{{t "stream.reshares" count=reshares_count}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{> status-message}}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
|
{{> status-message}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
app.views.Content = app.views.StreamObject.extend({
|
app.views.Content = app.views.StreamObject.extend({
|
||||||
presenter : function(model){
|
presenter : function(){
|
||||||
var model = model || this.model
|
|
||||||
|
|
||||||
return _.extend(this.defaultPresenter(), {
|
return _.extend(this.defaultPresenter(), {
|
||||||
text : app.helpers.textFormatter(model),
|
text : app.helpers.textFormatter(this.model),
|
||||||
o_embed_html : embedHTML(model),
|
o_embed_html : embedHTML(this.model),
|
||||||
largePhoto : this.largePhoto(model),
|
largePhoto : this.largePhoto(),
|
||||||
smallPhotos : this.smallPhotos(model)
|
smallPhotos : this.smallPhotos()
|
||||||
})
|
})
|
||||||
|
|
||||||
function embedHTML(model){
|
function embedHTML(model){
|
||||||
|
|
@ -20,22 +18,16 @@ app.views.Content = app.views.StreamObject.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
largePhoto : function(model) {
|
largePhoto : function() {
|
||||||
var photos = model.get("photos")
|
var photos = this.model.get("photos")
|
||||||
if(!photos || photos.length == 0) { return }
|
if(!photos || photos.length == 0) { return }
|
||||||
return photos[0]
|
return photos[0]
|
||||||
},
|
},
|
||||||
|
|
||||||
smallPhotos : function(model) {
|
smallPhotos : function() {
|
||||||
var photos = model.get("photos")
|
var photos = this.model.get("photos")
|
||||||
if(!photos || photos.length < 2) { return }
|
if(!photos || photos.length < 2) { return }
|
||||||
return photos.slice(1,8)
|
return photos.slice(1,8)
|
||||||
},
|
|
||||||
|
|
||||||
// should be a private function in this.presenter()
|
|
||||||
rootPresenter : function(model) {
|
|
||||||
if(!model || !model.get("root")) { return }
|
|
||||||
return this.presenter(new app.models.Post(model.get("root")))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue