docs: update the T&C resolver comment

This commit is contained in:
André Sá 2022-04-29 16:25:45 +01:00
parent c402c9a204
commit 99b73da2b1

View file

@ -240,9 +240,18 @@ const massageTerms = terms => (terms.active && terms.text) ? ({
* Just (Just hash, Nothing) => Nothing
* May happen (after `massageTerms`) if T&C are disabled.
*
* Just (Just hash, Just tc) => Just (hash, Just tc) or Just (hash, Nothing)
* `tc` is sent depending on whether the `hash` differs from `currentHash` or
* not.
* Just (Just hash, Just tc) => Just (hash, Nothing, Nothing)
* If both the `hash` and the `configVersion` are the same as `currentHash`
* and `currentConfigVersion`, respectively, then there's no need to send
* `text` nor `details`.
*
* Just (Just hash, Just tc) => Just (hash, Nothing, Just details)
* If `configVersion` differs from `currentConfigVersion` but the `hash` is
* the same, then only the details have to be updated.
*
* Just (Just hash, Just tc) => Just (hash, Just text, Just details)
* If the `hash` differs from `currentHash` then everything is resent (to
* simplify machine implementation).
*/
const terms = (parent, { currentConfigVersion, currentHash }, { deviceId, settings }, info) => {
const isNone = x => _.isNil(x) || _.isEmpty(x)