Merge branch 'stable' into develop

This commit is contained in:
Dennis Schubert 2015-05-19 03:00:56 +02:00
commit 2549f44b7c
9 changed files with 56 additions and 21 deletions

View file

@ -25,6 +25,7 @@ Ruby 2.0 is no longer officially supported.
* Remove some old temporary workarounds [#5964](https://github.com/diaspora/diaspora/pull/5964)
* Remove unused `hasPhotos` and `hasText` functions [#5969](https://github.com/diaspora/diaspora/pull/5969)
* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966)
* Improved handling of reshares with deleted roots [#5968](https://github.com/diaspora/diaspora/pull/5968)
## Bug fixes
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)

View file

@ -10,7 +10,8 @@ app.views.Content = app.views.Base.extend({
text : app.helpers.textFormatter(this.model.get("text"), this.model.get("mentioned_people")),
largePhoto : this.largePhoto(),
smallPhotos : this.smallPhotos(),
location: this.location()
location: this.location(),
isReshare : this.model.get("post_type") === "Reshare"
});
},

View file

@ -98,6 +98,11 @@
padding-top: 20px;
width: auto;
#real-post-content div.reshare {
border-left: 2px solid #DDD;
padding-left: 10px;
}
.oembed { width: 95%; }
.photo_attachments {
img.big_stream_photo { max-width: 90%; }

View file

@ -1,16 +1,11 @@
<div class="reshare">
{{#if root}}
<div class="media">
{{#if root}}
{{#with root}}
<a href="/people/{{author.guid}}" class="img {{{hovercardable this}}}">
{{{personImage author 'small'}}}
</a>
{{/with}}
{{#with root}}
<div class="bd">
<div>
{{#linkToAuthor author}}
@ -33,14 +28,10 @@
{{> status-message}}
</div>
</div>
{{else}}
<p>
{{t "stream.original_post_deleted"}}
</p>
{{/if}}
</div>
</div>

View file

@ -16,7 +16,15 @@
<div class="collapsible">
<div class="markdown-content">
{{#if text}}
{{{text}}}
{{else if isReshare}}
<div class="reshare">
<p>
{{t "stream.original_post_deleted"}}
</p>
</div>
{{/if}}
</div>
<div class="oembed"></div>
<div class="opengraph"></div>

View file

@ -26,7 +26,7 @@ class Reshare < Post
end
def root_diaspora_id
self.root.author.diaspora_handle
root.try(:author).try(:diaspora_handle)
end
delegate :o_embed_cache, :open_graph_cache,

View file

@ -12,6 +12,7 @@
- if !post.activity_streams?
= render 'status_messages/status_message', :post => post, :photos => post.photos
- else
.content
= t('.deleted')
.reshare_via

View file

@ -10,4 +10,19 @@ describe("app.views.Content", function(){
expect(this.view.smallPhotos().length).toEqual(1);
});
});
describe("presenter", function(){
beforeEach(function(){
this.post.set({text : ""}); // for textFormatter
});
it("provides isReshare", function(){
expect(this.view.presenter().isReshare).toBeFalsy();
});
it("provides isReshare and be true when the post is a reshare", function(){
this.post.set({post_type : "Reshare"});
expect(this.view.presenter().isReshare).toBeTruthy();
});
});
});

View file

@ -20,6 +20,19 @@ describe Reshare, :type => :model do
expect(FactoryGirl.create(:reshare, :public => false).public).to be true
end
describe "#root_diaspora_id" do
it "should return the root diaspora id" do
reshare = FactoryGirl.create(:reshare, root: FactoryGirl.build(:status_message, author: bob.person, public: true))
expect(reshare.root_diaspora_id).to eq(bob.person.diaspora_handle)
end
it "should be nil if no root found" do
reshare = FactoryGirl.create(:reshare, root: FactoryGirl.build(:status_message, author: bob.person, public: true))
reshare.root = nil
expect(reshare.root_diaspora_id).to be_nil
end
end
describe "#receive" do
let(:receive_reshare) { @reshare.receive(@root.author.owner, @reshare.author) }