API not returning suspended fields properly

I reviewed the code and it turns out suspended? is simply defined as suspended_till && suspended_till > DateTime.now.

A user could be returned as not suspended if the period of time simply expired. suspnded_at in that case would still have a value because they were suspended then. I don’t think this is strictly a bug, as suspended would still be correct.

I did make two changes to make the API less confusing though:

  1. suspended will always be true or false, you don’t have to worry about null anymore.
  2. suspended_at and suspended_till will not be returned unless suspended is true. This shrinks our JSON payload which is nice.
7 إعجابات