Add edited_at property to event messages

This commit is contained in:
Benjamin Neff 2018-01-23 03:11:59 +01:00
parent 057ebd69f0
commit 63f1cbd70a
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
7 changed files with 42 additions and 21 deletions

View file

@ -8,22 +8,23 @@ See also: [EventParticipation][event_participation]
## Properties
| Property | Type (Length) | Description |
| --------- | ---------------------------- | --------------------------------------------- |
| `author` | [diaspora\* ID][diaspora-id] | The diaspora\* ID of the author of the event. |
| `guid` | [GUID][guid] | The GUID of the event. |
| `summary` | [String][string] (255) | The summary of the event. |
| `start` | [Timestamp][timestamp] | The start time of the event (in UTC). |
| Property | Type (Length) | Editable | Description |
| --------- | ---------------------------- |:--------:| --------------------------------------------- |
| `author` | [diaspora\* ID][diaspora-id] | ✘ | The diaspora\* ID of the author of the event. |
| `guid` | [GUID][guid] | ✘ | The GUID of the event. |
| `summary` | [String][string] (255) | ✔ | The summary of the event. |
| `start` | [Timestamp][timestamp] | ✔ | The start time of the event (in UTC). |
## Optional Properties
| Property | Type (Length) | Description |
| ------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `end` | [Timestamp][timestamp] | The end time of the event (in UTC). If missing it is an open-end or a single `all_day` event. |
| `all_day` | [Boolean][boolean] | `true` if it is an all day event. Time/timezone is ignored. `false` by default. |
| `timezone` | [Timezone][timezone] | If the event is fixed to a specific timezone, this can be set. The `start`/`end` timestamps are then displayed in this timezone. This is useful for local events. If missing or empty the timestamps are displayed in the timezone of the user. |
| `description` | [Markdown][markdown] (65535) | Description of the event. |
| `location` | [Location][location] | Location of the event. |
| Property | Type (Length) | Editable | Description |
| ------------- | ---------------------------- |:--------:| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `end` | [Timestamp][timestamp] | ✔ | The end time of the event (in UTC). If missing it is an open-end or a single `all_day` event. |
| `all_day` | [Boolean][boolean] | ✔ | `true` if it is an all day event. Time/timezone is ignored. `false` by default. |
| `timezone` | [Timezone][timezone] | ✔ | If the event is fixed to a specific timezone, this can be set. The `start`/`end` timestamps are then displayed in this timezone. This is useful for local events. If missing or empty the timestamps are displayed in the timezone of the user. |
| `description` | [Markdown][markdown] (65535) | ✔ | Description of the event. |
| `location` | [Location][location] | ✔ | Location of the event. |
| `edited_at` | [Timestamp][timestamp] | ✔ | The timestamp when the event was edited. |
## Examples

View file

@ -8,14 +8,19 @@ See also: [Relayable][relayable]
## Properties
| Property | Type | Description |
| ------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `author` | [diaspora\* ID][diaspora-id] | The diaspora\* ID of the author of the event participation. |
| `guid` | [GUID][guid] | The GUID of the event participation. |
| `parent_guid` | [GUID][guid] | The GUID of the [Event][event]. |
| `status` | [String][string] | The participation status, lowercase string as defined in [RFC 5545, Section 3.2.12][status] (`accepted`, `declined` or `tentative`). |
| `author_signature` | [Signature][signature] | The signature from the author of the event participation. |
| `parent_author_signature` | [Signature][signature] | The signature from the author of the [Event][event]. |
| Property | Type | Editable | Description |
| ------------------ | ---------------------------- |:--------:| ------------------------------------------------------------------------------------------------------------------------------------ |
| `author` | [diaspora\* ID][diaspora-id] | ✘ | The diaspora\* ID of the author of the event participation. |
| `guid` | [GUID][guid] | ✘ | The GUID of the event participation. |
| `parent_guid` | [GUID][guid] | ✘ | The GUID of the [Event][event]. |
| `status` | [String][string] | ✔ | The participation status, lowercase string as defined in [RFC 5545, Section 3.2.12][status] (`accepted`, `declined` or `tentative`). |
| `author_signature` | [Signature][signature] | ✔ | The signature from the author of the event participation. |
## Optional Properties
| Property | Type | Editable | Description |
| ----------- | ---------------------- |:--------:| ------------------------------------------------------ |
| `edited_at` | [Timestamp][timestamp] | ✔ | The timestamp when the event participation was edited. |
## Examples
@ -50,5 +55,6 @@ See also: [Relayable][relayable]
[string]: {{ site.baseurl }}/federation/types.html#string
[status]: https://tools.ietf.org/html/rfc5545#section-3.2.12
[signature]: {{ site.baseurl }}/federation/types.html#signature
[timestamp]: {{ site.baseurl }}/federation/types.html#timestamp
[event]: {{ site.baseurl }}/entities/event.html
[relayable]: {{ site.baseurl }}/federation/relayable.html

View file

@ -16,6 +16,11 @@ module DiasporaFederation
# @return [String] guid
property :guid, :string
# @!attribute [r] edited_at
# The timestamp when the event was edited
# @return [Time] edited time
property :edited_at, :timestamp, optional: true
# @!attribute [r] summary
# The summary of the event
# @return [String] event summary

View file

@ -14,6 +14,11 @@ module DiasporaFederation
# "accepted", "declined" or "tentative"
# @return [String] event participation status
property :status, :string
# @!attribute [r] edited_at
# The timestamp when the event participation was edited
# @return [Time] edited time
property :edited_at, :timestamp, optional: true
end
end
end

View file

@ -189,6 +189,7 @@ module DiasporaFederation
Fabricator(:event_entity, class_name: DiasporaFederation::Entities::Event) do |f|
author { Fabricate.sequence(:diaspora_id) }
guid { Fabricate.sequence(:guid) }
edited_at { Time.now.utc }
summary "Cool event"
description "You need to see this!"
start { change_time(Time.now.utc, min: 0) - 3600 }
@ -202,6 +203,7 @@ module DiasporaFederation
author { Fabricate.sequence(:diaspora_id) }
guid { Fabricate.sequence(:guid) }
status "accepted"
edited_at { Time.now.utc }
end
Fabricator(:related_entity, class_name: DiasporaFederation::Entities::RelatedEntity) do

View file

@ -17,6 +17,7 @@ module DiasporaFederation
<guid>#{data[:guid]}</guid>
<parent_guid>#{parent.guid}</parent_guid>
<status>#{data[:status]}</status>
<edited_at>#{data[:edited_at].utc.iso8601}</edited_at>
<author_signature>#{data[:author_signature]}</author_signature>
<parent_author_signature>#{data[:parent_author_signature]}</parent_author_signature>
</event_participation>

View file

@ -9,6 +9,7 @@ module DiasporaFederation
<event>
<author>#{data[:author]}</author>
<guid>#{data[:guid]}</guid>
<edited_at>#{data[:edited_at].utc.iso8601}</edited_at>
<summary>#{data[:summary]}</summary>
<description>#{data[:description]}</description>
<start>#{data[:start].utc.iso8601}</start>