Skip to content

Refactor `CommonAPI.post/2`

minibikini requested to merge minibikini/pleroma:refactor/common_api into develop

I was investigating the possibility to implement status editing. So I was thinking about how to adapt CommonAPI.post/2 for updates, and it seems very hard to change.

I figured maybe turn it into something ecto-like so it'd allow composing new posts as well as post updates, possibly with different types. What do you think?

Changes

  • Move the logic from CommonAPI.post/2 to CommonAPI.ActivityDraft (not sure if it's a good name)
  • Split the logic to multiple pipeable functions
  • Refactor CommonAPI.Utils.make_poll_data/1. Before validations were rising exceptions inside try/rescue, this MR replaces that with with statement.
  • Cleanup CommonAPI

Merge request reports