Skip to content

Commit

Permalink
Send last_edited_by_editor_id to Publishing API
Browse files Browse the repository at this point in the history
This is a new field that will allow us to identify the last person who
has edited an Edition within the Publishing API.
  • Loading branch information
pezholio committed Oct 18, 2024
1 parent 28522ea commit 64f3f84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/presenters/formats/edition_format_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def required_fields(republish)
schema_name:,
document_type:,
public_updated_at: public_updated_at.rfc3339(3),
last_edited_by_editor_id:,
publishing_app: "publisher",
rendering_app:,
routes:,
Expand Down Expand Up @@ -97,5 +98,9 @@ def major_change?
def public_updated_at
edition.public_updated_at || edition.updated_at
end

def last_edited_by_editor_id
edition.creator.uid
end
end
end
8 changes: 8 additions & 0 deletions test/unit/presenters/formats/edition_format_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def result
edition.stubs :latest_change_note
edition.stubs :auth_bypass_id
edition.stubs :exact_route?
edition.stubs creator: FactoryBot.build(:user)

artefact.stubs :language
end
Expand Down Expand Up @@ -160,5 +161,12 @@ def result
expected = { auth_bypass_ids: %w[foo] }
assert_equal expected, result[:access_limited]
end

should "[:last_edited_by_editor_id]" do
uid = SecureRandom.uuid
user = FactoryBot.build(:user, uid:)
edition.expects(:creator).returns(user)
assert_equal uid, result[:last_edited_by_editor_id]
end
end
end

0 comments on commit 64f3f84

Please sign in to comment.