{"action":"created","issue":{"url":"https://api.github.com/repos/kgsHtml/kgs-html-issues/issues/1","labels_url":"https://api.github.com/repos/kgsHtml/kgs-html-issues/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/kgsHtml/kgs-html-issues/issues/1/comments","events_url":"https://api.github.com/repos/kgsHtml/kgs-html-issues/issues/1/events","html_url":"https://github.com/kgsHtml/kgs-html-issues/issues/1","id":53238911,"number":1,"title":"Properly handle null user in chats","user":{"login":"wshubert","id":10369481,"avatar_url":"https://avatars.githubusercontent.com/u/10369481?v=3","gravatar_id":"","url":"https://api.github.com/users/wshubert","html_url":"https://github.com/wshubert","followers_url":"https://api.github.com/users/wshubert/followers","following_url":"https://api.github.com/users/wshubert/following{/other_user}","gists_url":"https://api.github.com/users/wshubert/gists{/gist_id}","starred_url":"https://api.github.com/users/wshubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wshubert/subscriptions","organizations_url":"https://api.github.com/users/wshubert/orgs","repos_url":"https://api.github.com/users/wshubert/repos","events_url":"https://api.github.com/users/wshubert/events{/privacy}","received_events_url":"https://api.github.com/users/wshubert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-01-02T06:07:35Z","updated_at":"2015-01-03T06:37:42Z","closed_at":null,"body":"The channel_addChat() function takes, as its third argument, the user who sent the chat. That will be null for global admin announcements. We need to handle that situation properly."},"comment":{"url":"https://api.github.com/repos/kgsHtml/kgs-html-issues/issues/comments/68585501","html_url":"https://github.com/kgsHtml/kgs-html-issues/issues/1#issuecomment-68585501","issue_url":"https://api.github.com/repos/kgsHtml/kgs-html-issues/issues/1","id":68585501,"user":{"login":"wshubert","id":10369481,"avatar_url":"https://avatars.githubusercontent.com/u/10369481?v=3","gravatar_id":"","url":"https://api.github.com/users/wshubert","html_url":"https://github.com/wshubert","followers_url":"https://api.github.com/users/wshubert/followers","following_url":"https://api.github.com/users/wshubert/following{/other_user}","gists_url":"https://api.github.com/users/wshubert/gists{/gist_id}","starred_url":"https://api.github.com/users/wshubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wshubert/subscriptions","organizations_url":"https://api.github.com/users/wshubert/orgs","repos_url":"https://api.github.com/users/wshubert/repos","events_url":"https://api.github.com/users/wshubert/events{/privacy}","received_events_url":"https://api.github.com/users/wshubert/received_events","type":"User","site_admin":false},"created_at":"2015-01-03T06:37:42Z","updated_at":"2015-01-03T06:37:42Z","body":"H'mm, I think what I would do would be:\r\n\r\nchanNode = registry.byId(\"mainTabs_tablist_chan-\" + id);\r\nif (chanNode === undefined) {\r\n    log \"Hey can't find channel \" + id;\r\n} else {\r\n   domStyle.set(chanNode.domNode, \"font-weight\", \"bold\");\r\n}\r\n\r\nI'm pretty sure (and the web seems to back me up...) that \"x === undefined\"\r\nis a nice way to test for undefined, and this means we won't look up the\r\nchannel twice.\r\n\r\nOn Sat, Jan 3, 2015 at 1:27 AM, Joshua Simmons <notifications@github.com>\r\nwrote:\r\n\r\n> I think this might be a slightly better fix, stylistically. != null was a\r\n> bit off, because it was only working because of JS's weird coersion rules\r\n> in == and !=, the actual value is undefined\r\n>\r\n> Not 100% sure this is better, but pretty sure.\r\n>\r\n> diff --git a/dojoClient/js/Kgs.js b/dojoClient/js/Kgs.js\r\n> index ad65d6a..71a41d6 100644\r\n> --- a/dojoClient/js/Kgs.js\r\n> +++ b/dojoClient/js/Kgs.js\r\n> @@ -286,8 +286,10 @@ define([\r\n>      }\r\n>      if (registry.byId(\"mainTabs\").selectedChildWidget != registry.byId(\"chan-\" + id)) {\r\n>        // Chat in a hidden pane! Make the title bold.\r\n> -      domStyle.set(registry.byId(\"mainTabs_tablist_chan-\" + id).domNode,\r\n> -                   \"font-weight\", \"bold\");\r\n> +      if (typeof registry.byId(\"mainTabs_tablist_chan-\" + id) !== \"undefined\") {\r\n> +        domStyle.set(registry.byId(\"mainTabs_tablist_chan-\" + id).domNode,\r\n> +                    \"font-weight\", \"bold\");\r\n> +      }\r\n>      }\r\n>    };\r\n>\r\n> —\r\n> Reply to this email directly or view it on GitHub\r\n> <https://github.com/kgsHtml/kgs-html-issues/issues/1#issuecomment-68585279>\r\n> .\r\n>"}}