decidim-bulletin_board 0.5.3 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Decidim
4
4
  module BulletinBoard
5
- VERSION = "0.5.3"
5
+ VERSION = "0.8.2"
6
6
  end
7
7
  end
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "decidim/bulletin_board/voter/cast_vote"
4
+ require "decidim/bulletin_board/voter/get_pending_message_status"
@@ -21,7 +21,7 @@ module Decidim
21
21
  #
22
22
  # Returns nothing.
23
23
  def call
24
- message_id = message_id(unique_election_id(election_id), "vote.cast", voter_id)
24
+ message_id = cast_vote_message_id(election_id, voter_id)
25
25
  signed_data = sign_message(message_id, { content: encrypted_vote })
26
26
 
27
27
  begin
@@ -44,8 +44,14 @@ module Decidim
44
44
  end
45
45
  end
46
46
 
47
+ def self.cast_vote_message_id(election_id, voter_id)
48
+ message_id(unique_election_id(election_id), "vote.cast", voter_id)
49
+ end
50
+
47
51
  private
48
52
 
53
+ delegate :cast_vote_message_id, to: :class
54
+
49
55
  attr_reader :election_id, :voter_id, :encrypted_vote
50
56
  end
51
57
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module BulletinBoard
5
+ module Voter
6
+ # This command uses the GraphQL client to get the status of a specific pending message.
7
+ class GetPendingMessageStatus < Decidim::BulletinBoard::Command
8
+ # Public: Initializes the command.
9
+ #
10
+ # form - A form object with the params.
11
+ def initialize(message_id)
12
+ @message_id = message_id
13
+ end
14
+
15
+ # Executes the command. Broadcasts these events:
16
+ #
17
+ # - :ok when everything is valid and the query operation is successful.
18
+ # - :error if the form wasn't valid or the query operation was not successful.
19
+ #
20
+ # Returns nothing.
21
+ def call
22
+ message_id = @message_id
23
+
24
+ begin
25
+ response = client.query do
26
+ query do
27
+ pendingMessage(messageId: message_id) do
28
+ status
29
+ end
30
+ end
31
+ end
32
+
33
+ broadcast(:ok, response.data.pending_message.status)
34
+ rescue Graphlient::Errors::ServerError
35
+ broadcast(:error, "Sorry, something went wrong")
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,32 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-bulletin_board
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Morcillo
8
8
  - Svenja Schäfer
9
+ - Leonardo Diez
10
+ - Agustí B.R.
9
11
  autorequire:
10
12
  bindir: exe
11
13
  cert_chain: []
12
- date: 2020-12-20 00:00:00.000000000 Z
14
+ date: 2021-01-28 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
- name: activemodel
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 5.0.0
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 5.0.0
28
- - !ruby/object:Gem::Dependency
29
- name: activesupport
17
+ name: rails
30
18
  requirement: !ruby/object:Gem::Requirement
31
19
  requirements:
32
20
  - - ">="
@@ -155,6 +143,8 @@ description: ''
155
143
  email:
156
144
  - david@codegram.com
157
145
  - svenja@codegram.com
146
+ - leo@codegram.com
147
+ - agusti@codegram.com
158
148
  executables: []
159
149
  extensions: []
160
150
  extra_rdoc_files: []
@@ -170,6 +160,9 @@ files:
170
160
  - Gemfile.lock
171
161
  - README.md
172
162
  - Rakefile
163
+ - app/assets/config/decidim_bulletin_board_manifest.js
164
+ - app/assets/javascripts/decidim/bulletin_board/decidim-bulletin_board.dev.js
165
+ - app/assets/javascripts/decidim/bulletin_board/decidim-bulletin_board.js
173
166
  - bin/console
174
167
  - bin/setup
175
168
  - decidim-bulletin_board.gemspec
@@ -179,8 +172,11 @@ files:
179
172
  - lib/decidim/bulletin_board/authority/create_election.rb
180
173
  - lib/decidim/bulletin_board/authority/get_election_status.rb
181
174
  - lib/decidim/bulletin_board/authority/open_ballot_box.rb
175
+ - lib/decidim/bulletin_board/authority/publish_results.rb
176
+ - lib/decidim/bulletin_board/authority/start_tally.rb
182
177
  - lib/decidim/bulletin_board/client.rb
183
178
  - lib/decidim/bulletin_board/command.rb
179
+ - lib/decidim/bulletin_board/engine.rb
184
180
  - lib/decidim/bulletin_board/graphql/bb_schema.json
185
181
  - lib/decidim/bulletin_board/graphql/client.rb
186
182
  - lib/decidim/bulletin_board/jwk_utils.rb
@@ -188,6 +184,7 @@ files:
188
184
  - lib/decidim/bulletin_board/version.rb
189
185
  - lib/decidim/bulletin_board/voter.rb
190
186
  - lib/decidim/bulletin_board/voter/cast_vote.rb
187
+ - lib/decidim/bulletin_board/voter/get_pending_message_status.rb
191
188
  homepage: https://github.com
192
189
  licenses:
193
190
  - AGPL-3.0