Fixed search not working for guests in public mode

This commit is contained in:
NGPixel 2017-04-16 12:30:19 -04:00
parent 642bcac472
commit d02b4a3591
3 changed files with 67 additions and 67 deletions

View File

@ -16,8 +16,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed ### Fixed
- **Configuration Wizard**: Git version detection no longer fails on MacOS - **Configuration Wizard**: Git version detection no longer fails on MacOS
- **Init**: Malformed config file is now being reported correctly - **Init**: Malformed config file is now being reported correctly
- **UI**: Scrollbar is no longer always shown in code blocks - **Init**: Git remote is now always updated to current settings
- **Misc**: CJK (Chinese, Japanese & Korean) characters are now fully supported for pages, content and uploads - **Misc**: CJK (Chinese, Japanese & Korean) characters are now fully supported for pages, content and uploads
- **UI**: Scrollbar is no longer always shown in code blocks
- **Search**: Search is now working for guest users when public mode is enabled
## [v1.0.0-beta.10] - 2017-04-08 ## [v1.0.0-beta.10] - 2017-04-08
### Added ### Added

View File

@ -5,25 +5,24 @@
const _ = require('lodash') const _ = require('lodash')
module.exports = (socket) => { module.exports = (socket) => {
if (!socket.request.user.logged_in) {
return
}
// ----------------------------------------- // -----------------------------------------
// SEARCH // SEARCH
// ----------------------------------------- // -----------------------------------------
if (appconfig.public || socket.request.user.logged_in) {
socket.on('search', (data, cb) => { socket.on('search', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
search.find(data.terms).then((results) => { search.find(data.terms).then((results) => {
return cb(results) || true return cb(results) || true
}) })
}) })
}
// ----------------------------------------- // -----------------------------------------
// UPLOADS // UPLOADS
// ----------------------------------------- // -----------------------------------------
if (socket.request.user.logged_in) {
socket.on('uploadsGetFolders', (data, cb) => { socket.on('uploadsGetFolders', (data, cb) => {
cb = cb || _.noop cb = cb || _.noop
upl.getUploadsFolders().then((f) => { upl.getUploadsFolders().then((f) => {
@ -95,3 +94,4 @@ module.exports = (socket) => {
}) })
}) })
} }
}

View File

@ -18,8 +18,6 @@ html
link(rel='manifest', href='/manifest.json') link(rel='manifest', href='/manifest.json')
// JS / CSS // JS / CSS
//script(type='text/javascript').
script(type='text/javascript', src='/js/bundle.min.js') script(type='text/javascript', src='/js/bundle.min.js')
block head block head