{"action":"opened","number":812,"pull_request":{"url":"https://api.github.com/repos/instructure/canvas-lms/pulls/812","id":67632788,"html_url":"https://github.com/instructure/canvas-lms/pull/812","diff_url":"https://github.com/instructure/canvas-lms/pull/812.diff","patch_url":"https://github.com/instructure/canvas-lms/pull/812.patch","issue_url":"https://api.github.com/repos/instructure/canvas-lms/issues/812","number":812,"state":"open","locked":false,"title":"Fix to Assignment LTI application URL","user":{"login":"amulgarg","id":2600726,"avatar_url":"https://avatars.githubusercontent.com/u/2600726?v=3","gravatar_id":"","url":"https://api.github.com/users/amulgarg","html_url":"https://github.com/amulgarg","followers_url":"https://api.github.com/users/amulgarg/followers","following_url":"https://api.github.com/users/amulgarg/following{/other_user}","gists_url":"https://api.github.com/users/amulgarg/gists{/gist_id}","starred_url":"https://api.github.com/users/amulgarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amulgarg/subscriptions","organizations_url":"https://api.github.com/users/amulgarg/orgs","repos_url":"https://api.github.com/users/amulgarg/repos","events_url":"https://api.github.com/users/amulgarg/events{/privacy}","received_events_url":"https://api.github.com/users/amulgarg/received_events","type":"User","site_admin":false},"body":"The matches_url? method should work as - if  match_queries_exactly=true, this method should return true only if the URLs are exactly equal. \r\n\r\nBut suppose you have three apps (on the same domain and host) with URLs - \r\n www.example.com/app1, www.example.com/app2 and www.example.com/app3. What I saw happening is after adding the app3, the first two stopped working because they were trying to reach the URL of the third app. This was happening because in the method matches_url? after checking if the URLs match exactly, it returns true if they indeed match, but proceeds to check for the hostnames if they don't. \r\nThis happened because of the sorting logic for context_tools (app/models/context_external_tool.rb) - \r\n\r\n`sorted_external_tools = all_external_tools.sort_by { |t| [contexts.index { |c| c.id == t.context_id && c.class.name == t.context_type }, t.precedence, t.id == preferred_tool_id ? CanvasSort::First : CanvasSort::Last] }`\r\n\r\nTest plan : \r\n- Add LTI app with a domain D to a course [App1]\r\n- Add another LTI app with same domain to a course [App2]\r\n- Add yet another LTI app with same domain [App3]\r\n- Add these three apps to three assignments [A1,A2,A3]\r\n- Launch all apps from their Assignments (submission set to external tool) [ They should work correctly before my commit as well)\r\n- Remove App3\r\n- Add another LTI app with same domain [App4]\r\n- Add this app to a new assignment [A4]\r\n- Verify if A1,A2,A4 launch the correct apps.","created_at":"2016-04-24T09:46:51Z","updated_at":"2016-04-24T09:46:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/instructure/canvas-lms/pulls/812/commits","review_comments_url":"https://api.github.com/repos/instructure/canvas-lms/pulls/812/comments","review_comment_url":"https://api.github.com/repos/instructure/canvas-lms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/instructure/canvas-lms/issues/812/comments","statuses_url":"https://api.github.com/repos/instructure/canvas-lms/statuses/bd999158d71557b7f6e49b7d5a628442287f75b3","head":{"label":"amulgarg:ltiurlmatch","ref":"ltiurlmatch","sha":"bd999158d71557b7f6e49b7d5a628442287f75b3","user":{"login":"amulgarg","id":2600726,"avatar_url":"https://avatars.githubusercontent.com/u/2600726?v=3","gravatar_id":"","url":"https://api.github.com/users/amulgarg","html_url":"https://github.com/amulgarg","followers_url":"https://api.github.com/users/amulgarg/followers","following_url":"https://api.github.com/users/amulgarg/following{/other_user}","gists_url":"https://api.github.com/users/amulgarg/gists{/gist_id}","starred_url":"https://api.github.com/users/amulgarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amulgarg/subscriptions","organizations_url":"https://api.github.com/users/amulgarg/orgs","repos_url":"https://api.github.com/users/amulgarg/repos","events_url":"https://api.github.com/users/amulgarg/events{/privacy}","received_events_url":"https://api.github.com/users/amulgarg/received_events","type":"User","site_admin":false},"repo":{"id":56964256,"name":"canvas-lms","full_name":"amulgarg/canvas-lms","owner":{"login":"amulgarg","id":2600726,"avatar_url":"https://avatars.githubusercontent.com/u/2600726?v=3","gravatar_id":"","url":"https://api.github.com/users/amulgarg","html_url":"https://github.com/amulgarg","followers_url":"https://api.github.com/users/amulgarg/followers","following_url":"https://api.github.com/users/amulgarg/following{/other_user}","gists_url":"https://api.github.com/users/amulgarg/gists{/gist_id}","starred_url":"https://api.github.com/users/amulgarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amulgarg/subscriptions","organizations_url":"https://api.github.com/users/amulgarg/orgs","repos_url":"https://api.github.com/users/amulgarg/repos","events_url":"https://api.github.com/users/amulgarg/events{/privacy}","received_events_url":"https://api.github.com/users/amulgarg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amulgarg/canvas-lms","description":"The open LMS by Instructure, Inc.","fork":true,"url":"https://api.github.com/repos/amulgarg/canvas-lms","forks_url":"https://api.github.com/repos/amulgarg/canvas-lms/forks","keys_url":"https://api.github.com/repos/amulgarg/canvas-lms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amulgarg/canvas-lms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amulgarg/canvas-lms/teams","hooks_url":"https://api.github.com/repos/amulgarg/canvas-lms/hooks","issue_events_url":"https://api.github.com/repos/amulgarg/canvas-lms/issues/events{/number}","events_url":"https://api.github.com/repos/amulgarg/canvas-lms/events","assignees_url":"https://api.github.com/repos/amulgarg/canvas-lms/assignees{/user}","branches_url":"https://api.github.com/repos/amulgarg/canvas-lms/branches{/branch}","tags_url":"https://api.github.com/repos/amulgarg/canvas-lms/tags","blobs_url":"https://api.github.com/repos/amulgarg/canvas-lms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amulgarg/canvas-lms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amulgarg/canvas-lms/git/refs{/sha}","trees_url":"https://api.github.com/repos/amulgarg/canvas-lms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amulgarg/canvas-lms/statuses/{sha}","languages_url":"https://api.github.com/repos/amulgarg/canvas-lms/languages","stargazers_url":"https://api.github.com/repos/amulgarg/canvas-lms/stargazers","contributors_url":"https://api.github.com/repos/amulgarg/canvas-lms/contributors","subscribers_url":"https://api.github.com/repos/amulgarg/canvas-lms/subscribers","subscription_url":"https://api.github.com/repos/amulgarg/canvas-lms/subscription","commits_url":"https://api.github.com/repos/amulgarg/canvas-lms/commits{/sha}","git_commits_url":"https://api.github.com/repos/amulgarg/canvas-lms/git/commits{/sha}","comments_url":"https://api.github.com/repos/amulgarg/canvas-lms/comments{/number}","issue_comment_url":"https://api.github.com/repos/amulgarg/canvas-lms/issues/comments{/number}","contents_url":"https://api.github.com/repos/amulgarg/canvas-lms/contents/{+path}","compare_url":"https://api.github.com/repos/amulgarg/canvas-lms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amulgarg/canvas-lms/merges","archive_url":"https://api.github.com/repos/amulgarg/canvas-lms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amulgarg/canvas-lms/downloads","issues_url":"https://api.github.com/repos/amulgarg/canvas-lms/issues{/number}","pulls_url":"https://api.github.com/repos/amulgarg/canvas-lms/pulls{/number}","milestones_url":"https://api.github.com/repos/amulgarg/canvas-lms/milestones{/number}","notifications_url":"https://api.github.com/repos/amulgarg/canvas-lms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amulgarg/canvas-lms/labels{/name}","releases_url":"https://api.github.com/repos/amulgarg/canvas-lms/releases{/id}","deployments_url":"https://api.github.com/repos/amulgarg/canvas-lms/deployments","created_at":"2016-04-24T09:39:43Z","updated_at":"2016-04-24T09:40:09Z","pushed_at":"2016-04-24T09:42:33Z","git_url":"git://github.com/amulgarg/canvas-lms.git","ssh_url":"git@github.com:amulgarg/canvas-lms.git","clone_url":"https://github.com/amulgarg/canvas-lms.git","svn_url":"https://github.com/amulgarg/canvas-lms","homepage":"https://github.com/instructure/canvas-lms/wiki","size":238441,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"stable"}},"base":{"label":"instructure:master","ref":"master","sha":"8bd4ade991fa8c4eec763a10d172227c3cc2630d","user":{"login":"instructure","id":515326,"avatar_url":"https://avatars.githubusercontent.com/u/515326?v=3","gravatar_id":"","url":"https://api.github.com/users/instructure","html_url":"https://github.com/instructure","followers_url":"https://api.github.com/users/instructure/followers","following_url":"https://api.github.com/users/instructure/following{/other_user}","gists_url":"https://api.github.com/users/instructure/gists{/gist_id}","starred_url":"https://api.github.com/users/instructure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instructure/subscriptions","organizations_url":"https://api.github.com/users/instructure/orgs","repos_url":"https://api.github.com/users/instructure/repos","events_url":"https://api.github.com/users/instructure/events{/privacy}","received_events_url":"https://api.github.com/users/instructure/received_events","type":"Organization","site_admin":false},"repo":{"id":1314319,"name":"canvas-lms","full_name":"instructure/canvas-lms","owner":{"login":"instructure","id":515326,"avatar_url":"https://avatars.githubusercontent.com/u/515326?v=3","gravatar_id":"","url":"https://api.github.com/users/instructure","html_url":"https://github.com/instructure","followers_url":"https://api.github.com/users/instructure/followers","following_url":"https://api.github.com/users/instructure/following{/other_user}","gists_url":"https://api.github.com/users/instructure/gists{/gist_id}","starred_url":"https://api.github.com/users/instructure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instructure/subscriptions","organizations_url":"https://api.github.com/users/instructure/orgs","repos_url":"https://api.github.com/users/instructure/repos","events_url":"https://api.github.com/users/instructure/events{/privacy}","received_events_url":"https://api.github.com/users/instructure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/instructure/canvas-lms","description":"The open LMS by Instructure, Inc.","fork":false,"url":"https://api.github.com/repos/instructure/canvas-lms","forks_url":"https://api.github.com/repos/instructure/canvas-lms/forks","keys_url":"https://api.github.com/repos/instructure/canvas-lms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/instructure/canvas-lms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/instructure/canvas-lms/teams","hooks_url":"https://api.github.com/repos/instructure/canvas-lms/hooks","issue_events_url":"https://api.github.com/repos/instructure/canvas-lms/issues/events{/number}","events_url":"https://api.github.com/repos/instructure/canvas-lms/events","assignees_url":"https://api.github.com/repos/instructure/canvas-lms/assignees{/user}","branches_url":"https://api.github.com/repos/instructure/canvas-lms/branches{/branch}","tags_url":"https://api.github.com/repos/instructure/canvas-lms/tags","blobs_url":"https://api.github.com/repos/instructure/canvas-lms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/instructure/canvas-lms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/instructure/canvas-lms/git/refs{/sha}","trees_url":"https://api.github.com/repos/instructure/canvas-lms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/instructure/canvas-lms/statuses/{sha}","languages_url":"https://api.github.com/repos/instructure/canvas-lms/languages","stargazers_url":"https://api.github.com/repos/instructure/canvas-lms/stargazers","contributors_url":"https://api.github.com/repos/instructure/canvas-lms/contributors","subscribers_url":"https://api.github.com/repos/instructure/canvas-lms/subscribers","subscription_url":"https://api.github.com/repos/instructure/canvas-lms/subscription","commits_url":"https://api.github.com/repos/instructure/canvas-lms/commits{/sha}","git_commits_url":"https://api.github.com/repos/instructure/canvas-lms/git/commits{/sha}","comments_url":"https://api.github.com/repos/instructure/canvas-lms/comments{/number}","issue_comment_url":"https://api.github.com/repos/instructure/canvas-lms/issues/comments{/number}","contents_url":"https://api.github.com/repos/instructure/canvas-lms/contents/{+path}","compare_url":"https://api.github.com/repos/instructure/canvas-lms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/instructure/canvas-lms/merges","archive_url":"https://api.github.com/repos/instructure/canvas-lms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/instructure/canvas-lms/downloads","issues_url":"https://api.github.com/repos/instructure/canvas-lms/issues{/number}","pulls_url":"https://api.github.com/repos/instructure/canvas-lms/pulls{/number}","milestones_url":"https://api.github.com/repos/instructure/canvas-lms/milestones{/number}","notifications_url":"https://api.github.com/repos/instructure/canvas-lms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/instructure/canvas-lms/labels{/name}","releases_url":"https://api.github.com/repos/instructure/canvas-lms/releases{/id}","deployments_url":"https://api.github.com/repos/instructure/canvas-lms/deployments","created_at":"2011-02-01T00:08:40Z","updated_at":"2016-04-19T08:29:39Z","pushed_at":"2016-04-23T19:53:54Z","git_url":"git://github.com/instructure/canvas-lms.git","ssh_url":"git@github.com:instructure/canvas-lms.git","clone_url":"https://github.com/instructure/canvas-lms.git","svn_url":"https://github.com/instructure/canvas-lms","homepage":"https://github.com/instructure/canvas-lms/wiki","size":369376,"stargazers_count":1695,"watchers_count":1695,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":733,"mirror_url":null,"open_issues_count":99,"forks":733,"open_issues":99,"watchers":1695,"default_branch":"stable"}},"_links":{"self":{"href":"https://api.github.com/repos/instructure/canvas-lms/pulls/812"},"html":{"href":"https://github.com/instructure/canvas-lms/pull/812"},"issue":{"href":"https://api.github.com/repos/instructure/canvas-lms/issues/812"},"comments":{"href":"https://api.github.com/repos/instructure/canvas-lms/issues/812/comments"},"review_comments":{"href":"https://api.github.com/repos/instructure/canvas-lms/pulls/812/comments"},"review_comment":{"href":"https://api.github.com/repos/instructure/canvas-lms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/instructure/canvas-lms/pulls/812/commits"},"statuses":{"href":"https://api.github.com/repos/instructure/canvas-lms/statuses/bd999158d71557b7f6e49b7d5a628442287f75b3"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":5,"deletions":1,"changed_files":1}}