Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor all ActivityPub deliveries to be serialized and signed through one concern #10966

Merged
merged 1 commit into from
Jun 4, 2019

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Jun 4, 2019

No description provided.

@Gargron Gargron added the refactoring Improving code quality label Jun 4, 2019
@Gargron Gargron force-pushed the refactor-serialize-payload branch 4 times, most recently from df89093 to 46dad7b Compare June 4, 2019 17:40
@Gargron Gargron force-pushed the refactor-serialize-payload branch from 46dad7b to 8a7640c Compare June 4, 2019 17:44
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nitpicks but LGTM overall.
Also, is there an advantage using Oj.dump over #to_json?

sign_with = options.delete(:sign_with)
payload = ActiveModelSerializers::SerializableResource.new(record, options.merge(serializer: serializer, adapter: ActivityPub::Adapter)).as_json

if (record.respond_to?(:sign?) && record.sign?) && signer && signing_enabled?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nitpick, those parenthesis do not help with readability

@@ -0,0 +1,19 @@
# frozen_string_literal: true

module Payloadable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick: this name is weird, especially since it's used by services and not models…

@Gargron
Copy link
Member Author

Gargron commented Jun 4, 2019

Also, is there an advantage using Oj.dump over #to_json?

I believe AMS was configured to use Oj in the background so there is no difference, except that the output of serialize_payload is sometimes used as a hash, so it's too early to convert it to a string there.

@Gargron Gargron merged commit f2b743e into master Jun 4, 2019
@Gargron Gargron deleted the refactor-serialize-payload branch June 4, 2019 21:11
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
rtucker pushed a commit to vulpineclub/mastodon that referenced this pull request Jan 7, 2021
messenjahofchrist pushed a commit to Origin-Creative/mastodon that referenced this pull request Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Improving code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants