Skip to content

User must review TOS when updated#3494

Merged
mrcasals merged 4 commits intodecidim:masterfrom
CodiTramuntana:feature/user_needs_tos_accepted
Jun 4, 2018
Merged

User must review TOS when updated#3494
mrcasals merged 4 commits intodecidim:masterfrom
CodiTramuntana:feature/user_needs_tos_accepted

Conversation

@agustibr
Copy link
Copy Markdown
Contributor

@agustibr agustibr commented May 24, 2018

🎩 What? Why?

When a user has accepted the TOS (Term Of Service), if it gets updated the user must review and accept again. Or an option to refuse.
Invited users must also accept the TOS.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add/modify seeds
  • Add tests
  • Add field accepted_tos_version to user
  • Added form to accept new TOS
  • Added option to refuse terms
  • signed_in user must accept to continue
  • fixed bug with high_voltage gem version
  • invited users must also accept TOS

📷 Screenshots (optional)

  • Redirected to tos page:
    screenshot from 2018-05-09 17-55-22

  • If TOS are accepted:
    screenshot from 2018-05-09 17-55-59

  • If the Refuse option is clicked a modal is shown with options:
    screenshot from 2018-05-16 16-49-05

  • Accept Invitation screen with TOS checkbox and text:
    screenshot from 2018-05-16 16-45-32


def permited_paths?
permited_paths = [tos_path, decidim.delete_account_path, decidim.accept_tos_path]
case request.path
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

permitted_paths.include?(request.path) instead of all this case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, its better


private

def permited_paths?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/permited/permitted everywhere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, I'll fix it

module TosPageHelper
# Renders the Call To Action button. Link and text can be configured
# per organization.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra white line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

html.html_safe
end

def tos_page_sticky_form
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this method and following ones to a cell

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

class AddAcceptedTosVersionFieldToUsers < ActiveRecord::Migration[5.1]
def up
add_column :decidim_users, :accepted_tos_version, :datetime
Decidim::Organization.find_each do |organization|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use fake classes in migrations, please:

class Organization < ApplicationRecord
  self.table_name = "decidim_organizations"
end

Etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll use fake classes

organization

# rubocop:disable RSpec/EmptyLineAfterSubject
# Bug in rubocop-rspec
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line too, since this is fixed now 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mrcasals
Copy link
Copy Markdown
Contributor

Same as in #3491, can @decidim/product approve this? 😄

@agustibr agustibr force-pushed the feature/user_needs_tos_accepted branch 3 times, most recently from 25190e6 to d6a96f7 Compare May 31, 2018 15:08
@agustibr
Copy link
Copy Markdown
Contributor Author

@mrcasals I've made the changes you requested.

I've created the AnnouncementCell and the TosPageCell that replaces the previous TosPageHelper

@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented Jun 1, 2018

Tests are failing, can you check them @agustibr please?

@agustibr
Copy link
Copy Markdown
Contributor Author

agustibr commented Jun 1, 2018

@mrcasals yes I'll fix them 🪲

@ghost ghost added the status: WIP label Jun 1, 2018
@agustibr agustibr force-pushed the feature/user_needs_tos_accepted branch from af12681 to 4efdd99 Compare June 1, 2018 09:53
@ghost ghost added the status: WIP label Jun 1, 2018
@agustibr
Copy link
Copy Markdown
Contributor Author

agustibr commented Jun 1, 2018

@mrcasals tests are fixed, All checks have passed!

tos_agreement: true,
personal_url: Faker::Internet.url,
about: Faker::Lorem.paragraph(2)
# accepted_tos_version: Time.current
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix it 😓 this sould be accepted_tos_version: organization.tos_version

tos_agreement: true,
personal_url: Faker::Internet.url,
about: Faker::Lorem.paragraph(2)
# accepted_tos_version: Time.current
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐

Copy link
Copy Markdown
Contributor Author

@agustibr agustibr Jun 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before 😿 I'll fix it

include NeedsTosAccepted

before_action :configure_permitted_parameters
helper_method :terms_and_conditions_page
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this to the concern?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes 👍 I'll move it

add_column :decidim_users, :accepted_tos_version, :datetime
Organization.find_each do |organization|
# rubocop:disable Rails/SkipsModelValidations
organization.users.update_all(accepted_tos_version: organization.tos_version)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we set a tos_version value to the organization first?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's a migration at master branch from PR #3491 that sets the tos_version to the organization:
decidim/20180508111640_add_tos_version_to_organization.rb at master · decidim/decidim

mrcasals
mrcasals previously approved these changes Jun 1, 2018
@agustibr agustibr force-pushed the feature/user_needs_tos_accepted branch from 4efdd99 to e5f0178 Compare June 4, 2018 09:25
@ghost ghost added the status: WIP label Jun 4, 2018
@agustibr
Copy link
Copy Markdown
Contributor Author

agustibr commented Jun 4, 2018

@oriolgual the requested changes have been made and the checks have passed

@mrcasals mrcasals merged commit 71e0924 into decidim:master Jun 4, 2018
@agustibr
Copy link
Copy Markdown
Contributor Author

agustibr commented Jun 4, 2018

🎉 thanks!

josepjaume pushed a commit that referenced this pull request Jun 6, 2018
* User must review TOS when updated + AnnouncementCell

* Fix update_organization_tos_version_spec and  user_tos_acceptance_spec

* fix seeds admin and user :accepted_tos_version

* move `helper_method :terms_and_conditions_page` to `NeedsTosAccepted` concern
@agustibr agustibr deleted the feature/user_needs_tos_accepted branch March 22, 2019 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TOS accepted at field for users

4 participants