From 9fc0a7ac4f657978f77aae0cff40a7d14be6bead Mon Sep 17 00:00:00 2001 From: Ammiel Date: Sun, 11 Sep 2016 20:04:57 -0500 Subject: [PATCH] Context menu search respects session setting of current tab New tabs opened by Search Image or Search for ... will open with the same session and privacy settings as the tab it was opened from. Fix #3662 --- js/contextMenus.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/contextMenus.js b/js/contextMenus.js index 9aa6995e4d3..036283d73f1 100644 --- a/js/contextMenus.js +++ b/js/contextMenus.js @@ -745,8 +745,12 @@ const searchSelectionMenuItem = (location) => { label: locale.translation('openSearch').replace(/{{\s*selectedVariable\s*}}/, searchText), click: (item, focusedWindow) => { if (focusedWindow && location) { + let activeFrame = windowStore.getState().get('activeFrameKey') + let frame = windowStore.getFrame(activeFrame) let searchUrl = windowStore.getState().getIn(['searchDetail', 'searchURL']).replace('{searchTerms}', encodeURIComponent(location)) - windowActions.newFrame({ location: searchUrl }, true) + windowActions.newFrame({ location: searchUrl, + isPrivate: frame.get('isPrivate'), + partitionNumber: frame.get('partitionNumber') }, true) } } } @@ -844,10 +848,14 @@ function mainTemplateInit (nodeProps, frame) { { label: locale.translation('searchImage'), click: (item) => { + let activeFrame = windowStore.getState().get('activeFrameKey') + let frame = windowStore.getFrame(activeFrame) let searchUrl = windowStore.getState().getIn(['searchDetail', 'searchURL']) .replace('{searchTerms}', encodeURIComponent(nodeProps.srcURL)) .replace('?q', 'byimage?image_url') - windowActions.newFrame({ location: searchUrl }, true) + windowActions.newFrame({ location: searchUrl, + isPrivate: frame.get('isPrivate'), + partitionNumber: frame.get('partitionNumber')}, true) } } )