decidim-bulletin_board 0.15.1 → 0.17.1

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: 07057d8bf5262dbf5929110c87e970abc2d0de0eeaec11174220b83a85f7eb6e
4
- data.tar.gz: d721f9561b10f02e7c2291a473a3ff592d6eae6e7767f5032e7c1fcb13e9c570
3
+ metadata.gz: f57fb62ad80dd77a01967428857403e6bf924b914436ba925326d3a42f0ea788
4
+ data.tar.gz: cc268ad78df55d1b237d323ca7a718e1684a1525b6e11e1aa92c62dad30dbac9
5
5
  SHA512:
6
- metadata.gz: 0faec0781d970b589bb18e0f47f82cbeb9212c6c5c3ffd3b1c28768e71ff0385f4490aae97567299f65dbb326efcb3d57c8926a3efc73953fd6073b35612c523
7
- data.tar.gz: d3fdd20acb00f422c1382bf6a081f611c0bc8eac1a5c5e1507b8468b44f7e0de7f2c2c187a10ba16f6214eb7a070f87daf467eec01bce86c58b8ce1b85e1958a
6
+ metadata.gz: a67ac0126b78b6eb5be7c8867cbd2ca87f0d8eb7961bc421ecc718cf016c9a7d4e490ac28bf40cc1f3e894cfc61ca707e949f05dc445c80e86af4b3bb408039d
7
+ data.tar.gz: 4e12f82f34a1d1c3db236b01e686ce4c14711ba9f8ba9121bdec49352d796fd63605b37646560e1777d0cf58f027a9eedcaf1eb5e061cc6d2570b48453ea4999
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- /.bundle/
1
+ /.bundle
2
2
  /.yardoc
3
3
  /_yardoc/
4
4
  /coverage/
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- decidim-bulletin_board (0.15.1)
4
+ decidim-bulletin_board (0.17.1)
5
5
  byebug (~> 11.0)
6
6
  graphlient (~> 0.4.0)
7
7
  jwt (~> 2.2.2)
@@ -11,60 +11,60 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (6.1.3)
15
- actionpack (= 6.1.3)
16
- activesupport (= 6.1.3)
14
+ actioncable (6.1.3.1)
15
+ actionpack (= 6.1.3.1)
16
+ activesupport (= 6.1.3.1)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
- actionmailbox (6.1.3)
20
- actionpack (= 6.1.3)
21
- activejob (= 6.1.3)
22
- activerecord (= 6.1.3)
23
- activestorage (= 6.1.3)
24
- activesupport (= 6.1.3)
19
+ actionmailbox (6.1.3.1)
20
+ actionpack (= 6.1.3.1)
21
+ activejob (= 6.1.3.1)
22
+ activerecord (= 6.1.3.1)
23
+ activestorage (= 6.1.3.1)
24
+ activesupport (= 6.1.3.1)
25
25
  mail (>= 2.7.1)
26
- actionmailer (6.1.3)
27
- actionpack (= 6.1.3)
28
- actionview (= 6.1.3)
29
- activejob (= 6.1.3)
30
- activesupport (= 6.1.3)
26
+ actionmailer (6.1.3.1)
27
+ actionpack (= 6.1.3.1)
28
+ actionview (= 6.1.3.1)
29
+ activejob (= 6.1.3.1)
30
+ activesupport (= 6.1.3.1)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  rails-dom-testing (~> 2.0)
33
- actionpack (6.1.3)
34
- actionview (= 6.1.3)
35
- activesupport (= 6.1.3)
33
+ actionpack (6.1.3.1)
34
+ actionview (= 6.1.3.1)
35
+ activesupport (= 6.1.3.1)
36
36
  rack (~> 2.0, >= 2.0.9)
37
37
  rack-test (>= 0.6.3)
38
38
  rails-dom-testing (~> 2.0)
39
39
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
40
- actiontext (6.1.3)
41
- actionpack (= 6.1.3)
42
- activerecord (= 6.1.3)
43
- activestorage (= 6.1.3)
44
- activesupport (= 6.1.3)
40
+ actiontext (6.1.3.1)
41
+ actionpack (= 6.1.3.1)
42
+ activerecord (= 6.1.3.1)
43
+ activestorage (= 6.1.3.1)
44
+ activesupport (= 6.1.3.1)
45
45
  nokogiri (>= 1.8.5)
