Push users.preferences to elasticsearch to enable searches for certain features.

This commit is contained in:
Martin Edenhofer 2017-12-14 21:05:59 +01:00
parent e460c99cad
commit 34c14a22b5
3 changed files with 4 additions and 7 deletions

View file

@ -72,8 +72,7 @@ class User < ApplicationModel
:image,
:image_source,
:source,
:login_failed,
:preferences
:login_failed
def ignore_search_indexing?(_action)
# ignore internal user

View file

@ -50,11 +50,6 @@ returns
def search_index_data
attributes = {}
self.attributes.each do |key, value|
next if key == 'created_at'
next if key == 'updated_at'
next if key == 'created_by_id'
next if key == 'updated_by_id'
next if key == 'preferences'
next if key == 'password'
next if !value
next if value.respond_to?('blank?') && value.blank?

View file

@ -114,6 +114,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
assert_equal('E', attributes['firstname'])
assert_equal('S', attributes['lastname'])
assert_equal('es-agent@example.com', attributes['email'])
assert(attributes['preferences'])
assert_not(attributes['password'])
assert_not(attributes['organization'])
@ -121,6 +122,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
assert_equal('E', attributes['firstname'])
assert_equal('S', attributes['lastname'])
assert_equal('es-agent@example.com', attributes['email'])
assert(attributes['preferences'])
assert_not(attributes['password'])
assert_not(attributes['organization'])
@ -128,6 +130,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
assert_equal('ES', attributes['firstname'])
assert_equal('Customer1', attributes['lastname'])
assert_equal('es-customer1@example.com', attributes['email'])
assert(attributes['preferences'])
assert_not(attributes['password'])
assert_equal('Customer Organization Update', attributes['organization'])