{"action":"created","comment":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/34611996","id":34611996,"diff_hunk":"@@ -856,12 +860,119 @@ define(function (require, exports) {\n     beforeStartup.writes = [locks.JS_DOC];\n \n     /**\n-     * Initialize the inactive documents. (The active document is initialized beforeStartup.)\n+     * Send info to search store about searching for documents and\n+     * initialize the inactive documents. (The active document is initialized beforeStartup.)\n      *\n      * @param {{currentIndex: number, docCount: number}=} payload\n      * @return {Promise}\n      */\n     var afterStartup = function (payload) {\n+        var appStore = this.flux.store(\"application\"),\n+            docStore = this.flux.store(\"document\");\n+\n+        /**\n+         * Make list of currently open documents to be used as search options\n+         * \n+         * @return {Immutable.List.<object>}\n+        */\n+        var currDocSearchOptions = function () {\n+            var document = appStore.getCurrentDocument(),\n+                openDocs = appStore.getOpenDocumentIDs().filterNot(function (doc) {\n+                                return doc === document.id;\n+                            }),\n+                docMap = openDocs.map(function (doc) {\n+                    return {\n+                        id: \"curr-doc_\" + doc.toString(),\n+                        title: docStore.getDocument(doc).name,\n+                        type: \"item\",\n+                        category: [strings.SEARCH.CATEGORIES.DOCUMENT, strings.SEARCH.CATEGORIES.CURRENT]\n+                    };\n+                }),\n+                docLabel = {\n+                    id: \"curr-doc_header\",\n+                    title: strings.SEARCH.HEADERS.CURRENT_DOC,\n+                    type: \"header\"\n+                },\n+\n+                docOptions = docMap.unshift(docLabel);\n+\n+            return docOptions;\n+        };\n+\n+\n+        /**\n+         * Make list of recent documents to be used as search options\n+         * \n+         * @return {Immutable.List.<object>}\n+        */\n+        var recentDocSearchOptions = function () {\n+            var recentFiles = appStore.getRecentFiles(),\n+                recentDocMap = recentFiles.map(function (doc, index) {\n+                    return {\n+                        id: \"recent-doc_\" + index.toString(),\n+                        title: pathUtil.getShortestUniquePaths(Immutable.List.of(doc)).toJS()[0],\n+                        type: \"item\",\n+                        info: doc,\n+                        displayInfo: doc,\n+                        category: [strings.SEARCH.CATEGORIES.DOCUMENT, strings.SEARCH.CATEGORIES.RECENT]\n+                    };\n+                });\n+            \n+            // Get shortest unique file path\n+            var paths = collection.pluck(recentDocMap, \"info\"),\n+                shortenedPaths = pathUtil.getShortestUniquePaths(paths).toJS();\n+\n+            recentDocMap.forEach(function (docItem, index) {\n+                docItem.displayInfo = shortenedPaths[index];\n+            });\n+\n+            var recentDocLabel = {\n+                id: \"recent-doc_header\",\n+                title: strings.SEARCH.HEADERS.RECENT_DOC,\n+                type: \"header\"\n+            };\n+\n+            return recentDocMap.unshift(recentDocLabel);\n+        };\n+\n+        var getDocumentSearchOptions = function () {\n+            return recentDocSearchOptions().concat(currDocSearchOptions());\n+        };\n+\n+        var confirmSearch = function (itemID) {\n+            // ID has type as first word, followed by the layer/document ID\n+            var idArray = itemID.split(\"_\"),","path":"src/js/actions/documents.js","position":107,"original_position":107,"commit_id":"17f6e6526129e5e57777938053f650e6117258f2","original_commit_id":"17f6e6526129e5e57777938053f650e6117258f2","user":{"login":"volfied","id":386714,"avatar_url":"https://avatars.githubusercontent.com/u/386714?v=3","gravatar_id":"","url":"https://api.github.com/users/volfied","html_url":"https://github.com/volfied","followers_url":"https://api.github.com/users/volfied/followers","following_url":"https://api.github.com/users/volfied/following{/other_user}","gists_url":"https://api.github.com/users/volfied/gists{/gist_id}","starred_url":"https://api.github.com/users/volfied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/volfied/subscriptions","organizations_url":"https://api.github.com/users/volfied/orgs","repos_url":"https://api.github.com/users/volfied/repos","events_url":"https://api.github.com/users/volfied/events{/privacy}","received_events_url":"https://api.github.com/users/volfied/received_events","type":"User","site_admin":false},"body":"I really like this logic of returning false if it's not being handled. But, I think it would be better if the id=>handleExecute mapping is taken care of by the store, so it can just pass by the actual 'idInt' in here where all you'd need to do is call the handling function. ","created_at":"2015-07-14T19:57:50Z","updated_at":"2015-07-14T19:57:50Z","html_url":"https://github.com/adobe-photoshop/spaces-design/pull/1702#discussion_r34611996","pull_request_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702","_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/34611996"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/1702#discussion_r34611996"},"pull_request":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702"}}},"pull_request":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702","id":39625917,"html_url":"https://github.com/adobe-photoshop/spaces-design/pull/1702","diff_url":"https://github.com/adobe-photoshop/spaces-design/pull/1702.diff","patch_url":"https://github.com/adobe-photoshop/spaces-design/pull/1702.patch","issue_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/1702","number":1702,"state":"open","locked":false,"title":"Refactor SearchBar component","user":{"login":"hamburge","id":12618145,"avatar_url":"https://avatars.githubusercontent.com/u/12618145?v=3","gravatar_id":"","url":"https://api.github.com/users/hamburge","html_url":"https://github.com/hamburge","followers_url":"https://api.github.com/users/hamburge/followers","following_url":"https://api.github.com/users/hamburge/following{/other_user}","gists_url":"https://api.github.com/users/hamburge/gists{/gist_id}","starred_url":"https://api.github.com/users/hamburge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamburge/subscriptions","organizations_url":"https://api.github.com/users/hamburge/orgs","repos_url":"https://api.github.com/users/hamburge/repos","events_url":"https://api.github.com/users/hamburge/events{/privacy}","received_events_url":"https://api.github.com/users/hamburge/received_events","type":"User","site_admin":false},"body":"Now we can search for ~\\*~\\*anything\\*~\\*~","created_at":"2015-07-09T20:40:38Z","updated_at":"2015-07-14T19:57:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2783163e00a282e2a7fbe6961c742b2ec50638d","assignee":{"login":"hamburge","id":12618145,"avatar_url":"https://avatars.githubusercontent.com/u/12618145?v=3","gravatar_id":"","url":"https://api.github.com/users/hamburge","html_url":"https://github.com/hamburge","followers_url":"https://api.github.com/users/hamburge/followers","following_url":"https://api.github.com/users/hamburge/following{/other_user}","gists_url":"https://api.github.com/users/hamburge/gists{/gist_id}","starred_url":"https://api.github.com/users/hamburge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamburge/subscriptions","organizations_url":"https://api.github.com/users/hamburge/orgs","repos_url":"https://api.github.com/users/hamburge/repos","events_url":"https://api.github.com/users/hamburge/events{/privacy}","received_events_url":"https://api.github.com/users/hamburge/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702/commits","review_comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702/comments","review_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/1702/comments","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/17f6e6526129e5e57777938053f650e6117258f2","head":{"label":"adobe-photoshop:allison/search_module","ref":"allison/search_module","sha":"17f6e6526129e5e57777938053f650e6117258f2","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-07-12T20:12:11Z","pushed_at":"2015-07-14T19:41:18Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":14013,"stargazers_count":577,"watchers_count":577,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":143,"forks":38,"open_issues":143,"watchers":577,"default_branch":"master"}},"base":{"label":"adobe-photoshop:master","ref":"master","sha":"8cddeecda818464b736a12a0e5f77ddb1743890e","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-07-12T20:12:11Z","pushed_at":"2015-07-14T19:41:18Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":14013,"stargazers_count":577,"watchers_count":577,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":143,"forks":38,"open_issues":143,"watchers":577,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/1702"},"issue":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/1702"},"comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/1702/comments"},"review_comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702/comments"},"review_comment":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/1702/commits"},"statuses":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/17f6e6526129e5e57777938053f650e6117258f2"}}}}