diff --git a/Changelog.md b/Changelog.md
index 4a5e58a58..1ea4519c2 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -12,8 +12,10 @@
## Bug fixes
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
+* Hide 'reshare' button on already reshared posts [#7169](https://github.com/diaspora/diaspora/pull/7169)
## Features
+* Show spinner when loading comments in the stream [#7170](https://github.com/diaspora/diaspora/pull/7170)
# 0.6.1.0
diff --git a/app/assets/javascripts/app/views/comment_stream_view.js b/app/assets/javascripts/app/views/comment_stream_view.js
index 0119b3329..48df8afad 100644
--- a/app/assets/javascripts/app/views/comment_stream_view.js
+++ b/app/assets/javascripts/app/views/comment_stream_view.js
@@ -104,10 +104,12 @@ app.views.CommentStream = app.views.Base.extend({
},
expandComments: function(evt){
+ this.$(".loading-comments").removeClass("hidden");
if(evt){ evt.preventDefault(); }
this.model.comments.fetch({
success: function() {
this.$("div.comment.show_comments").addClass("hidden");
+ this.$(".loading-comments").addClass("hidden");
}.bind(this)
});
}
diff --git a/app/assets/stylesheets/comments.scss b/app/assets/stylesheets/comments.scss
index 3a9828c8f..7b6d76757 100644
--- a/app/assets/stylesheets/comments.scss
+++ b/app/assets/stylesheets/comments.scss
@@ -1,13 +1,27 @@
.comment_stream {
.show_comments {
- margin-top: 5px;
border-top: 1px solid $border-grey;
+ line-height: $line-height-computed;
+ margin-top: 5px;
a {
color: $text-grey;
font-size: 13px;
}
.media { margin-top: 10px; }
}
+
+ .loading-comments {
+ height: $line-height-computed + 11px; // height of .show_comments: line-height, 10px margin, 1px border
+ margin-top: -$line-height-computed - 11px;
+
+ .loader {
+ height: 20px;
+ width: 20px;
+ }
+
+ .media { margin: 5px; }
+ }
+
.comments > .comment,
.comment.new-comment-form-wrapper {
.avatar {
diff --git a/app/assets/templates/comment-stream_tpl.jst.hbs b/app/assets/templates/comment-stream_tpl.jst.hbs
index 0b6678a10..e7343507d 100644
--- a/app/assets/templates/comment-stream_tpl.jst.hbs
+++ b/app/assets/templates/comment-stream_tpl.jst.hbs
@@ -6,6 +6,14 @@
+
+
{{#if loggedIn}}
diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb
index ba1609c8a..86064fbf9 100644
--- a/app/presenters/post_presenter.rb
+++ b/app/presenters/post_presenter.rb
@@ -104,7 +104,7 @@ class PostPresenter < BasePresenter
end
def user_reshare
- @post.reshare_for(current_user)
+ @post.reshare_for(current_user).try(:as_api_response, :backbone)
end
def already_participated_in_poll
diff --git a/features/desktop/reshare.feature b/features/desktop/reshare.feature
index 9c56da684..6afe52fb0 100644
--- a/features/desktop/reshare.feature
+++ b/features/desktop/reshare.feature
@@ -42,11 +42,25 @@ Feature: public repost
And I sign in as "bob@bob.bob"
Then I should see "Original post deleted by author" within ".reshare"
- # should be covered in rspec, so testing that the post is added to
- # app.stream in jasmine should be enough coverage
- Scenario: When I reshare, it shows up on my profile page
- Given I sign in as "alice@alice.alice"
- And I confirm the alert after I follow "Reshare"
+ Scenario: Reshare a post from the stream
+ When I sign in as "alice@alice.alice"
+ Then I should see a ".reshare" within ".feedback"
+ When I confirm the alert after I follow "Reshare"
Then I should see a flash message indicating success
And I should see a flash message containing "successfully"
And I should not see a ".reshare" within ".feedback"
+
+ Scenario: Reshare a post from another user's profile
+ When I sign in as "alice@alice.alice"
+ And I am on "bob@bob.bob"'s page
+ Then I should see a ".reshare" within ".feedback"
+ When I confirm the alert after I follow "Reshare"
+ Then I should see a flash message indicating success
+ And I should see a flash message containing "successfully"
+ And I should not see a ".reshare" within ".feedback"
+
+ Scenario: Try to reshare an already reshared post from another user's profile
+ Given the post with text "reshare this!" is reshared by "alice@alice.alice"
+ When I sign in as "alice@alice.alice"
+ And I am on "bob@bob.bob"'s page
+ Then I should not see a ".reshare" within ".feedback"
diff --git a/spec/javascripts/app/views/comment_stream_view_spec.js b/spec/javascripts/app/views/comment_stream_view_spec.js
index 0317f7f0b..104cb3c7a 100644
--- a/spec/javascripts/app/views/comment_stream_view_spec.js
+++ b/spec/javascripts/app/views/comment_stream_view_spec.js
@@ -164,6 +164,19 @@ describe("app.views.CommentStream", function(){
}).join("")
);
});
+
+ it("shows the spinner when loading comments and removes it on success", function() {
+ this.view.render();
+ expect(this.view.$(".loading-comments")).toHaveClass("hidden");
+
+ this.view.expandComments();
+ expect(this.view.$(".loading-comments")).not.toHaveClass("hidden");
+
+ jasmine.Ajax.requests.mostRecent().respondWith({
+ status: 200, responseText: JSON.stringify([])
+ });
+ expect(this.view.$(".loading-comments")).toHaveClass("hidden");
+ });
});
describe("pressing a key when typing on the new comment box", function(){