On reshare insert the reshare built from the response
Also make sure comments_count and the like is always set in the response.
This commit is contained in:
parent
42977333c4
commit
73b6c75278
3 changed files with 14 additions and 11 deletions
|
|
@ -104,7 +104,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
|
||||||
, flash = new Diaspora.Widgets.FlashMessages();
|
, flash = new Diaspora.Widgets.FlashMessages();
|
||||||
|
|
||||||
reshare.save()
|
reshare.save()
|
||||||
.done(function(){
|
.done(function(reshare) {
|
||||||
flash.render({
|
flash.render({
|
||||||
success: true,
|
success: true,
|
||||||
notice: Diaspora.I18n.t("reshares.successful")
|
notice: Diaspora.I18n.t("reshares.successful")
|
||||||
|
|
|
||||||
|
|
@ -101,10 +101,13 @@ class PostInteractionPresenter
|
||||||
|
|
||||||
def as_json(options={})
|
def as_json(options={})
|
||||||
{
|
{
|
||||||
:likes => as_api(@post.likes),
|
likes: as_api(@post.likes),
|
||||||
:reshares => PostPresenter.collection_json(@post.reshares, @current_user),
|
reshares: PostPresenter.collection_json(@post.reshares, @current_user),
|
||||||
:comments => CommentPresenter.as_collection(@post.comments.order('created_at ASC')),
|
comments: CommentPresenter.as_collection(@post.comments.order("created_at ASC")),
|
||||||
:participations => as_api(@post.participations)
|
participations: as_api(@post.participations),
|
||||||
|
comments_count: @post.comments_count,
|
||||||
|
likes_count: @post.likes_count,
|
||||||
|
reshares_count: @post.reshares_count
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ describe 'locale files' do
|
||||||
describe "cldr/plurals.rb" do
|
describe "cldr/plurals.rb" do
|
||||||
AVAILABLE_LANGUAGE_CODES.each do |locale|
|
AVAILABLE_LANGUAGE_CODES.each do |locale|
|
||||||
describe "#{locale} plural rules" do
|
describe "#{locale} plural rules" do
|
||||||
it "defines the keys" do
|
it "defines the keys for #{locale}" do
|
||||||
I18n.with_locale locale do
|
I18n.with_locale locale do
|
||||||
expect {
|
expect {
|
||||||
I18n.t 'i18n.plural.keys'
|
I18n.t 'i18n.plural.keys'
|
||||||
}.to_not raise_error
|
}.to_not raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "defines a valid pluralization function" do
|
it "defines a valid pluralization function for #{locale}" do
|
||||||
I18n.with_locale locale do
|
I18n.with_locale locale do
|
||||||
expect {
|
expect {
|
||||||
rule = I18n.t 'i18n.plural.rule', resolve: false
|
rule = I18n.t 'i18n.plural.rule', resolve: false
|
||||||
|
|
@ -20,8 +20,8 @@ describe 'locale files' do
|
||||||
}.to_not raise_error
|
}.to_not raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "defines a valid javascript pluralization function" do
|
it "defines a valid javascript pluralization function for #{locale}" do
|
||||||
I18n.with_locale locale do
|
I18n.with_locale locale do
|
||||||
expect {
|
expect {
|
||||||
ExecJS.eval I18n.t('i18n.plural.js_rule')
|
ExecJS.eval I18n.t('i18n.plural.js_rule')
|
||||||
|
|
@ -31,7 +31,7 @@ describe 'locale files' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
AVAILABLE_LANGUAGE_CODES.each do |locale|
|
AVAILABLE_LANGUAGE_CODES.each do |locale|
|
||||||
["diaspora/#{locale}.yml",
|
["diaspora/#{locale}.yml",
|
||||||
"devise/devise.#{locale}.yml",
|
"devise/devise.#{locale}.yml",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue