From 289753e068bd351f1916d4ca280ed68cba38ad2e Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Mon, 18 May 2015 01:59:24 +0200 Subject: [PATCH] add "original post deleted" message on single post view closes #5968 --- Changelog.md | 1 + app/assets/javascripts/app/views/content_view.js | 3 ++- app/assets/stylesheets/single-post-view.scss | 5 +++++ app/assets/templates/status-message_tpl.jst.hbs | 10 +++++++++- spec/javascripts/app/views/content_view_spec.js | 15 +++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 877376fd1..6ace83e70 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ * 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) diff --git a/app/assets/javascripts/app/views/content_view.js b/app/assets/javascripts/app/views/content_view.js index 75a4632cc..e93f6bfa6 100644 --- a/app/assets/javascripts/app/views/content_view.js +++ b/app/assets/javascripts/app/views/content_view.js @@ -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" }); }, diff --git a/app/assets/stylesheets/single-post-view.scss b/app/assets/stylesheets/single-post-view.scss index c5a5684a1..7ddcb9576 100644 --- a/app/assets/stylesheets/single-post-view.scss +++ b/app/assets/stylesheets/single-post-view.scss @@ -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%; } diff --git a/app/assets/templates/status-message_tpl.jst.hbs b/app/assets/templates/status-message_tpl.jst.hbs index a750289cc..f6689bf30 100644 --- a/app/assets/templates/status-message_tpl.jst.hbs +++ b/app/assets/templates/status-message_tpl.jst.hbs @@ -16,7 +16,15 @@
- {{{text}}} + {{#if text}} + {{{text}}} + {{else if isReshare}} +
+

+ {{t "stream.original_post_deleted"}} +

+
+ {{/if}}
diff --git a/spec/javascripts/app/views/content_view_spec.js b/spec/javascripts/app/views/content_view_spec.js index 8f42a247f..6a701aaa3 100644 --- a/spec/javascripts/app/views/content_view_spec.js +++ b/spec/javascripts/app/views/content_view_spec.js @@ -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(); + }); + }); });