46
- actionview (6.1.3)
47
- activesupport (= 6.1.3)
46
+ actionview (6.1.3.1)
47
+ activesupport (= 6.1.3.1)
48
48
  builder (~> 3.1)
49
49
  erubi (~> 1.4)
50
50
  rails-dom-testing (~> 2.0)
51
51
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
52
- activejob (6.1.3)
53
- activesupport (= 6.1.3)
52
+ activejob (6.1.3.1)
53
+ activesupport (= 6.1.3.1)
54
54
  globalid (>= 0.3.6)
55
- activemodel (6.1.3)
56
- activesupport (= 6.1.3)
57
- activerecord (6.1.3)
58
- activemodel (= 6.1.3)
59
- activesupport (= 6.1.3)
60
- activestorage (6.1.3)
61
- actionpack (= 6.1.3)
62
- activejob (= 6.1.3)
63
- activerecord (= 6.1.3)
64
- activesupport (= 6.1.3)
65
- marcel (~> 0.3.1)
66
- mimemagic (~> 0.3.2)
67
- activesupport (6.1.3)
55
+ activemodel (6.1.3.1)
56
+ activesupport (= 6.1.3.1)
57
+ activerecord (6.1.3.1)
58
+ activemodel (= 6.1.3.1)
59
+ activesupport (= 6.1.3.1)
60
+ activestorage (6.1.3.1)
61
+ actionpack (= 6.1.3.1)
62
+ activejob (= 6.1.3.1)
63
+ activerecord (= 6.1.3.1)
64
+ activesupport (= 6.1.3.1)
65
+ marcel (~> 1.0.0)
66
+ mini_mime (~> 1.0.2)
67
+ activesupport (6.1.3.1)
68
68
  concurrent-ruby (~> 1.0, >= 1.0.2)
69
69
  i18n (>= 1.6, < 2)
70
70
  minitest (>= 5.1)
@@ -75,7 +75,7 @@ GEM
75
75
  ast (2.4.1)
76
76
  builder (3.2.4)
77
77
  byebug (11.1.3)
78
- concurrent-ruby (1.1.7)
78
+ concurrent-ruby (1.1.8)
79
79
  crack (0.4.5)
80
80
  rexml
81
81
  crass (1.0.6)
@@ -96,29 +96,27 @@ GEM
96
96
  faraday (>= 1.0)
97
97
  faraday_middleware
98
98
  graphql-client
99
- graphql (1.12.6)
99
+ graphql (1.12.8)
100
100
  graphql-client (0.16.0)
101
101
  activesupport (>= 3.0)
102
102
  graphql (~> 1.8)
103
103
  hashdiff (1.0.1)
104
- i18n (1.8.5)
104
+ i18n (1.8.10)
105
105
  concurrent-ruby (~> 1.0)
106
106
  jwt (2.2.2)
107
- loofah (2.9.0)
107
+ loofah (2.9.1)
108
108
  crass (~> 1.0.2)
109
109
  nokogiri (>= 1.5.9)
110
110
  mail (2.7.1)
111
111
  mini_mime (>= 0.1.1)
112
- marcel (0.3.3)
113
- mimemagic (~> 0.3.2)
112
+ marcel (1.0.1)
114
113
  method_source (1.0.0)
115
- mimemagic (0.3.5)
116
- mini_mime (1.0.2)
114
+ mini_mime (1.0.3)
117
115
  mini_portile2 (2.5.0)
118
116
  minitest (5.14.4)
119
117
  multipart-post (2.1.1)
120
118
  nio4r (2.5.7)
121
- nokogiri (1.11.2)
119
+ nokogiri (1.11.3)
122
120
  mini_portile2 (~> 2.5.0)
123
121
  racc (~> 1.4)
124
122
  parallel (1.20.1)
@@ -129,34 +127,34 @@ GEM
129
127
  rack (2.2.3)
130
128
  rack-test (1.1.0)
131
129
  rack (>= 1.0, < 3)
