Change the moment job state objects are created
Change the moment job state objects are created

This fixes an error that I think is caused by the recent upgrade to
Rails 5.2.

The User class has two has_one associations with OpmlImportJobState and
OpmlExportJobState, representing the state of the last OPML import and
export job run by the user. These two objects should always be present
for each user through the associations, even if the user has never run
an OPML import or export job (in this case the associated object will
have its "state" attribute set to "NONE".

Until recently, these object were created if necessary (which only
happened when creating a new user) in the before_save callback method of
the User class. However with Rails 5.2 this fails with a "You cannot
call create unless the parent is saved" error; it seems that for a just
created user, during the before_save callback the user itself is not yet
saved in the database (as expected) and trying to call create_xxx (where
xxx is an associated object) fails with the above error, because the
parent must be saved first.

Not sure why this worked before, frankly.

A possible fix would be to call build_xxx instead of create_xxx in the
same place, and then either leverage ActiveRecord autosaving (which is
too magical and hard to debug for my taste) or manually save the
associated objects.

Instead I've just moved the create_xxx calls from the before_save
callback to the after_save callback method of the User class. This way
create_xxx is invoked on an already saved User instance.

This would break if User had a validation that made sure that
opml_export_job_state and opml_import_job_state are present, but it
currently doesn't. Will have to look further into this in the future.

amatriain/feedbunch,amatriain/feedbunch,amatriain/feedbunch,amatriain/feedbunch