FIX: reply as new link wasn't working sometimes

This commit is contained in:
Régis Hanol 2016-06-20 12:09:04 +02:00
parent 5e2545a578
commit 9c5a727aa2
3 changed files with 8 additions and 6 deletions

View File

@ -26,15 +26,14 @@ export default Ember.Controller.extend({
// Close the share controller
actions: {
close() {
this.setProperties({ link: '', postNumber: '' });
this.setProperties({ link: null, postNumber: null, postId: null });
return false;
},
replyAsNewTopic() {
const topicController = this.get("controllers.topic");
const postStream = topicController.get("model.postStream");
const postId = postStream.findPostIdForPostNumber(this.get("postNumber"));
const post = postStream.findLoadedPost(postId);
const post = postStream.findLoadedPost(this.get("postId"));
topicController.send("replyAsNewTopic", post);
this.send("close");
},

View File

@ -47,7 +47,7 @@ export default Ember.View.extend({
return true;
});
function showPanel($target, url, postNumber, date) {
function showPanel($target, url, postNumber, date, postId) {
const $currentTargetOffset = $target.offset();
const $shareLink = $('#share-link');
@ -77,6 +77,7 @@ export default Ember.View.extend({
self.set('controller.link', url);
self.set('controller.postNumber', postNumber);
self.set('controller.postId', postId);
self.set('controller.date', date);
}
@ -91,8 +92,9 @@ export default Ember.View.extend({
const $currentTarget = $(e.currentTarget),
url = $currentTarget.data('share-url'),
postNumber = $currentTarget.data('post-number'),
postId = $currentTarget.data('post-id'),
date = $currentTarget.children().data('time');
showPanel($currentTarget, url, postNumber, date);
showPanel($currentTarget, url, postNumber, date, postId);
return false;
});

View File

@ -161,7 +161,8 @@ createWidget('post-meta-data', {
attributes: {
href: attrs.shareUrl,
'data-share-url': attrs.shareUrl,
'data-post-number': attrs.post_number
'data-post-number': attrs.post_number,
'data-post-id': attrs.id,
}
}, dateNode(createdAt))
));