Simplify updating user's `info`
User.change_info/2
and User.update_info/2
Add Before this MR:
def unblock(blocker, %{ap_id: ap_id}) do
info_cng =
blocker.info
|> User.Info.remove_from_block(ap_id)
cng =
change(blocker)
|> put_embed(:info, info_cng)
update_and_set_cache(cng)
end
After this MR:
def unblock(blocker, %{ap_id: ap_id}) do
update_info(blocker, &User.Info.remove_from_block(&1, ap_id))
end
Other changes
- Do not return tuple when unneeded. Some functions (such as
User.get_friends/1
) were always returning a success tuple ({:ok, _}
) which complicates the code and confusing. - Cleanup
Pleroma.User
Edited by minibikini