workarea-core 3.4.38 → 3.4.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ffbb2028cd43e91abbc3601126483073b55997738eba74759b902e353590b67
4
- data.tar.gz: 70acccdddb99146faaf878e862bc8a1e2161f5c2a62a10cd0f3f1f5f97bc4b19
3
+ metadata.gz: ae6526862e8c543160a1df0f1ee154cf6de027b87fa2222910e86f13b826e6a5
4
+ data.tar.gz: fe422c3b67acfc7befdccba7de26c314cd23e40e93e51f3968a2f1a59922e0f1
5
5
  SHA512:
6
- metadata.gz: fb66b15c9317d085e8dbd97262ddf4ae85ef31eb5cbb77b1bf6375f69b284a6ce439579c534b6ec05c337644b022e4b186e4f55c51cabf555a29c490f131bc8e
7
- data.tar.gz: db47bf0b35f4f7f12a27b05759d242301e7b0b6779670d41fab803129fd391c9246ecc08f494314e3865c5f8190a636d6f1df521b3b31d545dec53c624c5a6dd
6
+ metadata.gz: a1f096e09ee3909187463dec66d4b023afe2b2396ecfad07e005069b4fb1ae3ca43e2ab5b3b42bff01ee1f96cc794665ad359900d0cb82f0b1cac7df9ea7acf3
7
+ data.tar.gz: f04a5d34dcb94969890639267860780c5620ffc2190f0ec0427ae65115e20c675ead70895dd9961aa31f0ea99bc18a612e2aa7d16c18b40f9f75c3823a43264e
@@ -50,7 +50,8 @@ module Workarea
50
50
  end
51
51
 
52
52
  def current_impersonation
53
- @current_impersonation ||= User.find(cookies.signed[:user_id])
53
+ return @current_impersonation if defined?(@current_impersonation)
54
+ @current_impersonation = User.find(cookies.signed[:user_id]) rescue nil
54
55
  end
55
56
 
56
57
  def touch_impersonation
@@ -11,6 +11,10 @@ module Workarea
11
11
  def self.available_sorts
12
12
  AdminSorting.available_sorts
13
13
  end
14
+
15
+ def default_admin_sort
16
+ [{ _score: :desc }, { updated_at: :desc }]
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -16,7 +16,7 @@ module Workarea
16
16
  end
17
17
 
18
18
  def default_admin_sort
19
- [{ _score: :desc }, { updated_at: :desc }]
19
+ [{ updated_at: :desc }, { _score: :desc }]
20
20
  end
21
21
 
22
22
  def user_selected_sort
@@ -2,7 +2,7 @@ module Workarea
2
2
  module VERSION
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 38
5
+ PATCH = 39
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
@@ -81,6 +81,16 @@ module Workarea
81
81
  assert_equal(results.reverse, search.results)
82
82
  end
83
83
 
84
+ def test_default_sort_by_score
85
+ # Unlike other admin searches (primarily indexes), we want searching to
86
+ # default sort by score. Testing scores directly is unreliable so just
87
+ # do a simple check here.
88
+ assert_equal(
89
+ [{ _score: :desc }, { updated_at: :desc }],
90
+ AdminSearch.new.default_admin_sort
91
+ )
92
+ end
93
+
84
94
  def test_selected_sorting
85
95
  results = [
86
96
  create_product(name: 'A', variants: []),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.38
4
+ version: 3.4.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-19 00:00:00.000000000 Z
11
+ date: 2020-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler