decidim-bulletin_board 0.7.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/CHANGELOG.md +42 -1
- data/Gemfile.lock +5 -4
- data/app/assets/javascripts/decidim/bulletin_board/decidim-bulletin_board.js +2 -2
- data/lib/decidim/bulletin_board/authority.rb +4 -2
- data/lib/decidim/bulletin_board/authority/create_election.rb +22 -16
- data/lib/decidim/bulletin_board/authority/end_vote.rb +57 -0
- data/lib/decidim/bulletin_board/authority/get_election_log_entries_by_types.rb +51 -0
- data/lib/decidim/bulletin_board/authority/get_election_status.rb +12 -11
- data/lib/decidim/bulletin_board/authority/publish_results.rb +22 -16
- data/lib/decidim/bulletin_board/authority/start_key_ceremony.rb +57 -0
- data/lib/decidim/bulletin_board/authority/start_tally.rb +22 -16
- data/lib/decidim/bulletin_board/authority/start_vote.rb +57 -0
- data/lib/decidim/bulletin_board/client.rb +44 -18
- data/lib/decidim/bulletin_board/command.rb +9 -9
- data/lib/decidim/bulletin_board/graphql/bb_schema.json +199 -93
- data/lib/decidim/bulletin_board/version.rb +1 -1
- data/lib/decidim/bulletin_board/voter.rb +1 -0
- data/lib/decidim/bulletin_board/voter/cast_vote.rb +14 -3
- data/lib/decidim/bulletin_board/voter/get_pending_message_status.rb +41 -0
- metadata +7 -5
- data/app/assets/javascripts/decidim/bulletin_board/decidim-bulletin_board.dev.js +0 -17706
- data/lib/decidim/bulletin_board/authority/close_ballot_box.rb +0 -51
- data/lib/decidim/bulletin_board/authority/open_ballot_box.rb +0 -51
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module BulletinBoard
|
5
|
-
module Authority
|
6
|
-
# This command uses the GraphQL client to request the closing of the ballot box.
|
7
|
-
class CloseBallotBox < Decidim::BulletinBoard::Command
|
8
|
-
# Public: Initializes the command.
|
9
|
-
#
|
10
|
-
# election_id - The local election identifier
|
11
|
-
def initialize(election_id)
|
12
|
-
@election_id = election_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 query operation was not successful.
|
19
|
-
#
|
20
|
-
# Returns nothing.
|
21
|
-
def call
|
22
|
-
message_id = message_id(unique_election_id(election_id), "close_ballot_box")
|
23
|
-
signed_data = sign_message(message_id, {})
|
24
|
-
|
25
|
-
begin
|
26
|
-
response = client.query do
|
27
|
-
mutation do
|
28
|
-
closeBallotBox(messageId: message_id, signedData: signed_data) do
|
29
|
-
election do
|
30
|
-
status
|
31
|
-
end
|
32
|
-
error
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
return broadcast(:error, response.data.close_ballot_box.error) if response.data.close_ballot_box.error.present?
|
38
|
-
|
39
|
-
broadcast(:ok, response.data.close_ballot_box.election)
|
40
|
-
rescue Graphlient::Errors::ServerError
|
41
|
-
broadcast(:error, "Sorry, something went wrong")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
attr_reader :election_id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module BulletinBoard
|
5
|
-
module Authority
|
6
|
-
# This command uses the GraphQL client to request the opening of the ballot box.
|
7
|
-
class OpenBallotBox < Decidim::BulletinBoard::Command
|
8
|
-
# Public: Initializes the command.
|
9
|
-
#
|
10
|
-
# election_id - The local election identifier
|
11
|
-
def initialize(election_id)
|
12
|
-
@election_id = election_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 query operation was not successful.
|
19
|
-
#
|
20
|
-
# Returns nothing.
|
21
|
-
def call
|
22
|
-
message_id = message_id(unique_election_id(election_id), "open_ballot_box")
|
23
|
-
signed_data = sign_message(message_id, {})
|
24
|
-
|
25
|
-
begin
|
26
|
-
response = client.query do
|
27
|
-
mutation do
|
28
|
-
openBallotBox(messageId: message_id, signedData: signed_data) do
|
29
|
-
election do
|
30
|
-
status
|
31
|
-
end
|
32
|
-
error
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
return broadcast(:error, response.data.open_ballot_box.error) if response.data.open_ballot_box.error.present?
|
38
|
-
|
39
|
-
broadcast(:ok, response.data.open_ballot_box.election)
|
40
|
-
rescue Graphlient::Errors::ServerError
|
41
|
-
broadcast(:error, "Sorry, something went wrong")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
attr_reader :election_id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|