132
- rails (6.1.3)
133
- actioncable (= 6.1.3)
134
- actionmailbox (= 6.1.3)
135
- actionmailer (= 6.1.3)
136
- actionpack (= 6.1.3)
137
- actiontext (= 6.1.3)
138
- actionview (= 6.1.3)
139
- activejob (= 6.1.3)
140
- activemodel (= 6.1.3)
141
- activerecord (= 6.1.3)
142
- activestorage (= 6.1.3)
143
- activesupport (= 6.1.3)
130
+ rails (6.1.3.1)
131
+ actioncable (= 6.1.3.1)
132
+ actionmailbox (= 6.1.3.1)
133
+ actionmailer (= 6.1.3.1)
134
+ actionpack (= 6.1.3.1)
135
+ actiontext (= 6.1.3.1)
136
+ actionview (= 6.1.3.1)
137
+ activejob (= 6.1.3.1)
138
+ activemodel (= 6.1.3.1)
139
+ activerecord (= 6.1.3.1)
140
+ activestorage (= 6.1.3.1)
141
+ activesupport (= 6.1.3.1)
144
142
  bundler (>= 1.15.0)
145
- railties (= 6.1.3)
143
+ railties (= 6.1.3.1)
146
144
  sprockets-rails (>= 2.0.0)
147
145
  rails-dom-testing (2.0.3)
148
146
  activesupport (>= 4.2.0)
149
147
  nokogiri (>= 1.6)
150
148
  rails-html-sanitizer (1.3.0)
151
149
  loofah (~> 2.3)
152
- railties (6.1.3)
153
- actionpack (= 6.1.3)
154
- activesupport (= 6.1.3)
150
+ railties (6.1.3.1)
151
+ actionpack (= 6.1.3.1)
152
+ activesupport (= 6.1.3.1)
155
153
  method_source
156
154
  rake (>= 0.8.7)
157
155
  thor (~> 1.0)
158
156
  rainbow (3.0.0)
159
- rake (13.0.1)
157
+ rake (13.0.3)
160
158
  regexp_parser (2.0.0)
161
159
  rexml (3.2.4)
162
160
  rspec (3.9.0)
@@ -17,7 +17,9 @@ Gem::Specification.new do |s|
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
19
  s.files = Dir.chdir(File.expand_path(__dir__)) do
20
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ `git ls-files -z`
21
+ .split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ .concat(["app/assets/javascripts/decidim/bulletin_board/decidim-bulletin_board.js"])
21
23
  end
22
24
  s.bindir = "exe"
23
25
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -52,10 +52,11 @@ module Decidim
52
52
  trustees: trustees,
53
53
  description: {
54
54
  name: text(election_data[:title]),
55
- start_date: election_data[:start_date].iso8601,
56
- end_date: election_data[:end_date].iso8601,
55
+ start_date: election_data[:start_date].strftime("%FT%T%:z"),
56
+ end_date: election_data[:end_date].strftime("%FT%T%:z"),
57
57
  candidates: candidates,
58
- contests: contests
58
+ contests: contests,
59
+ ballot_styles: ballot_styles
59
60
  }
60
61
  }
61
62
  end
@@ -128,6 +129,15 @@ module Decidim
128
129
  end
129
130
  end
130
131
 
132
+ def ballot_styles
133
+ election_data[:ballot_styles].map do |ballot_style_id, question_ids|
134
+ {
135
+ object_id: ballot_style_id.to_s,
136
+ contests: question_ids
137
+ }
138
+ end
139
+ end
140
+
131
141
  def default_text(field)
132
142
  field[default_locale]
133
143
  end
@@ -14,6 +14,7 @@ require "decidim/bulletin_board/authority/publish_results"
14
14
  require "decidim/bulletin_board/authority/get_election_results"
15
15
  require "decidim/bulletin_board/voter/cast_vote"
16
16
  require "decidim/bulletin_board/voter/get_pending_message_status"
17
+ require "decidim/bulletin_board/test/reset_test_database"
17
18
 
18
19
  module Decidim
19
20
  module BulletinBoard
@@ -106,6 +107,15 @@ module Decidim
106
107
  publish_results.call
107
108
  end
108
109
 
110
+ if Rails.env.test?
111
+ def reset_test_database
112
+ reset_test_database = configure Test::ResetTestDatabase.new
113
+ reset_test_database.on(:ok) { |result| return result }
114
+ reset_test_database.on(:error) { |error_message| raise StandardError, error_message }
115
+ reset_test_database.call
116
+ end
117
+ end
118
+
109
119
  private
110
120
 
111
121
  attr_reader :settings, :graphql
