Account for the new referencesSearch flag when deciding to do fullIndex

This commit is contained in:
Shane Kilkelly 2018-05-14 11:31:59 +01:00
parent 8ea690a745
commit 43d00a2e5f
2 changed files with 12 additions and 1 deletions

View file

@ -46,7 +46,8 @@ module.exports = ReferencesHandler =
_isFullIndex: (project, callback = (err, result) ->) -> _isFullIndex: (project, callback = (err, result) ->) ->
UserGetter.getUser project.owner_ref, { features: true }, (err, owner) -> UserGetter.getUser project.owner_ref, { features: true }, (err, owner) ->
return callback(err) if err? return callback(err) if err?
callback(null, owner?.features?.references == true) features = owner?.features
callback(null, features?.references == true || features?.referencesSearch == true)
indexAll: (projectId, callback=(err, data)->) -> indexAll: (projectId, callback=(err, data)->) ->
ProjectGetter.getProject projectId, {rootFolder: true, owner_ref: 1}, (err, project) -> ProjectGetter.getProject projectId, {rootFolder: true, owner_ref: 1}, (err, project) ->

View file

@ -385,3 +385,13 @@ describe 'ReferencesHandler', ->
@call (err, isFullIndex) => @call (err, isFullIndex) =>
expect(err).to.equal null expect(err).to.equal null
expect(isFullIndex).to.equal false expect(isFullIndex).to.equal false
describe 'with referencesSearch', ->
beforeEach ->
@owner.features = {referencesSearch: true, references: false}
it 'should return true', ->
@call (err, isFullIndex) =>
expect(err).to.equal null
expect(isFullIndex).to.equal true