use id from preloaded gon.post to fix broken liking with guid

closes #5978
This commit is contained in:
Benjamin Neff 2015-05-22 04:11:48 +02:00 committed by Dennis Schubert
parent be3b2852be
commit 68f7208ff5
3 changed files with 15 additions and 2 deletions

View file

@ -36,6 +36,7 @@
* Handle empty searchable in HCard gracefully [#5962](https://github.com/diaspora/diaspora/pull/5962)
* Fix a freeze in new post parsing [#5965](https://github.com/diaspora/diaspora/pull/5965)
* Add case insensitive unconfirmed email addresses as authentication key [#5967](https://github.com/diaspora/diaspora/pull/5967)
* Fix liking on single post views when accessed via GUID [#5978](https://github.com/diaspora/diaspora/pull/5978)
## Features
* Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843)

View file

@ -8,8 +8,8 @@ app.pages.SinglePostViewer = app.views.Base.extend({
'#single-post-interactions' : 'singlePostInteractionsView'
},
initialize : function(options) {
this.model = new app.models.Post({ id : options.id });
initialize : function() {
this.model = new app.models.Post({ id : gon.post.id });
this.model.preloadOrFetch().done(_.bind(this.initViews, this));
this.model.interactions.fetch(); //async, yo, might want to throttle this later.
this.setupLightbox();

View file

@ -0,0 +1,12 @@
describe("app.pages.SinglePostViewer", function(){
beforeEach(function() {
window.gon={};gon.post = {id: 42};
this.view = new app.pages.SinglePostViewer();
});
context("#initialize", function() {
it("uses post-id from gon", function() {
expect(this.view.model.id).toBe(gon.post.id);
});
});
});