# API not returning suspended fields properly

**URL:** https://meta.discourse.org/t/api-not-returning-suspended-fields-properly/71850
**Category:** Bug
**Created:** [10월 11, 2017, 3:30오후 UTC](https://meta.discourse.org/t/api-not-returning-suspended-fields-properly/71850 "2017-10-11T15:30:09Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [10월 13, 2017, 4:19오후 UTC](https://meta.discourse.org/t/api-not-returning-suspended-fields-properly/71850/6 "2017-10-13T16:19:54Z")

</div>

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.

> <https://github.com/discourse/discourse/commit/f73a3cc0d4b9d7e8c1fbf2a4309397074ce4ec02>

---

_[View the full topic](https://meta.discourse.org/t/api-not-returning-suspended-fields-properly/71850)._
