{"action":"created","issue":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3828","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3828/labels{/name}","comments_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3828/comments","events_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3828/events","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3828","id":97529449,"number":3828,"title":"Fix profile page initials error for strange names","user":{"login":"abought","id":2957073,"avatar_url":"https://avatars.githubusercontent.com/u/2957073?v=3","gravatar_id":"","url":"https://api.github.com/users/abought","html_url":"https://github.com/abought","followers_url":"https://api.github.com/users/abought/followers","following_url":"https://api.github.com/users/abought/following{/other_user}","gists_url":"https://api.github.com/users/abought/gists{/gist_id}","starred_url":"https://api.github.com/users/abought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abought/subscriptions","organizations_url":"https://api.github.com/users/abought/orgs","repos_url":"https://api.github.com/users/abought/repos","events_url":"https://api.github.com/users/abought/events{/privacy}","received_events_url":"https://api.github.com/users/abought/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones/43","html_url":"https://github.com/CenterForOpenScience/osf.io/milestones/0.44.0","labels_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/milestones/43/labels","id":1207311,"number":43,"title":"0.44.0","description":"","creator":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":19,"state":"open","created_at":"2015-07-14T16:07:10Z","updated_at":"2015-07-27T19:10:47Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-07-27T18:49:05Z","updated_at":"2015-07-27T19:18:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/pulls/3828","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3828","diff_url":"https://github.com/CenterForOpenScience/osf.io/pull/3828.diff","patch_url":"https://github.com/CenterForOpenScience/osf.io/pull/3828.patch"},"body":"Tied to #2933 / #3635 .\r\n\r\n## Purpose\r\nFix a front-end error that occurs when entering a middle name with two consecutive spaces. (edge case, but was hindering some other QA work on that page)\r\n\r\n## Summary of changes\r\n- Only calculate initials from non-empty parts of a tokenized string.\r\n- Add regression test to ensure function works as intended.\r\n\r\n## Side effects\r\n- Exposes the `initials` function in NameViewModel to allow for unit testing. Updates calls to this function to avoid breaking existing functionality."},"comment":{"url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/comments/125313250","html_url":"https://github.com/CenterForOpenScience/osf.io/pull/3828#issuecomment-125313250","issue_url":"https://api.github.com/repos/CenterForOpenScience/osf.io/issues/3828","id":125313250,"user":{"login":"abought","id":2957073,"avatar_url":"https://avatars.githubusercontent.com/u/2957073?v=3","gravatar_id":"","url":"https://api.github.com/users/abought","html_url":"https://github.com/abought","followers_url":"https://api.github.com/users/abought/followers","following_url":"https://api.github.com/users/abought/following{/other_user}","gists_url":"https://api.github.com/users/abought/gists{/gist_id}","starred_url":"https://api.github.com/users/abought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abought/subscriptions","organizations_url":"https://api.github.com/users/abought/orgs","repos_url":"https://api.github.com/users/abought/repos","events_url":"https://api.github.com/users/abought/events{/privacy}","received_events_url":"https://api.github.com/users/abought/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T19:18:45Z","updated_at":"2015-07-27T19:18:45Z","body":"> A more concise, general solution would be to split on any number of whitespace characters:\r\n\r\nIdeally, yes. That assumes that $.trim() is called before `initials`, as otherwise trailing spaces would be output as empty tokens. How about this?\r\n\r\n```javascript\r\n    var initials = function(names) {\r\n        names = $.trim(names);\r\n\r\n        return names\r\n            .split(/\\s+/)\r\n            .map(function(name) {\r\n                return name[0].toUpperCase() + '.';\r\n            })\r\n            .filter(function(initial) {\r\n                return initial.match(/^[a-z]/i);\r\n            }).join(' ');\r\n    };\r\n```"}}