decidim-survey_multiple_answers 0.26.1 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bf38cb9cc911820cad29e3307cb47490a982848a67b3368be798abe37d3f139
|
4
|
+
data.tar.gz: 57ae08452e674b54ab52037e6b84316b43869e08163487abf2ab1330fe9f6cba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34e028205c9b9cea12f6d70a77fbd9cc76aca7e3b3b71a948cf293277938990c690c81d0714516c58ef4496a6b883620978b1bb4f1f634bc82932aa40be03cbb
|
7
|
+
data.tar.gz: 28f527509a24b5cb832dcdfbec2500ac0cb78bbfc8499b54749dbaf15dee6a427971ff30e4c811b0927d184d049c4496ca042391236b585b913cdfe73db3b741
|
@@ -18,32 +18,22 @@ module Decidim
|
|
18
18
|
|
19
19
|
# Public: return true if the current user (or session visitor) can answer the questionnaire
|
20
20
|
def visitor_already_answered?
|
21
|
-
return false if
|
21
|
+
return false if allow_multiple_answers?
|
22
22
|
|
23
23
|
questionnaire.answered_by?(current_user || tokenize(session[:session_id]))
|
24
24
|
end
|
25
25
|
|
26
26
|
# token is used as a substitute of user_id if unregistered
|
27
27
|
def session_token
|
28
|
+
id = current_user&.id
|
29
|
+
|
28
30
|
session_id = request.session[:session_id] if request&.session
|
29
|
-
id =
|
31
|
+
id = SecureRandom.hex if allow_multiple_answers?
|
30
32
|
|
31
33
|
return nil unless id || session_id
|
32
34
|
|
33
35
|
@session_token ||= tokenize(id || session_id)
|
34
36
|
end
|
35
|
-
|
36
|
-
def can_submit_multiple_answers?
|
37
|
-
collaborator? && allow_multiple_answers?
|
38
|
-
end
|
39
|
-
|
40
|
-
def collaborator?
|
41
|
-
return false unless current_user
|
42
|
-
|
43
|
-
current_user.admin? ||
|
44
|
-
current_participatory_space.user_roles(:admin).exists?(user: current_user) ||
|
45
|
-
current_participatory_space.user_roles(:collaborator).exists?(user: current_user)
|
46
|
-
end
|
47
37
|
end
|
48
38
|
end
|
49
39
|
# rubocop:enable Metrics/CyclomaticComplexity
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-survey_multiple_answers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandru Emil Lupu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|