{"action":"opened","number":2937,"pull_request":{"url":"https://api.github.com/repos/wireapp/wire-ios/pulls/2937","id":232239117,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyMjM5MTE3","html_url":"https://github.com/wireapp/wire-ios/pull/2937","diff_url":"https://github.com/wireapp/wire-ios/pull/2937.diff","patch_url":"https://github.com/wireapp/wire-ios/pull/2937.patch","issue_url":"https://api.github.com/repos/wireapp/wire-ios/issues/2937","number":2937,"state":"open","locked":false,"title":"Fix: Emoji substition is not work when it is at the tail","user":{"login":"billypchan","id":11852044,"node_id":"MDQ6VXNlcjExODUyMDQ0","avatar_url":"https://avatars3.githubusercontent.com/u/11852044?v=4","gravatar_id":"","url":"https://api.github.com/users/billypchan","html_url":"https://github.com/billypchan","followers_url":"https://api.github.com/users/billypchan/followers","following_url":"https://api.github.com/users/billypchan/following{/other_user}","gists_url":"https://api.github.com/users/billypchan/gists{/gist_id}","starred_url":"https://api.github.com/users/billypchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billypchan/subscriptions","organizations_url":"https://api.github.com/users/billypchan/orgs","repos_url":"https://api.github.com/users/billypchan/repos","events_url":"https://api.github.com/users/billypchan/events{/privacy}","received_events_url":"https://api.github.com/users/billypchan/received_events","type":"User","site_admin":false},"body":"## What's new in this PR?\r\n\r\nThis PR is a rework of https://github.com/wireapp/wire-ios/pull/2840\r\n\r\n### Issues\r\n\r\nThe message with emoticon string at the end is not replaced.\r\n\r\n### Causes\r\n\r\nIn https://github.com/wireapp/wire-ios/pull/2840 I mixed up the ClosedRange and Range and change the length of NSRange cause this new issue.\r\n\r\n### Solutions\r\n\r\nThe real reason of https://github.com/wireapp/wire-ios/pull/2840 and this is the length of the string is shortened after each range is replaced. e.g.:\r\n\r\n\r\nThe original message string is:\r\n```\r\n\"<3 Lorem @Ipsum Dolor }:-)Ame:) :)\"\r\n```\r\nThe @Ipsum is a mentioned name, it is excluded in the emoji substitution.\r\n\r\nThe original logic starts substitution from the beginning:\r\n\r\n```\r\n\"❤ Lorem @Ipsum Dolor }:-)Ame:) :)\"\r\n```\r\n\r\nThe length of the string is shortened by one and the range of the mentioned name is no longer valid. It may access the element out of the string's length.\r\n\r\nThe solution is reverse the replacement order and start from the end of the string.\r\n\r\n\r\n## Notes\r\n\r\n- [ ] revise the emoticon substition and check how other platfrom works\r\n- [ ] move emoticon substition code to Utilities to save building and testing time\r\n- [ ] We have 2 tests using OCMock, should we retire it?\r\n\r\n\r\n\r\n","created_at":"2018-11-20T09:06:48Z","updated_at":"2018-11-20T09:06:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wireapp/wire-ios/pulls/2937/commits","review_comments_url":"https://api.github.com/repos/wireapp/wire-ios/pulls/2937/comments","review_comment_url":"https://api.github.com/repos/wireapp/wire-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wireapp/wire-ios/issues/2937/comments","statuses_url":"https://api.github.com/repos/wireapp/wire-ios/statuses/dd01049369d154ab8afa8bddb36c5d5555160f9a","head":{"label":"wireapp:fix/ZIOS-10893-Emoji-substition-is-not-work-","ref":"fix/ZIOS-10893-Emoji-substition-is-not-work-","sha":"dd01049369d154ab8afa8bddb36c5d5555160f9a","user":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"repo":{"id":63855049,"node_id":"MDEwOlJlcG9zaXRvcnk2Mzg1NTA0OQ==","name":"wire-ios","full_name":"wireapp/wire-ios","private":false,"owner":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/wireapp/wire-ios","description":"📱 Wire for iOS (iPhone and iPad)","fork":false,"url":"https://api.github.com/repos/wireapp/wire-ios","forks_url":"https://api.github.com/repos/wireapp/wire-ios/forks","keys_url":"https://api.github.com/repos/wireapp/wire-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wireapp/wire-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wireapp/wire-ios/teams","hooks_url":"https://api.github.com/repos/wireapp/wire-ios/hooks","issue_events_url":"https://api.github.com/repos/wireapp/wire-ios/issues/events{/number}","events_url":"https://api.github.com/repos/wireapp/wire-ios/events","assignees_url":"https://api.github.com/repos/wireapp/wire-ios/assignees{/user}","branches_url":"https://api.github.com/repos/wireapp/wire-ios/branches{/branch}","tags_url":"https://api.github.com/repos/wireapp/wire-ios/tags","blobs_url":"https://api.github.com/repos/wireapp/wire-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wireapp/wire-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wireapp/wire-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/wireapp/wire-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wireapp/wire-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/wireapp/wire-ios/languages","stargazers_url":"https://api.github.com/repos/wireapp/wire-ios/stargazers","contributors_url":"https://api.github.com/repos/wireapp/wire-ios/contributors","subscribers_url":"https://api.github.com/repos/wireapp/wire-ios/subscribers","subscription_url":"https://api.github.com/repos/wireapp/wire-ios/subscription","commits_url":"https://api.github.com/repos/wireapp/wire-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/wireapp/wire-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/wireapp/wire-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/wireapp/wire-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/wireapp/wire-ios/contents/{+path}","compare_url":"https://api.github.com/repos/wireapp/wire-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wireapp/wire-ios/merges","archive_url":"https://api.github.com/repos/wireapp/wire-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wireapp/wire-ios/downloads","issues_url":"https://api.github.com/repos/wireapp/wire-ios/issues{/number}","pulls_url":"https://api.github.com/repos/wireapp/wire-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/wireapp/wire-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/wireapp/wire-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wireapp/wire-ios/labels{/name}","releases_url":"https://api.github.com/repos/wireapp/wire-ios/releases{/id}","deployments_url":"https://api.github.com/repos/wireapp/wire-ios/deployments","created_at":"2016-07-21T09:16:34Z","updated_at":"2018-11-19T16:36:27Z","pushed_at":"2018-11-19T20:29:57Z","git_url":"git://github.com/wireapp/wire-ios.git","ssh_url":"git@github.com:wireapp/wire-ios.git","clone_url":"https://github.com/wireapp/wire-ios.git","svn_url":"https://github.com/wireapp/wire-ios","homepage":"https://wire.com/download/","size":370424,"stargazers_count":2536,"watchers_count":2536,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":422,"mirror_url":null,"archived":false,"open_issues_count":129,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":422,"open_issues":129,"watchers":2536,"default_branch":"develop"}},"base":{"label":"wireapp:develop","ref":"develop","sha":"b134711018087d81f61268c788a5b631d2e6b106","user":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"repo":{"id":63855049,"node_id":"MDEwOlJlcG9zaXRvcnk2Mzg1NTA0OQ==","name":"wire-ios","full_name":"wireapp/wire-ios","private":false,"owner":{"login":"wireapp","id":16047324,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDQ3MzI0","avatar_url":"https://avatars3.githubusercontent.com/u/16047324?v=4","gravatar_id":"","url":"https://api.github.com/users/wireapp","html_url":"https://github.com/wireapp","followers_url":"https://api.github.com/users/wireapp/followers","following_url":"https://api.github.com/users/wireapp/following{/other_user}","gists_url":"https://api.github.com/users/wireapp/gists{/gist_id}","starred_url":"https://api.github.com/users/wireapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wireapp/subscriptions","organizations_url":"https://api.github.com/users/wireapp/orgs","repos_url":"https://api.github.com/users/wireapp/repos","events_url":"https://api.github.com/users/wireapp/events{/privacy}","received_events_url":"https://api.github.com/users/wireapp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/wireapp/wire-ios","description":"📱 Wire for iOS (iPhone and iPad)","fork":false,"url":"https://api.github.com/repos/wireapp/wire-ios","forks_url":"https://api.github.com/repos/wireapp/wire-ios/forks","keys_url":"https://api.github.com/repos/wireapp/wire-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wireapp/wire-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wireapp/wire-ios/teams","hooks_url":"https://api.github.com/repos/wireapp/wire-ios/hooks","issue_events_url":"https://api.github.com/repos/wireapp/wire-ios/issues/events{/number}","events_url":"https://api.github.com/repos/wireapp/wire-ios/events","assignees_url":"https://api.github.com/repos/wireapp/wire-ios/assignees{/user}","branches_url":"https://api.github.com/repos/wireapp/wire-ios/branches{/branch}","tags_url":"https://api.github.com/repos/wireapp/wire-ios/tags","blobs_url":"https://api.github.com/repos/wireapp/wire-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wireapp/wire-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wireapp/wire-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/wireapp/wire-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wireapp/wire-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/wireapp/wire-ios/languages","stargazers_url":"https://api.github.com/repos/wireapp/wire-ios/stargazers","contributors_url":"https://api.github.com/repos/wireapp/wire-ios/contributors","subscribers_url":"https://api.github.com/repos/wireapp/wire-ios/subscribers","subscription_url":"https://api.github.com/repos/wireapp/wire-ios/subscription","commits_url":"https://api.github.com/repos/wireapp/wire-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/wireapp/wire-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/wireapp/wire-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/wireapp/wire-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/wireapp/wire-ios/contents/{+path}","compare_url":"https://api.github.com/repos/wireapp/wire-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wireapp/wire-ios/merges","archive_url":"https://api.github.com/repos/wireapp/wire-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wireapp/wire-ios/downloads","issues_url":"https://api.github.com/repos/wireapp/wire-ios/issues{/number}","pulls_url":"https://api.github.com/repos/wireapp/wire-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/wireapp/wire-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/wireapp/wire-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wireapp/wire-ios/labels{/name}","releases_url":"https://api.github.com/repos/wireapp/wire-ios/releases{/id}","deployments_url":"https://api.github.com/repos/wireapp/wire-ios/deployments","created_at":"2016-07-21T09:16:34Z","updated_at":"2018-11-19T16:36:27Z","pushed_at":"2018-11-19T20:29:57Z","git_url":"git://github.com/wireapp/wire-ios.git","ssh_url":"git@github.com:wireapp/wire-ios.git","clone_url":"https://github.com/wireapp/wire-ios.git","svn_url":"https://github.com/wireapp/wire-ios","homepage":"https://wire.com/download/","size":370424,"stargazers_count":2536,"watchers_count":2536,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":422,"mirror_url":null,"archived":false,"open_issues_count":129,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":422,"open_issues":129,"watchers":2536,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/wireapp/wire-ios/pulls/2937"},"html":{"href":"https://github.com/wireapp/wire-ios/pull/2937"},"issue":{"href":"https://api.github.com/repos/wireapp/wire-ios/issues/2937"},"comments":{"href":"https://api.github.com/repos/wireapp/wire-ios/issues/2937/comments"},"review_comments":{"href":"https://api.github.com/repos/wireapp/wire-ios/pulls/2937/comments"},"review_comment":{"href":"https://api.github.com/repos/wireapp/wire-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wireapp/wire-ios/pulls/2937/commits"},"statuses":{"href":"https://api.github.com/repos/wireapp/wire-ios/statuses/dd01049369d154ab8afa8bddb36c5d5555160f9a"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":4,"additions":41,"deletions":7,"changed_files":3}}
{"actor":{"display_login":"billypchan"}}