@@ -398,6 +398,16 @@
398
398
  "enumValues": null,
399
399
  "possibleTypes": null
400
400
  },
401
+ {
402
+ "kind": "SCALAR",
403
+ "name": "Int",
404
+ "description": "Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",
405
+ "fields": null,
406
+ "inputFields": null,
407
+ "interfaces": null,
408
+ "enumValues": null,
409
+ "possibleTypes": null
410
+ },
401
411
  {
402
412
  "kind": "SCALAR",
403
413
  "name": "JSON",
@@ -875,6 +885,20 @@
875
885
  "isDeprecated": false,
876
886
  "deprecationReason": null
877
887
  },
888
+ {
889
+ "name": "resetTestDatabase",
890
+ "description": null,
891
+ "args": [
892
+
893
+ ],
894
+ "type": {
895
+ "kind": "OBJECT",
896
+ "name": "ResetTestDatabaseMutationPayload",
897
+ "ofType": null
898
+ },
899
+ "isDeprecated": false,
900
+ "deprecationReason": null
901
+ },
878
902
  {
879
903
  "name": "startKeyCeremony",
880
904
  "description": null,
@@ -1475,6 +1499,37 @@
1475
1499
  "enumValues": null,
1476
1500
  "possibleTypes": null
1477
1501
  },
1502
+ {
1503
+ "kind": "OBJECT",
1504
+ "name": "ResetTestDatabaseMutationPayload",
1505
+ "description": "Autogenerated return type of ResetTestDatabaseMutation",
1506
+ "fields": [
1507
+ {
1508
+ "name": "timestamp",
1509
+ "description": null,
1510
+ "args": [
1511
+
1512
+ ],
1513
+ "type": {
1514
+ "kind": "NON_NULL",
1515
+ "name": null,
1516
+ "ofType": {
1517
+ "kind": "SCALAR",
1518
+ "name": "Int",
1519
+ "ofType": null
1520
+ }
1521
+ },
1522
+ "isDeprecated": false,
1523
+ "deprecationReason": null
1524
+ }
1525
+ ],
1526
+ "inputFields": null,
1527
+ "interfaces": [
1528
+
1529
+ ],
1530
+ "enumValues": null,
1531
+ "possibleTypes": null
1532
+ },
1478
1533
  {
1479
1534
  "kind": "OBJECT",
1480
1535
  "name": "StartKeyCeremonyMutationPayload",
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module BulletinBoard
5
+ module Test
6
+ # This command uses the GraphQL client to clear the database in test mode.
7
+ class ResetTestDatabase < Decidim::BulletinBoard::Command
8
+ # Executes the command. Broadcasts these events:
9
+ #
10
+ # - :ok when everything is valid and the mutation operation is successful.
11
+ # - :error if query operation was not successful.
12
+ #
13
+ # Returns nothing.
14
+ def call
15
+ graphql.query do
16
+ mutation do
17
+ resetTestDatabase do
18
+ timestamp
19
+ end
20
+ end
21
+ end
22
+
23
+ broadcast(:ok)
24
+ rescue Graphlient::Errors::ServerError
25
+ broadcast(:error, "Sorry, something went wrong")
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Decidim
4
4
  module BulletinBoard
5
- VERSION = "0.15.1"
5
+ VERSION = "0.17.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-bulletin_board
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Morcillo
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-03-19 00:00:00.000000000 Z
14
+ date: 2021-04-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -159,6 +159,7 @@ files:
159
159
  - README.md
160
160
  - Rakefile
161
161
  - app/assets/config/manifest.js
162
+ - app/assets/javascripts/decidim/bulletin_board/decidim-bulletin_board.js
162
163
  - bin/console
163
164
  - bin/setup
164
165
  - decidim-bulletin_board.gemspec
@@ -181,6 +182,7 @@ files:
181
182
  - lib/decidim/bulletin_board/jwk_utils.rb
182
183
  - lib/decidim/bulletin_board/message_identifier.rb
183
184
  - lib/decidim/bulletin_board/settings.rb
185
+ - lib/decidim/bulletin_board/test/reset_test_database.rb
184
186
  - lib/decidim/bulletin_board/version.rb
185
187
  - lib/decidim/bulletin_board/voter/cast_vote.rb
186
188
  - lib/decidim/bulletin_board/voter/get_pending_message_status.rb