This is much easier and safer than "guessing" the class name based on
the validator name. That can cause a problem when another class with the
same name is found. The "guessing" was only added because we used
OpenStruct in the tests, but we shouldn't change the code only to make
tests run. I changed the tests to use the real entities, with
auto-validation disabled in the constructor, so we can test the
validator manually.
Sometimes messages contain characters that are invalid for XML, but they
are filteres out before creating the XML, otherwise the property would
be empty in the XML.
But for relayables the value is also used for creating the signatures,
so we need to filter the invalid characters earlier, before calculating
the signature.
The limit was added in 2012 to prevent spam, but since the participants
need to be a mutual contact with the author nowadays, I don't think it's
a spam problem anymore.
I also added a validation for the minimum count of the participants,
because a conversion without participants doesn't make much sense.
This module can be used to compute account migration signature in other
objects besides Entities::AccountMigration. For instance this is to be
used in AccountMigration model of diaspora* web application.
This was a problem with dislikes.
It's safe to use `to_s` here, because we have only strings, numbers and
booleans here anyway, because relayables don't support nested entities.
`to_s` is used to generate the `signature_data` string too.
The diaspora ID validator now is not nil by default.
Also:
* mark root_author as optional for reshares.
* make author for profiles mandatory (I don't remember why this was
optional, we never generate a profile without author and we wouldn't
receive a profile without author anyway, because we validate that the
author is the sender).
* refactor validator specs for diaspora IDs
Also don't extend from Post module anymore to represent the future state
of a reshare as it's own type only used to increase the reach of a post.
See #83
Let's change that to the new rubocop default, which is also the
suggestion in the ruby style guide.
See https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
This was changed in diaspora too, see diaspora/diaspora#7466
It also includes the changes in the code. This was done with
`rubocop --auto-correct` and no we have zero offenses again.