forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Surveys for unregistered users (decidim#4996) (#847)
* Surveys for unregistered users (decidim#4996) * Add allow_unregistered option to surveys component * locales for allow_unregistered settings action * relax permissions to allow answers withou users * Add session token to answer for grouping anonymous answers * check if an unregistered user has already answered the questionnaire * add unregistered users test * rubocop happiness * change test to match new locale messages * add changelog entry [ci skip] * unregisterd users settings warning * add ip hash to unregistered surveys * add invisible_captcha to forms * Add user status to answers export * remove unused key * avoid NULL column * use current instead of now * refactor questionnaire validation for unregistered users * simplify questionnaire validation and fix meetings reuse * fix meetings tests * Fix missing translations [ci skip]
- Loading branch information
1 parent
1411c88
commit c99eac6
Showing
22 changed files
with
310 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
decidim-forms/db/migrate/20190315203056_add_session_token_to_decidim_forms_answers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddSessionTokenToDecidimFormsAnswers < ActiveRecord::Migration[5.2] | ||
class Answer < ApplicationRecord | ||
self.table_name = :decidim_forms_answers | ||
end | ||
|
||
def change | ||
add_column :decidim_forms_answers, :session_token, :string, null: false, default: "" | ||
add_index :decidim_forms_answers, :session_token | ||
|
||
Answer.find_each do |answer| | ||
answer.session_token = Digest::MD5.hexdigest("#{answer.decidim_user_id}-#{Rails.application.secrets.secret_key_base}") | ||
answer.save! | ||
end | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
decidim-forms/db/migrate/20190930094710_add_ip_hash_to_decidim_form_answers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddIpHashToDecidimFormAnswers < ActiveRecord::Migration[5.2] | ||
class Answer < ApplicationRecord | ||
self.table_name = :decidim_forms_answers | ||
end | ||
|
||
def change | ||
add_column :decidim_forms_answers, :ip_hash, :string | ||
add_index :decidim_forms_answers, :ip_hash | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.