workarea-reviews 3.1.1 → 3.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a07fba40d273a1fd46dfa4575601eefe0eb742fafe6da2be58c2ca07fba3b51f
|
4
|
+
data.tar.gz: 9a5f40859ec940937ac073bfc976ea1e899d05864f3cdf2e2b261b25a2963410
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49005ddc4805c46ff4bcb725a1c6b30d53f616b912880c6c64404c57334e31281824ea1fe3109204981fbec7db255bc327be890d2fd536ef17a9a80e42e9efb6
|
7
|
+
data.tar.gz: 27fc7ae007ceb0b676576a8a93e270869aa8c362d76054e15faa0863911be3872eed903604132d15382fdd52cdc5f251f21ed514b6a515a4b93c24187d2290ee
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
Workarea Reviews 3.1.2 (2020-10-30)
|
2
|
+
--------------------------------------------------------------------------------
|
3
|
+
|
4
|
+
* Handle reviews with user_ids that do not match a user
|
5
|
+
|
6
|
+
REVIEWS-6
|
7
|
+
|
8
|
+
Matt Duffy
|
9
|
+
|
10
|
+
|
11
|
+
|
1
12
|
Workarea Reviews 3.1.1 (2020-01-07)
|
2
13
|
--------------------------------------------------------------------------------
|
3
14
|
|
@@ -2,12 +2,18 @@ module Workarea
|
|
2
2
|
module Storefront
|
3
3
|
class ReviewViewModel < ApplicationViewModel
|
4
4
|
def requires_public_info?
|
5
|
-
anonymous? || user
|
5
|
+
anonymous? || user&.public_info.blank?
|
6
|
+
end
|
7
|
+
|
8
|
+
def anonymous?
|
9
|
+
model.anonymous? || user.nil?
|
6
10
|
end
|
7
11
|
|
8
12
|
def user
|
9
|
-
return if anonymous?
|
10
|
-
@user
|
13
|
+
return if model.anonymous?
|
14
|
+
return @user if defined?(@user)
|
15
|
+
|
16
|
+
@user = User.find(user_id) rescue nil
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class ReviewViewModelTest < TestCase
|
6
|
+
def test_requires_public_info?
|
7
|
+
review = Review.new
|
8
|
+
assert(ReviewViewModel.wrap(review).requires_public_info?)
|
9
|
+
|
10
|
+
user = create_user(first_name: nil, last_name: nil)
|
11
|
+
review.user_id = user.id
|
12
|
+
assert(ReviewViewModel.wrap(review).requires_public_info?)
|
13
|
+
|
14
|
+
user.update!(first_name: 'Bob', last_name: 'Clams')
|
15
|
+
refute(ReviewViewModel.wrap(review).requires_public_info?)
|
16
|
+
|
17
|
+
user.destroy!
|
18
|
+
assert(ReviewViewModel.wrap(review).requires_public_info?)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_anonymous?
|
22
|
+
review = Review.new
|
23
|
+
assert(ReviewViewModel.wrap(review).anonymous?)
|
24
|
+
|
25
|
+
user = create_user
|
26
|
+
review.user_id = user.id
|
27
|
+
refute(ReviewViewModel.wrap(review).anonymous?)
|
28
|
+
|
29
|
+
user.destroy!
|
30
|
+
assert(ReviewViewModel.wrap(review).anonymous?)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_user
|
34
|
+
review = Review.new
|
35
|
+
assert_nil(ReviewViewModel.wrap(review).user)
|
36
|
+
|
37
|
+
user = create_user
|
38
|
+
review.user_id = user.id
|
39
|
+
assert_equal(user, ReviewViewModel.wrap(review).user)
|
40
|
+
|
41
|
+
user.destroy!
|
42
|
+
assert_nil(ReviewViewModel.wrap(review).user)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/yarn.lock
CHANGED
@@ -184,9 +184,9 @@ acorn-jsx@^5.0.0:
|
|
184
184
|
integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw==
|
185
185
|
|
186
186
|
acorn@^6.0.7:
|
187
|
-
version "6.
|
188
|
-
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.
|
189
|
-
integrity sha512
|
187
|
+
version "6.4.1"
|
188
|
+
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474"
|
189
|
+
integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==
|
190
190
|
|
191
191
|
ajv@^6.10.2, ajv@^6.9.1:
|
192
192
|
version "6.10.2"
|
@@ -1773,9 +1773,9 @@ locate-path@^2.0.0:
|
|
1773
1773
|
path-exists "^3.0.0"
|
1774
1774
|
|
1775
1775
|
lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15:
|
1776
|
-
version "4.17.
|
1777
|
-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.
|
1778
|
-
integrity sha512-
|
1776
|
+
version "4.17.19"
|
1777
|
+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
|
1778
|
+
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
|
1779
1779
|
|
1780
1780
|
log-symbols@^2.2.0:
|
1781
1781
|
version "2.2.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-reviews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
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-
|
11
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: workarea
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- test/system/workarea/storefront/review_system_test.rb
|
235
235
|
- test/teaspoon_env.rb
|
236
236
|
- test/test_helper.rb
|
237
|
+
- test/view_models/workarea/storefront/review_view_model_test.rb
|
237
238
|
- test/workers/workarea/create_review_requests_test.rb
|
238
239
|
- test/workers/workarea/schedule_review_requests_test.rb
|
239
240
|
- test/workers/workarea/send_review_requests_test.rb
|
@@ -258,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
259
|
- !ruby/object:Gem::Version
|
259
260
|
version: '0'
|
260
261
|
requirements: []
|
261
|
-
rubygems_version: 3.0.
|
262
|
+
rubygems_version: 3.0.3
|
262
263
|
signing_key:
|
263
264
|
specification_version: 4
|
264
265
|
summary: Reviews plugin for the Workarea ecommerce platform
|