mirror of https://github.com/zulip/zulip.git
58b72a2194
This is code simplification motivated by a recent bug that we fixed with some server changes, but which was really caused in some sense by our client code using an overly finicky condition to check falsiness. For cross-realm bots, the value of `user.bot_owner_id` may be `null`, or it may simply be `undefined`, depending on whether the server passes `None` or simply omits the field. We don't want out client code to be coupled to that rather arbitrary decision. We were doing a `!== null` check instead of checking for falsiness, which led to blueslip errors in the past. Because a bot owner id could be plausibly 0, a falsiness check would be brittle in a different way. Now we avoid that ugliness by calling `get_bot_owner_user`, which either returns an object or `undefined`. And then the caller can just do a concise check for whether `bot_owner` exists. And we also fix up the crufty code that was putting `bot_owner_full_name` on to the object instead of using a local. We have a bug report for this again, although it might be on an old branch. Fixes #13621. |
||
---|---|---|
.. | ||
casper_lib | ||
casper_tests | ||
node_tests | ||
zjsunit | ||
.eslintrc.json | ||
run-casper |