diaspora_federation 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +28 -0
- data/README.md +2 -1
- data/lib/diaspora_federation.rb +14 -14
- data/lib/diaspora_federation/callbacks.rb +4 -4
- data/lib/diaspora_federation/discovery.rb +1 -1
- data/lib/diaspora_federation/discovery/discovery.rb +8 -8
- data/lib/diaspora_federation/discovery/h_card.rb +11 -12
- data/lib/diaspora_federation/discovery/host_meta.rb +2 -2
- data/lib/diaspora_federation/discovery/web_finger.rb +10 -13
- data/lib/diaspora_federation/discovery/xrd_document.rb +1 -1
- data/lib/diaspora_federation/entities.rb +2 -2
- data/lib/diaspora_federation/entities/account_deletion.rb +4 -4
- data/lib/diaspora_federation/entities/comment.rb +3 -3
- data/lib/diaspora_federation/entities/contact.rb +4 -4
- data/lib/diaspora_federation/entities/conversation.rb +13 -13
- data/lib/diaspora_federation/entities/like.rb +5 -5
- data/lib/diaspora_federation/entities/location.rb +1 -1
- data/lib/diaspora_federation/entities/message.rb +5 -5
- data/lib/diaspora_federation/entities/participation.rb +6 -6
- data/lib/diaspora_federation/entities/person.rb +6 -6
- data/lib/diaspora_federation/entities/photo.rb +10 -10
- data/lib/diaspora_federation/entities/poll.rb +3 -3
- data/lib/diaspora_federation/entities/poll_answer.rb +2 -2
- data/lib/diaspora_federation/entities/poll_participation.rb +3 -3
- data/lib/diaspora_federation/entities/post.rb +7 -7
- data/lib/diaspora_federation/entities/profile.rb +6 -6
- data/lib/diaspora_federation/entities/related_entity.rb +4 -4
- data/lib/diaspora_federation/entities/relayable.rb +32 -24
- data/lib/diaspora_federation/entities/relayable_retraction.rb +17 -17
- data/lib/diaspora_federation/entities/request.rb +5 -5
- data/lib/diaspora_federation/entities/reshare.rb +7 -7
- data/lib/diaspora_federation/entities/retraction.rb +6 -6
- data/lib/diaspora_federation/entities/signed_retraction.rb +8 -8
- data/lib/diaspora_federation/entities/status_message.rb +8 -8
- data/lib/diaspora_federation/entity.rb +7 -7
- data/lib/diaspora_federation/federation/fetcher.rb +3 -3
- data/lib/diaspora_federation/federation/receiver.rb +3 -3
- data/lib/diaspora_federation/federation/receiver/abstract_receiver.rb +3 -3
- data/lib/diaspora_federation/federation/receiver/private.rb +1 -1
- data/lib/diaspora_federation/federation/receiver/public.rb +1 -1
- data/lib/diaspora_federation/federation/sender/hydra_wrapper.rb +7 -6
- data/lib/diaspora_federation/http_client.rb +2 -2
- data/lib/diaspora_federation/logging.rb +7 -7
- data/lib/diaspora_federation/properties_dsl.rb +3 -3
- data/lib/diaspora_federation/salmon.rb +1 -1
- data/lib/diaspora_federation/salmon/aes.rb +4 -4
- data/lib/diaspora_federation/salmon/encrypted_slap.rb +9 -9
- data/lib/diaspora_federation/salmon/magic_envelope.rb +16 -16
- data/lib/diaspora_federation/salmon/slap.rb +2 -2
- data/lib/diaspora_federation/validators.rb +1 -1
- data/lib/diaspora_federation/validators/account_deletion_validator.rb +1 -1
- data/lib/diaspora_federation/validators/comment_validator.rb +1 -1
- data/lib/diaspora_federation/validators/contact_validator.rb +1 -1
- data/lib/diaspora_federation/validators/conversation_validator.rb +4 -4
- data/lib/diaspora_federation/validators/h_card_validator.rb +2 -2
- data/lib/diaspora_federation/validators/like_validator.rb +1 -1
- data/lib/diaspora_federation/validators/location_validator.rb +1 -1
- data/lib/diaspora_federation/validators/message_validator.rb +4 -1
- data/lib/diaspora_federation/validators/participation_validator.rb +1 -1
- data/lib/diaspora_federation/validators/person_validator.rb +1 -1
- data/lib/diaspora_federation/validators/photo_validator.rb +3 -1
- data/lib/diaspora_federation/validators/poll_answer_validator.rb +1 -1
- data/lib/diaspora_federation/validators/poll_participation_validator.rb +1 -1
- data/lib/diaspora_federation/validators/poll_validator.rb +1 -1
- data/lib/diaspora_federation/validators/profile_validator.rb +3 -3
- data/lib/diaspora_federation/validators/related_entity_validator.rb +1 -1
- data/lib/diaspora_federation/validators/relayable_retraction_validator.rb +2 -2
- data/lib/diaspora_federation/validators/relayable_validator.rb +2 -2
- data/lib/diaspora_federation/validators/request_validator.rb +2 -2
- data/lib/diaspora_federation/validators/reshare_validator.rb +1 -1
- data/lib/diaspora_federation/validators/retraction_validator.rb +1 -1
- data/lib/diaspora_federation/validators/rules/birthday.rb +2 -2
- data/lib/diaspora_federation/validators/rules/boolean.rb +1 -1
- data/lib/diaspora_federation/validators/rules/diaspora_id.rb +5 -5
- data/lib/diaspora_federation/validators/rules/diaspora_id_count.rb +3 -3
- data/lib/diaspora_federation/validators/rules/guid.rb +4 -4
- data/lib/diaspora_federation/validators/rules/not_nil.rb +1 -1
- data/lib/diaspora_federation/validators/rules/public_key.rb +1 -1
- data/lib/diaspora_federation/validators/rules/tag_count.rb +2 -2
- data/lib/diaspora_federation/validators/signed_retraction_validator.rb +2 -2
- data/lib/diaspora_federation/validators/status_message_validator.rb +3 -1
- data/lib/diaspora_federation/validators/web_finger_validator.rb +3 -3
- data/lib/diaspora_federation/version.rb +1 -1
- metadata +3 -2
@@ -4,9 +4,9 @@ module DiasporaFederation
|
|
4
4
|
# another entity).
|
5
5
|
class RelatedEntity < Entity
|
6
6
|
# @!attribute [r] author
|
7
|
-
# The diaspora ID of the author
|
7
|
+
# The diaspora* ID of the author
|
8
8
|
# @see Person#author
|
9
|
-
# @return [String] diaspora ID
|
9
|
+
# @return [String] diaspora* ID
|
10
10
|
property :author
|
11
11
|
|
12
12
|
# @!attribute [r] local
|
@@ -15,12 +15,12 @@ module DiasporaFederation
|
|
15
15
|
property :local
|
16
16
|
|
17
17
|
# @!attribute [r] public
|
18
|
-
#
|
18
|
+
# Shows whether the entity is visible to everyone or only to some aspects
|
19
19
|
# @return [Boolean] is it public
|
20
20
|
property :public, default: false
|
21
21
|
|
22
22
|
# @!attribute [r] parent
|
23
|
-
# if the entity also
|
23
|
+
# Parent if the entity also has a parent (Comment or Like) or +nil+ if it has no parent
|
24
24
|
# @return [RelatedEntity] parent entity
|
25
25
|
entity :parent, Entities::RelatedEntity, default: nil
|
26
26
|
|
@@ -1,32 +1,32 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
3
|
+
# This is a module that defines common properties for relayable entities
|
4
4
|
# which include Like, Comment, Participation, Message, etc. Each relayable
|
5
|
-
# has a parent, identified by guid. Relayables also
|
5
|
+
# has a parent, identified by guid. Relayables are also signed and signing/verification
|
6
6
|
# logic is embedded into Salmon XML processing code.
|
7
7
|
module Relayable
|
8
8
|
include Logging
|
9
9
|
|
10
|
-
#
|
10
|
+
# Digest instance used for signing
|
11
11
|
DIGEST = OpenSSL::Digest::SHA256.new
|
12
12
|
|
13
|
-
#
|
13
|
+
# Order from the parsed xml for signature
|
14
14
|
# @return [Array] order from xml
|
15
15
|
attr_reader :xml_order
|
16
16
|
|
17
|
-
#
|
17
|
+
# Additional properties from parsed xml
|
18
18
|
# @return [Hash] additional xml elements
|
19
19
|
attr_reader :additional_xml_elements
|
20
20
|
|
21
|
-
#
|
21
|
+
# On inclusion of this module the required properties for a relayable are added to the object that includes it.
|
22
22
|
#
|
23
23
|
# @!attribute [r] author
|
24
|
-
# The diaspora ID of the author
|
24
|
+
# The diaspora* ID of the author
|
25
25
|
# @see Person#author
|
26
|
-
# @return [String] diaspora ID
|
26
|
+
# @return [String] diaspora* ID
|
27
27
|
#
|
28
28
|
# @!attribute [r] guid
|
29
|
-
#
|
29
|
+
# A random string of at least 16 chars
|
30
30
|
# @see Validation::Rule::Guid
|
31
31
|
# @return [String] comment guid
|
32
32
|
#
|
@@ -35,20 +35,20 @@ module DiasporaFederation
|
|
35
35
|
# @return [String] parent guid
|
36
36
|
#
|
37
37
|
# @!attribute [r] author_signature
|
38
|
-
# Contains a signature of the entity using the private key of the author of a post itself
|
38
|
+
# Contains a signature of the entity using the private key of the author of a post itself
|
39
39
|
# The presence of this signature is mandatory. Without it the entity won't be accepted by
|
40
40
|
# a target pod.
|
41
41
|
# @return [String] author signature
|
42
42
|
#
|
43
43
|
# @!attribute [r] parent_author_signature
|
44
44
|
# Contains a signature of the entity using the private key of the author of a parent post
|
45
|
-
# This signature is required only when
|
45
|
+
# This signature is required only when federating from upstream (parent) post author to
|
46
46
|
# downstream subscribers. This is the case when the parent author has to resend a relayable
|
47
|
-
# received from one of
|
47
|
+
# received from one of their subscribers to all others.
|
48
48
|
# @return [String] parent author signature
|
49
49
|
#
|
50
50
|
# @!attribute [r] parent
|
51
|
-
#
|
51
|
+
# Meta information about the parent object
|
52
52
|
# @return [RelatedEntity] parent entity
|
53
53
|
#
|
54
54
|
# @param [Entity] klass the entity in which it is included
|
@@ -78,12 +78,12 @@ module DiasporaFederation
|
|
78
78
|
super(data)
|
79
79
|
end
|
80
80
|
|
81
|
-
#
|
81
|
+
# Verifies the signatures (+author_signature+ and +parent_author_signature+ if needed).
|
82
82
|
# @raise [SignatureVerificationFailed] if the signature is not valid or no public key is found
|
83
83
|
def verify_signatures
|
84
84
|
verify_signature(author, :author_signature)
|
85
85
|
|
86
|
-
#
|
86
|
+
# This happens only on downstream federation.
|
87
87
|
verify_signature(parent.author, :parent_author_signature) unless parent.local
|
88
88
|
end
|
89
89
|
|
@@ -116,7 +116,7 @@ module DiasporaFederation
|
|
116
116
|
logger.info "event=verify_signature signature=#{signature_key} status=valid obj=#{self}"
|
117
117
|
end
|
118
118
|
|
119
|
-
#
|
119
|
+
# Sign with author key
|
120
120
|
# @raise [AuthorPrivateKeyNotFound] if the author private key is not found
|
121
121
|
# @return [String] A Base64 encoded signature of #signature_data with key
|
122
122
|
def sign_with_author
|
@@ -127,7 +127,7 @@ module DiasporaFederation
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
#
|
130
|
+
# Sign with parent author key, if the parent author is local (if the private key is found)
|
131
131
|
# @return [String] A Base64 encoded signature of #signature_data with key
|
132
132
|
def sign_with_parent_author_if_available
|
133
133
|
privkey = DiasporaFederation.callbacks.trigger(:fetch_private_key, parent.author)
|
@@ -159,7 +159,7 @@ module DiasporaFederation
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
#
|
162
|
+
# The order for signing
|
163
163
|
# @return [Array]
|
164
164
|
def signature_order
|
165
165
|
xml_order.nil? ? self.class::LEGACY_SIGNATURE_ORDER : xml_order.reject {|name| name =~ /signature/ }
|
@@ -171,7 +171,7 @@ module DiasporaFederation
|
|
171
171
|
signature_order.map {|name| data[name] }.join(";")
|
172
172
|
end
|
173
173
|
|
174
|
-
#
|
174
|
+
# Override class methods from {Entity} to parse the xml
|
175
175
|
module ParseXML
|
176
176
|
private
|
177
177
|
|
@@ -181,7 +181,7 @@ module DiasporaFederation
|
|
181
181
|
# Use all known properties to build the Entity (entity_data). All additional xml elements
|
182
182
|
# are respected and attached to a hash as string (additional_xml_elements). It also remembers
|
183
183
|
# the order of the xml-nodes (xml_order). This is needed to support receiving objects from
|
184
|
-
# the future versions of
|
184
|
+
# the future versions of diaspora*, where new elements may have been added.
|
185
185
|
entity_data = {}
|
186
186
|
additional_xml_elements = {}
|
187
187
|
|
@@ -203,20 +203,28 @@ module DiasporaFederation
|
|
203
203
|
end
|
204
204
|
|
205
205
|
def fetch_parent(data)
|
206
|
-
type = data
|
207
|
-
|
206
|
+
type = data.fetch(:parent_type) {
|
207
|
+
if const_defined?(:PARENT_TYPE)
|
208
|
+
self::PARENT_TYPE
|
209
|
+
else
|
210
|
+
raise DiasporaFederation::Entity::ValidationError, "invalid #{self}! missing 'parent_type'."
|
211
|
+
end
|
212
|
+
}
|
213
|
+
guid = data.fetch(:parent_guid) {
|
214
|
+
raise DiasporaFederation::Entity::ValidationError, "invalid #{self}! missing 'parent_guid'."
|
215
|
+
}
|
208
216
|
|
209
217
|
data[:parent] = DiasporaFederation.callbacks.trigger(:fetch_related_entity, type, guid)
|
210
218
|
|
211
219
|
unless data[:parent]
|
212
|
-
#
|
220
|
+
# Fetch and receive parent from remote, if not available locally
|
213
221
|
Federation::Fetcher.fetch_public(data[:author], type, guid)
|
214
222
|
data[:parent] = DiasporaFederation.callbacks.trigger(:fetch_related_entity, type, guid)
|
215
223
|
end
|
216
224
|
end
|
217
225
|
end
|
218
226
|
|
219
|
-
# Raised, if creating the author_signature
|
227
|
+
# Raised, if creating the author_signature fails, because the private key was not found
|
220
228
|
class AuthorPrivateKeyNotFound < RuntimeError
|
221
229
|
end
|
222
230
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
4
|
-
# relayable entity ({Entities::Comment}, {Entities::Like})
|
3
|
+
# This entity represents a claim of deletion of a previously federated
|
4
|
+
# relayable entity. ({Entities::Comment}, {Entities::Like})
|
5
5
|
#
|
6
6
|
# There are two cases of federation of the RelayableRetraction.
|
7
7
|
# Retraction from the dowstream object owner is when an author of the
|
8
|
-
# relayable (e.g. Comment) deletes it
|
9
|
-
# is filled and retraction is sent to the commented post's author. Here
|
10
|
-
#
|
11
|
-
# signature in parent_author_signature and sends it to other pods where
|
12
|
-
# other participating people present. This is the second case - retraction
|
8
|
+
# relayable (e.g. Comment) deletes it themself. In this case only target_author_signature
|
9
|
+
# is filled and a retraction is sent to the commented post's author. Here
|
10
|
+
# the upstream object owner signs it with the parent's author key, puts
|
11
|
+
# the signature in parent_author_signature and sends it to other pods where
|
12
|
+
# other participating people are present. This is the second case - retraction
|
13
13
|
# from the upstream object owner.
|
14
14
|
# Retraction from the upstream object owner can also be performed by the
|
15
|
-
# upstream object owner
|
15
|
+
# upstream object owner themself - they have a right to delete comments on their posts.
|
16
16
|
# In any case in the retraction by the upstream author target_author_signature
|
17
17
|
# is not checked, only parent_author_signature is checked.
|
18
18
|
#
|
@@ -20,33 +20,33 @@ module DiasporaFederation
|
|
20
20
|
# @deprecated will be replaced with {Entities::Retraction}
|
21
21
|
class RelayableRetraction < Entity
|
22
22
|
# @!attribute [r] parent_author_signature
|
23
|
-
# Contains a signature of the entity using the private key of the author of a parent post
|
24
|
-
# This signature is mandatory only when
|
23
|
+
# Contains a signature of the entity using the private key of the author of a parent post.
|
24
|
+
# This signature is mandatory only when federating from an upstream author to the subscribers.
|
25
25
|
# @see Relayable#parent_author_signature
|
26
26
|
# @return [String] parent author signature
|
27
27
|
property :parent_author_signature, default: nil
|
28
28
|
|
29
29
|
# @!attribute [r] target_guid
|
30
|
-
#
|
30
|
+
# Guid of a relayable to be deleted
|
31
31
|
# @see Comment#guid
|
32
32
|
# @return [String] target guid
|
33
33
|
property :target_guid
|
34
34
|
|
35
35
|
# @!attribute [r] target_type
|
36
|
-
#
|
36
|
+
# A string describing a type of the target
|
37
37
|
# @see Retraction#target_type
|
38
38
|
# @return [String] target type
|
39
39
|
property :target_type
|
40
40
|
|
41
41
|
# @!attribute [r] author
|
42
|
-
# The diaspora ID of the person who deletes a relayable
|
42
|
+
# The diaspora* ID of the person who deletes a relayable
|
43
43
|
# @see Person#author
|
44
|
-
# @return [String] diaspora ID
|
44
|
+
# @return [String] diaspora* ID
|
45
45
|
property :author, xml_name: :sender_handle
|
46
46
|
|
47
47
|
# @!attribute [r] target_author_signature
|
48
48
|
# Contains a signature of the entity using the private key of the
|
49
|
-
# author of a federated relayable entity ({Entities::Comment}, {Entities::Like})
|
49
|
+
# author of a federated relayable entity. ({Entities::Comment}, {Entities::Like})
|
50
50
|
# This signature is mandatory only when federation from the subscriber to an upstream
|
51
51
|
# author is done.
|
52
52
|
# @see Relayable#author_signature
|
@@ -54,11 +54,11 @@ module DiasporaFederation
|
|
54
54
|
property :target_author_signature, default: nil
|
55
55
|
|
56
56
|
# @!attribute [r] target
|
57
|
-
#
|
57
|
+
# Target entity
|
58
58
|
# @return [RelatedEntity] target entity
|
59
59
|
entity :target, Entities::RelatedEntity
|
60
60
|
|
61
|
-
#
|
61
|
+
# Use only {Retraction} for receive
|
62
62
|
# @return [Retraction] instance as normal retraction
|
63
63
|
def to_retraction
|
64
64
|
Retraction.new(author: author, target_guid: target_guid, target_type: target_type, target: target)
|
@@ -1,24 +1,24 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
4
|
-
# when
|
3
|
+
# This entity represents a sharing request for a user. A user issues it
|
4
|
+
# when they start sharing with another user.
|
5
5
|
#
|
6
6
|
# @see Validators::RequestValidator
|
7
7
|
# @deprecated will be replaced with {Contact}
|
8
8
|
class Request < Entity
|
9
9
|
# @!attribute [r] author
|
10
|
-
# The diaspora ID of the person who
|
10
|
+
# The diaspora* ID of the person who share their profile
|
11
11
|
# @see Person#author
|
12
12
|
# @return [String] sender ID
|
13
13
|
property :author, xml_name: :sender_handle
|
14
14
|
|
15
15
|
# @!attribute [r] recipient
|
16
|
-
# The diaspora ID of the person who will be shared with
|
16
|
+
# The diaspora* ID of the person who will be shared with
|
17
17
|
# @see Validation::Rule::DiasporaId
|
18
18
|
# @return [String] recipient ID
|
19
19
|
property :recipient, xml_name: :recipient_handle
|
20
20
|
|
21
|
-
#
|
21
|
+
# Use only {Contact} for receive
|
22
22
|
# @return [Contact] instance as contact
|
23
23
|
def to_contact
|
24
24
|
Contact.new(author: author, recipient: recipient)
|
@@ -1,25 +1,25 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
3
|
+
# This entity represents the fact that a user reshared another user's post.
|
4
4
|
#
|
5
5
|
# @see Validators::ReshareValidator
|
6
6
|
class Reshare < Entity
|
7
7
|
include Post
|
8
8
|
|
9
9
|
# @!attribute [r] root_author
|
10
|
-
# The diaspora ID of the person who posted the original post
|
10
|
+
# The diaspora* ID of the person who posted the original post
|
11
11
|
# @see Person#author
|
12
|
-
# @return [String] diaspora ID
|
12
|
+
# @return [String] diaspora* ID
|
13
13
|
property :root_author, xml_name: :root_diaspora_id
|
14
14
|
|
15
15
|
# @!attribute [r] root_guid
|
16
|
-
#
|
16
|
+
# Guid of the original post
|
17
17
|
# @see StatusMessage#guid
|
18
18
|
# @return [String] root guid
|
19
19
|
property :root_guid
|
20
20
|
|
21
21
|
# @!attribute [r] public
|
22
|
-
#
|
22
|
+
# Has no meaning at the moment
|
23
23
|
# @return [Boolean] public
|
24
24
|
property :public, default: true # always true? (we only reshare public posts)
|
25
25
|
|
@@ -28,13 +28,13 @@ module DiasporaFederation
|
|
28
28
|
"#{super}:#{root_guid}"
|
29
29
|
end
|
30
30
|
|
31
|
-
#
|
31
|
+
# Fetch and receive root post from remote, if not available locally
|
32
32
|
def fetch_root
|
33
33
|
root = DiasporaFederation.callbacks.trigger(:fetch_related_entity, "Post", root_guid)
|
34
34
|
Federation::Fetcher.fetch_public(root_author, "Post", root_guid) unless root
|
35
35
|
end
|
36
36
|
|
37
|
-
# Fetch root post after parse
|
37
|
+
# Fetch root post after parse
|
38
38
|
# @see Entity.populate_entity
|
39
39
|
# @param [Nokogiri::XML::Element] root_node xml nodes
|
40
40
|
# @return [Entity] instance
|
@@ -1,27 +1,27 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
3
|
+
# This entity represents a claim of deletion of a previously federated entity.
|
4
4
|
#
|
5
5
|
# @see Validators::RetractionValidator
|
6
6
|
class Retraction < Entity
|
7
7
|
# @!attribute [r] author
|
8
|
-
# The diaspora ID of the person who deletes the entity
|
8
|
+
# The diaspora* ID of the person who deletes the entity
|
9
9
|
# @see Person#author
|
10
|
-
# @return [String] diaspora ID
|
10
|
+
# @return [String] diaspora* ID
|
11
11
|
property :author, xml_name: :diaspora_handle
|
12
12
|
|
13
13
|
# @!attribute [r] target_guid
|
14
|
-
#
|
14
|
+
# Guid of the entity to be deleted
|
15
15
|
# @return [String] target guid
|
16
16
|
property :target_guid, xml_name: :post_guid
|
17
17
|
|
18
18
|
# @!attribute [r] target_type
|
19
|
-
# A string describing the type of the target
|
19
|
+
# A string describing the type of the target
|
20
20
|
# @return [String] target type
|
21
21
|
property :target_type, xml_name: :type
|
22
22
|
|
23
23
|
# @!attribute [r] target
|
24
|
-
#
|
24
|
+
# Target entity
|
25
25
|
# @return [RelatedEntity] target entity
|
26
26
|
entity :target, Entities::RelatedEntity
|
27
27
|
|
@@ -1,27 +1,27 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
4
|
-
# entity of post type ({Entities::StatusMessage})
|
3
|
+
# This entity represents a claim of deletion of a previously federated
|
4
|
+
# entity of post type. ({Entities::StatusMessage})
|
5
5
|
#
|
6
6
|
# @see Validators::SignedRetractionValidator
|
7
7
|
# @deprecated will be replaced with {Entities::Retraction}
|
8
8
|
class SignedRetraction < Entity
|
9
9
|
# @!attribute [r] target_guid
|
10
|
-
#
|
10
|
+
# Guid of a post to be deleted
|
11
11
|
# @see Retraction#target_guid
|
12
12
|
# @return [String] target guid
|
13
13
|
property :target_guid
|
14
14
|
|
15
15
|
# @!attribute [r] target_type
|
16
|
-
# A string describing the type of the target
|
16
|
+
# A string describing the type of the target
|
17
17
|
# @see Retraction#target_type
|
18
18
|
# @return [String] target type
|
19
19
|
property :target_type
|
20
20
|
|
21
21
|
# @!attribute [r] author
|
22
|
-
# The diaspora ID of the person who deletes a post
|
22
|
+
# The diaspora* ID of the person who deletes a post
|
23
23
|
# @see Person#author
|
24
|
-
# @return [String] diaspora ID
|
24
|
+
# @return [String] diaspora* ID
|
25
25
|
property :author, xml_name: :sender_handle
|
26
26
|
|
27
27
|
# @!attribute [r] author_signature
|
@@ -31,11 +31,11 @@ module DiasporaFederation
|
|
31
31
|
property :target_author_signature, default: nil
|
32
32
|
|
33
33
|
# @!attribute [r] target
|
34
|
-
#
|
34
|
+
# Target entity
|
35
35
|
# @return [RelatedEntity] target entity
|
36
36
|
entity :target, Entities::RelatedEntity
|
37
37
|
|
38
|
-
#
|
38
|
+
# Use only {Retraction} for receive
|
39
39
|
# @return [Retraction] instance as normal retraction
|
40
40
|
def to_retraction
|
41
41
|
Retraction.new(author: author, target_guid: target_guid, target_type: target_type, target: target)
|
@@ -1,33 +1,33 @@
|
|
1
1
|
module DiasporaFederation
|
2
2
|
module Entities
|
3
|
-
#
|
3
|
+
# This entity represents a status message sent by a user.
|
4
4
|
#
|
5
5
|
# @see Validators::StatusMessageValidator
|
6
6
|
class StatusMessage < Entity
|
7
7
|
include Post
|
8
8
|
|
9
|
-
# @!attribute [r]
|
10
|
-
#
|
9
|
+
# @!attribute [r] text
|
10
|
+
# Text of the status message composed by the user
|
11
11
|
# @return [String] text of the status message
|
12
|
-
property :raw_message
|
12
|
+
property :text, xml_name: :raw_message
|
13
13
|
|
14
14
|
# @!attribute [r] photos
|
15
|
-
#
|
15
|
+
# Optional photos attached to the status message
|
16
16
|
# @return [[Entities::Photo]] photos
|
17
17
|
entity :photos, [Entities::Photo], default: []
|
18
18
|
|
19
19
|
# @!attribute [r] location
|
20
|
-
#
|
20
|
+
# Optional location attached to the status message
|
21
21
|
# @return [Entities::Location] location
|
22
22
|
entity :location, Entities::Location, default: nil
|
23
23
|
|
24
24
|
# @!attribute [r] poll
|
25
|
-
#
|
25
|
+
# Optional poll attached to the status message
|
26
26
|
# @return [Entities::Poll] poll
|
27
27
|
entity :poll, Entities::Poll, default: nil
|
28
28
|
|
29
29
|
# @!attribute [r] public
|
30
|
-
#
|
30
|
+
# Shows whether the status message is visible to everyone or only to some aspects
|
31
31
|
# @return [Boolean] is it public
|
32
32
|
property :public, default: false
|
33
33
|
|