Commit 099bb010 authored by Jonne Haß's avatar Jonne Haß

Merge branch 'release/0.5.0.0-RC' into develop

parents 6e1b5397 2dd4bf0a
......@@ -161,6 +161,7 @@ diaspora* no longer adds a `div.container` to wrap custom splash pages. This add
* Fix displaying reshares in the stream on mobile [#5790](https://github.com/diaspora/diaspora/pull/5790)
* Remove bottom margin from lists that are the last element of a post. [#5721](https://github.com/diaspora/diaspora/pull/5721)
* Fix pagination design on conversations page [#5791](https://github.com/diaspora/diaspora/pull/5791)
* Prevent inserting posts into the wrong stream [#5838](https://github.com/diaspora/diaspora/pull/5838)
## Features
* Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105)
......
......@@ -110,7 +110,9 @@ app.models.Post.Interactions = Backbone.Model.extend({
notice: Diaspora.I18n.t("reshares.successful")
});
interactions.reshares.add(reshare);
if (app.stream) {app.stream.addNow(reshare)}
if (app.stream && /^\/(?:stream|activity|aspects)/.test(app.stream.basePath())) {
app.stream.addNow(reshare);
}
interactions.trigger("change");
})
.fail(function(){
......
......@@ -195,7 +195,9 @@ app.views.Publisher = Backbone.View.extend({
self.view_poll_creator.trigger('publisher:sync');
}
if(app.stream) app.stream.addNow(statusMessage.toJSON());
if(app.stream && !self.standalone){
app.stream.addNow(statusMessage.toJSON());
}
// clear state
self.clear();
......
......@@ -42,7 +42,7 @@ describe("app.models.Post.Interactions", function(){
});
describe("reshare", function() {
var ajax_success = { status: 200, responseText: '{"id": 1}' };
var ajaxSuccess = { status: 200, responseText: "{\"id\": 1}" };
beforeEach(function(){
this.reshare = this.interactions.post.reshare();
......@@ -52,18 +52,34 @@ describe("app.models.Post.Interactions", function(){
spyOn(this.interactions, "trigger");
this.interactions.reshare();
jasmine.Ajax.requests.mostRecent().respondWith(ajax_success);
jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess);
expect(this.interactions.trigger).toHaveBeenCalledWith("change");
});
it("adds the reshare to the stream", function() {
it("adds the reshare to the default, activity and aspects stream", function() {
app.stream = { addNow: $.noop };
spyOn(app.stream, "addNow");
this.interactions.reshare();
jasmine.Ajax.requests.mostRecent().respondWith(ajax_success);
var self = this;
["/stream", "/activity", "/aspects"].forEach(function(path) {
app.stream.basePath = function() { return path; };
self.interactions.reshare();
jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess);
expect(app.stream.addNow).toHaveBeenCalledWith({id: 1});
});
});
expect(app.stream.addNow).toHaveBeenCalledWith({id: 1});
it("doesn't add the reshare to any other stream", function() {
app.stream = { addNow: $.noop };
spyOn(app.stream, "addNow");
var self = this;
["/followed_tags", "/mentions/", "/tag/diaspora", "/people/guid/stream"].forEach(function(path) {
app.stream.basePath = function() { return path; };
self.interactions.reshare();
jasmine.Ajax.requests.mostRecent().respondWith(ajaxSuccess);
expect(app.stream.addNow).not.toHaveBeenCalled();
});
});
});
});
......@@ -4,7 +4,7 @@
*/
describe("app.views.Publisher", function() {
describe("standalone", function() {
context("standalone", function() {
beforeEach(function() {
// TODO should be jasmine helper
loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}});
......@@ -22,6 +22,16 @@ describe("app.views.Publisher", function() {
it("hides the post preview button in standalone mode", function() {
expect(this.view.$('.post_preview_button').is(':visible')).toBeFalsy();
});
describe("createStatusMessage", function(){
it("doesn't add the status message to the stream", function() {
app.stream = { addNow: $.noop };
spyOn(app.stream, "addNow");
this.view.createStatusMessage($.Event());
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, responseText: "{\"id\": 1}" });
expect(app.stream.addNow).not.toHaveBeenCalled();
});
});
});
context("plain publisher", function() {
......@@ -128,6 +138,14 @@ describe("app.views.Publisher", function() {
this.view.createStatusMessage($.Event());
expect(this.view.handleTextchange).toHaveBeenCalled();
});
it("adds the status message to the stream", function() {
app.stream = { addNow: $.noop };
spyOn(app.stream, "addNow");
this.view.createStatusMessage($.Event());
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, responseText: "{\"id\": 1}" });
expect(app.stream.addNow).toHaveBeenCalled();
});
});
describe('#setText', function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment