Merge branch 'next-minor' into develop
This commit is contained in:
commit
3bc0fc16a2
7 changed files with 50 additions and 15 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
## Bug fixes
|
||||
* Prevent duplicate mention notifications when the post is received twice [#7721](https://github.com/diaspora/diaspora/pull/7721)
|
||||
* Fixed a compatiblitiy issue with non-diaspora\* webfingers [#7718](https://github.com/diaspora/diaspora/pull/7718)
|
||||
|
||||
## Features
|
||||
* Add basic html5 audio/video embedding support [#6418](https://github.com/diaspora/diaspora/pull/6418)
|
||||
|
|
|
|||
6
Gemfile
6
Gemfile
|
|
@ -15,8 +15,8 @@ gem "unicorn-worker-killer", "0.4.4"
|
|||
|
||||
# Federation
|
||||
|
||||
gem "diaspora_federation-json_schema", "0.2.3"
|
||||
gem "diaspora_federation-rails", "0.2.3"
|
||||
gem "diaspora_federation-json_schema", "0.2.4"
|
||||
gem "diaspora_federation-rails", "0.2.4"
|
||||
|
||||
# API and JSON
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ group :test do
|
|||
gem "timecop", "0.9.1"
|
||||
gem "webmock", "3.0.1", require: false
|
||||
|
||||
gem "diaspora_federation-test", "0.2.3"
|
||||
gem "diaspora_federation-test", "0.2.4"
|
||||
|
||||
# Coverage
|
||||
gem "coveralls", "0.8.21", require: false
|
||||
|
|
|
|||
20
Gemfile.lock
20
Gemfile.lock
|
|
@ -170,18 +170,18 @@ GEM
|
|||
devise
|
||||
rails (>= 3.0.4)
|
||||
diaspora-prosody-config (0.0.7)
|
||||
diaspora_federation (0.2.3)
|
||||
diaspora_federation (0.2.4)
|
||||
faraday (>= 0.9.0, < 0.15.0)
|
||||
faraday_middleware (>= 0.10.0, < 0.13.0)
|
||||
nokogiri (~> 1.6, >= 1.6.8)
|
||||
typhoeus (~> 1.0)
|
||||
valid (~> 1.0)
|
||||
diaspora_federation-json_schema (0.2.3)
|
||||
diaspora_federation-rails (0.2.3)
|
||||
diaspora_federation-json_schema (0.2.4)
|
||||
diaspora_federation-rails (0.2.4)
|
||||
actionpack (>= 4.2, < 6)
|
||||
diaspora_federation (= 0.2.3)
|
||||
diaspora_federation-test (0.2.3)
|
||||
diaspora_federation (= 0.2.3)
|
||||
diaspora_federation (= 0.2.4)
|
||||
diaspora_federation-test (0.2.4)
|
||||
diaspora_federation (= 0.2.4)
|
||||
fabrication (~> 2.16)
|
||||
uuid (~> 2.3, >= 2.3.8)
|
||||
diff-lcs (1.3)
|
||||
|
|
@ -221,7 +221,7 @@ GEM
|
|||
http-cookie (~> 1.0.0)
|
||||
faraday_middleware (0.12.2)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
ffi (1.9.18)
|
||||
ffi (1.9.22)
|
||||
fixture_builder (0.5.0)
|
||||
activerecord (>= 2)
|
||||
activesupport (>= 2)
|
||||
|
|
@ -794,9 +794,9 @@ DEPENDENCIES
|
|||
devise (= 4.4.1)
|
||||
devise_lastseenable (= 0.0.6)
|
||||
diaspora-prosody-config (= 0.0.7)
|
||||
diaspora_federation-json_schema (= 0.2.3)
|
||||
diaspora_federation-rails (= 0.2.3)
|
||||
diaspora_federation-test (= 0.2.3)
|
||||
diaspora_federation-json_schema (= 0.2.4)
|
||||
diaspora_federation-rails (= 0.2.4)
|
||||
diaspora_federation-test (= 0.2.4)
|
||||
entypo-rails (= 3.0.0)
|
||||
eye (= 0.9.2)
|
||||
factory_girl_rails (= 4.8.0)
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ module Diaspora
|
|||
parent_guid: comment.post.guid,
|
||||
text: comment.text,
|
||||
created_at: comment.created_at,
|
||||
edited_at: comment.signature&.additional_data&.[]("edited_at"),
|
||||
author_signature: comment.signature.try(:author_signature),
|
||||
parent: related_entity(comment.post)
|
||||
},
|
||||
|
|
@ -169,6 +170,7 @@ module Diaspora
|
|||
def self.profile(profile)
|
||||
DiasporaFederation::Entities::Profile.new(
|
||||
author: profile.diaspora_handle,
|
||||
edited_at: profile.updated_at,
|
||||
first_name: profile.first_name,
|
||||
last_name: profile.last_name,
|
||||
image_url: profile.image_url,
|
||||
|
|
|
|||
|
|
@ -272,10 +272,19 @@ module Diaspora
|
|||
end
|
||||
end
|
||||
|
||||
# This are property names that are known by the +diaspora_federation+ library as properties but not
|
||||
# specially stored in our database and therefore need to be stored in the +additional_data+ field.
|
||||
UNKNOWN_PROPERTIES_NAMES = %i[edited_at].freeze
|
||||
private_constant :UNKNOWN_PROPERTIES_NAMES
|
||||
|
||||
private_class_method def self.build_signature(klass, entity)
|
||||
special_additional_data = UNKNOWN_PROPERTIES_NAMES.map {|name|
|
||||
[name.to_s, entity.public_send(name)] if entity.respond_to?(name) && entity.signature_order.include?(name)
|
||||
}.compact.to_h
|
||||
|
||||
klass.reflect_on_association(:signature).klass.new(
|
||||
author_signature: entity.author_signature,
|
||||
additional_data: entity.additional_data,
|
||||
additional_data: entity.additional_data.merge(special_additional_data),
|
||||
signature_order: SignatureOrder.find_or_create_by!(order: entity.signature_order.join(" "))
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ describe Diaspora::Federation::Entities do
|
|||
expect(federation_entity.guid).to eq(diaspora_entity.guid)
|
||||
expect(federation_entity.parent_guid).to eq(diaspora_entity.post.guid)
|
||||
expect(federation_entity.text).to eq(diaspora_entity.text)
|
||||
expect(federation_entity.created_at).to eq(diaspora_entity.created_at)
|
||||
expect(federation_entity.author_signature).to be_nil
|
||||
expect(federation_entity.additional_data).to be_empty
|
||||
end
|
||||
|
|
@ -42,6 +43,27 @@ describe Diaspora::Federation::Entities do
|
|||
expect(federation_entity.guid).to eq(diaspora_entity.guid)
|
||||
expect(federation_entity.parent_guid).to eq(diaspora_entity.post.guid)
|
||||
expect(federation_entity.text).to eq(diaspora_entity.text)
|
||||
expect(federation_entity.created_at).to eq(diaspora_entity.created_at)
|
||||
expect(federation_entity.author_signature).to eq(diaspora_entity.signature.author_signature)
|
||||
expect(federation_entity.signature_order.map(&:to_s)).to eq(diaspora_entity.signature.signature_order.order.split)
|
||||
expect(federation_entity.additional_data).to eq(diaspora_entity.signature.additional_data)
|
||||
end
|
||||
|
||||
it "builds a comment with edited_at" do
|
||||
edited_at = Time.now.utc + 3600
|
||||
diaspora_entity = FactoryGirl.build(
|
||||
:comment,
|
||||
signature: FactoryGirl.build(:comment_signature, additional_data: {"edited_at" => edited_at})
|
||||
)
|
||||
federation_entity = described_class.build(diaspora_entity)
|
||||
|
||||
expect(federation_entity).to be_instance_of(DiasporaFederation::Entities::Comment)
|
||||
expect(federation_entity.author).to eq(diaspora_entity.author.diaspora_handle)
|
||||
expect(federation_entity.guid).to eq(diaspora_entity.guid)
|
||||
expect(federation_entity.parent_guid).to eq(diaspora_entity.post.guid)
|
||||
expect(federation_entity.text).to eq(diaspora_entity.text)
|
||||
expect(federation_entity.created_at).to eq(diaspora_entity.created_at)
|
||||
expect(federation_entity.edited_at).to eq(edited_at)
|
||||
expect(federation_entity.author_signature).to eq(diaspora_entity.signature.author_signature)
|
||||
expect(federation_entity.signature_order.map(&:to_s)).to eq(diaspora_entity.signature.signature_order.order.split)
|
||||
expect(federation_entity.additional_data).to eq(diaspora_entity.signature.additional_data)
|
||||
|
|
@ -201,6 +223,7 @@ describe Diaspora::Federation::Entities do
|
|||
|
||||
expect(federation_entity).to be_instance_of(DiasporaFederation::Entities::Profile)
|
||||
expect(federation_entity.author).to eq(diaspora_entity.diaspora_handle)
|
||||
expect(federation_entity.edited_at).to eq(diaspora_entity.updated_at)
|
||||
expect(federation_entity.first_name).to eq(diaspora_entity.first_name)
|
||||
expect(federation_entity.last_name).to eq(diaspora_entity.last_name)
|
||||
expect(federation_entity.image_url).to eq(diaspora_entity.image_url)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ describe Diaspora::Federation::Receive do
|
|||
|
||||
expect(comment.signature).not_to be_nil
|
||||
expect(comment.signature.author_signature).to eq("aa")
|
||||
expect(comment.signature.additional_data).to eq("new_property" => "data")
|
||||
expect(comment.signature.additional_data).to eq("new_property" => "data", "edited_at" => comment_entity.edited_at)
|
||||
expect(comment.signature.order).to eq(comment_entity.signature_order.map(&:to_s))
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue