Skip to content

Commit

Permalink
use id from preloaded gon.post to fix broken liking with guid
Browse files Browse the repository at this point in the history
closes #5978
  • Loading branch information
SuperTux88 authored and denschub committed May 22, 2015
1 parent be3b285 commit 68f7208
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/app/pages/single-post-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions spec/javascripts/app/pages/single-post-viewer_spec.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
});

0 comments on commit 68f7208

Please sign in to comment.