diff --git a/app/assets/javascripts/discourse/controllers/share_controller.js b/app/assets/javascripts/discourse/controllers/share_controller.js
index 2007c8bfb35..4d513b3f039 100644
--- a/app/assets/javascripts/discourse/controllers/share_controller.js
+++ b/app/assets/javascripts/discourse/controllers/share_controller.js
@@ -13,6 +13,7 @@ Discourse.ShareController = Discourse.Controller.extend({
// Close the share controller
close: function() {
this.set('link', '');
+ this.set('postNumber', '');
return false;
},
diff --git a/app/assets/javascripts/discourse/views/post_menu_view.js b/app/assets/javascripts/discourse/views/post_menu_view.js
index f740a9ffe13..06c461363a3 100644
--- a/app/assets/javascripts/discourse/views/post_menu_view.js
+++ b/app/assets/javascripts/discourse/views/post_menu_view.js
@@ -167,7 +167,8 @@ Discourse.PostMenuView = Discourse.View.extend({
renderShare: function(post, buffer) {
buffer.push("");
+ "\" data-share-url=\"" + post.get('shareUrl') + "\" data-post-number=\"" + post.get('post_number') +
+ "\" class='share'>");
},
// Reply button
diff --git a/app/assets/javascripts/discourse/views/share_view.js b/app/assets/javascripts/discourse/views/share_view.js
index 02f4cf7ab57..2a313d51d1e 100644
--- a/app/assets/javascripts/discourse/views/share_view.js
+++ b/app/assets/javascripts/discourse/views/share_view.js
@@ -13,8 +13,8 @@ Discourse.ShareView = Discourse.View.extend({
title: function() {
if (this.get('controller.type') === 'topic') return I18n.t('share.topic');
- return I18n.t('share.post');
- }.property('controller.type'),
+ return I18n.t('share.post', {postNumber: this.get('controller.postNumber')});
+ }.property('controller.type', 'controller.postNumber'),
hasLink: function() {
if (this.present('controller.link')) return 'visible';
@@ -48,6 +48,7 @@ Discourse.ShareView = Discourse.View.extend({
e.preventDefault();
var $currentTarget = $(e.currentTarget);
var url = $currentTarget.data('share-url');
+ var postNumber = $currentTarget.data('post-number');
// Relative urls
if (url.indexOf("/") === 0) {
@@ -64,6 +65,7 @@ Discourse.ShareView = Discourse.View.extend({
top: "" + (e.pageY - 100) + "px"
});
shareView.set('controller.link', url);
+ shareView.set('controller.postNumber', postNumber);
return false;
});
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index d2e8dc905ad..a255634273e 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -71,7 +71,7 @@ en:
other: "%{count} days ago"
share:
topic: 'share a link to this topic'
- post: 'share a link to this post'
+ post: 'share a link to post #%{postNumber}'
close: 'close'
twitter: 'share this link on Twitter'
facebook: 'share this link on Facebook'
diff --git a/spec/components/jobs/importer_spec.rb b/spec/components/jobs/importer_spec.rb
index fee853b7498..842ef44e070 100644
--- a/spec/components/jobs/importer_spec.rb
+++ b/spec/components/jobs/importer_spec.rb
@@ -170,13 +170,11 @@ describe Jobs::Importer do
end
# Neil, please have a look here
- pending "should have a users table that's empty" do
+ it "should have a users table that's empty" do
@user1 = Fabricate(:user)
- # community user needs to be accounted for
- User.count.should == 2
Jobs::Importer.any_instance.stubs(:ordered_models_for_import).returns([User])
Jobs::Importer.new.execute(@importer_args)
- User.count.should == 1
+ User.count.should == 0 # empty table (data loading is stubbed for this test)
end
it "should indicate that an import is running" do
@@ -192,7 +190,6 @@ describe Jobs::Importer do
Discourse.expects(:enable_maintenance_mode).in_sequence(seq).at_least_once
Jobs::Importer.any_instance.expects(:backup_tables).in_sequence(seq).at_least_once
Jobs::Importer.any_instance.expects(:load_data).in_sequence(seq).at_least_once
- # fails here
Jobs::Importer.new.execute( @importer_args )
end