Class: DiasporaFederation::Entities::Participation
- Inherits:
-
DiasporaFederation::Entity
- Object
- DiasporaFederation::Entity
- DiasporaFederation::Entities::Participation
- Includes:
- Relayable
- Defined in:
- lib/diaspora_federation/entities/participation.rb
Overview
Participation is sent to subscribe a user on updates for some post.
Defined Under Namespace
Classes: ParentNotLocal
Constant Summary collapse
- LEGACY_SIGNATURE_ORDER =
Deprecated.
Old signature order
%i(guid parent_type parent_guid author).freeze
Constants included from Relayable
Constants inherited from DiasporaFederation::Entity
DiasporaFederation::Entity::INVALID_XML_REGEX
Instance Attribute Summary collapse
-
#parent_type ⇒ String
readonly
A string describing a type of the target to subscribe on Currently only “Post” is supported.
Attributes included from Relayable
#additional_xml_elements, #author, #author_signature, #guid, #parent, #parent_author_signature, #parent_guid, #xml_order
Instance Method Summary collapse
-
#sender_valid?(sender) ⇒ Boolean
deprecated
Deprecated.
remove after Participation doesn’t include Relayable anymore
-
#validate_parent ⇒ Object
Validates that the parent exists and the parent author is local.
Methods included from Relayable
included, #initialize, #to_s, #verify_signatures
Methods included from Logging
Methods inherited from DiasporaFederation::Entity
entity_class, entity_name, from_xml, #initialize, #to_h, #to_s, #to_xml
Methods included from PropertiesDSL
#class_props, #default_values, #entity, #find_property_for_xml_name, #missing_props, #property, #resolv_aliases, #xml_names
Instance Attribute Details
#parent_type ⇒ String (readonly)
A string describing a type of the target to subscribe on Currently only “Post” is supported.
17 |
# File 'lib/diaspora_federation/entities/participation.rb', line 17 property :parent_type, xml_name: :target_type |
Instance Method Details
#sender_valid?(sender) ⇒ Boolean
remove after DiasporaFederation::Entities::Participation doesn’t include Relayable anymore
It is only valid to receive a DiasporaFederation::Entities::Participation from the author themself.
21 22 23 |
# File 'lib/diaspora_federation/entities/participation.rb', line 21 def sender_valid?(sender) sender == end |
#validate_parent ⇒ Object
Validates that the parent exists and the parent author is local
26 27 28 29 |
# File 'lib/diaspora_federation/entities/participation.rb', line 26 def validate_parent parent = DiasporaFederation.callbacks.trigger(:fetch_related_entity, parent_type, parent_guid) raise ParentNotLocal, "obj=#{self}" unless parent && parent.local end |