diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-04-26 21:25:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-26 21:25:26 +0200 |
commit | 0360135d4d39d838fa9b090abc1e76284eb8ff64 (patch) | |
tree | a432990fd435d189f7dd1f48a27e2f6e1f6dddd3 /spec/lib/activitypub | |
parent | 33cd80d69c1491ff70ce9191113763c76cb7e6b7 (diff) |
Fix PeerTube videos appearing with an erroneous “Edited at” marker (#18100)
* Fix PeerTube videos appearing with an erroneous “Edited at” marker PeerTube videos have an `updated` field equal to `published`. When processing an incoming activity that has the same value for `updated` and `published`, assume this doesn't represent an actual edit. * Please CodeClimate
Diffstat (limited to 'spec/lib/activitypub')
-rw-r--r-- | spec/lib/activitypub/activity/create_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 2703c18f3..1a25395fa 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -29,6 +29,58 @@ RSpec.describe ActivityPub::Activity::Create do subject.perform end + context 'object has been edited' do + let(:object_json) do + { + id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, + type: 'Note', + content: 'Lorem ipsum', + published: '2022-01-22T15:00:00Z', + updated: '2022-01-22T16:00:00Z', + } + end + + it 'creates status' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.text).to eq 'Lorem ipsum' + end + + it 'marks status as edited' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.edited?).to eq true + end + end + + context 'object has update date equal to creation date' do + let(:object_json) do + { + id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, + type: 'Note', + content: 'Lorem ipsum', + published: '2022-01-22T15:00:00Z', + updated: '2022-01-22T15:00:00Z', + } + end + + it 'creates status' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.text).to eq 'Lorem ipsum' + end + + it 'does not mark status as edited' do + status = sender.statuses.first + + expect(status).to_not be_nil + expect(status.edited?).to eq false + end + end + context 'unknown object type' do let(:object_json) do { |