Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Add verification page before unregistering from event from email #357 #408

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

lioneltrebuchon
Copy link

No description provided.

@NotSpecial
Copy link
Contributor

Can you maybe provide a screenshot how this unregister page looks like? Does it work with different screen formats?

@NotSpecial
Copy link
Contributor

And additionally, could you provide some reasoning about why we need this functionality in the api?

Copy link
Contributor

@NotSpecial NotSpecial left a comment

Choose a reason for hiding this comment

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

Thank you for your work!

Could you please:

  • Provide some reasoning/background on why this feature is required and implemented like this.
  • Address the comments in this review.
  • Implement tests for the new functionality.

Thank you!

@@ -66,3 +66,6 @@ config.yaml
amivapi/config.yaml
apikeys.yaml
amivapi_storage

# Pycharm
.idea/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: missing newline.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
amivapi/settings.py Outdated Show resolved Hide resolved
amivapi/utils.py Outdated Show resolved Hide resolved
@lioneltrebuchon
Copy link
Author

Implementation of two stage deletion as per
#357

@lioneltrebuchon lioneltrebuchon changed the title Add verification page before unregistering from event from email Add verification page before unregistering from event from email #357 Nov 24, 2019
Copy link
Contributor

@NotSpecial NotSpecial left a comment

Choose a reason for hiding this comment

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

Thank you for your comments. I have some more suggestions.

On a different note: The changes to README.md seem quite unrelated to this PR. Maybe it would be better to open a separate PR for this, to only keep the relevant changes in this one?

README.md Outdated
@@ -102,7 +107,7 @@ Now it's time to configure AMIV API. Create a file `config.py`
ROOT_PASSWORD = 'root'

# MongoDB Configuration
MONGO_HOST = 'mongodb'
MONGO_HOST = 'mongodb' # or 'localhost' if you run the API from Python
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MONGO_HOST = 'mongodb' # or 'localhost' if you run the API from Python
MONGO_HOST = 'mongodb' # or 'localhost' if you run the database locally

Copy link
Author

Choose a reason for hiding this comment

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

Awesome :D

@@ -257,7 +257,6 @@
'description': 'Start time of the event itself. If you define '
'a start time, an end time is required, too.',
'example': '2018-10-17T18:00:00Z',

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to remove this newline? I think it helped the readability.

Copy link
Author

Choose a reason for hiding this comment

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

Ah... for me it is the contrary, it is disturbing, as it should be part of the same json structure on the same level, I thought that it was clearer to keep it on one level.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I would add the line again, as this has nothing to do with the feature of this PR.

@@ -269,7 +268,6 @@
'description': 'End time of the event itself. If you define '
'an end time, a start time is required, too.',
'example': '2018-10-17T22:00:00Z',

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to remove this newline? I think it helped the readability.

Is that ok?
{% else %}
You clicked on a opt-out link of the AMIV at ETHZ student organization. We cannot process your request,
because we either do <em>{not}</em> know the event you wish to unregister from, or your user name, or both.
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats up with the curly braces around the not? Is this some special html syntax I don't know?

Copy link
Author

Choose a reason for hiding this comment

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

Removed XD

@@ -62,11 +62,13 @@
REMOTE_MAILING_LIST_ADDRESS = None
REMOTE_MAILING_LIST_KEYFILE = None
REMOTE_MAILING_LIST_DIR = './' # Use home directory on remote by default
# Signups via email (@email_blueprint.route('/delete_signup/<token>') in email_links.py)
# DEFINITIVE_DELETE = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this commented out? Is it needed?


# SMTP server defaults
API_MAIL = '[email protected]'
API_MAIL_SUBJECT = "[AMIV] {subject}"
SMTP_HOST = 'localhost'
SMTP_HOST = 'localhost' # None in case you want to accept that no mails get sent (local testing)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, I understand the comment now. But what exactly is the problem with leaving it on localhost for local testing? Is there some error?

Copy link
Author

Choose a reason for hiding this comment

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

I removed it because I haven't been able to reproduce any error.

@NotSpecial
Copy link
Contributor

Note: I have updated this branch to the new master branch, make sure to pull before working on it again.

temparus and others added 4 commits December 1, 2019 13:56
When users are upgraded to members via LDAP, subscribe them to the newsletter.
Newsletter settings of already imported members are not touched.

Closes amiv-eth#400
- Add documentation for position field.
- Add position field to post response.

Fixes amiv-eth#405 
Fixes amiv-eth#410
Even if FCFS in enabled, admins should be allowed to force a signup to be accepted.
This worked as intended for PATCH requests already, and now also works for POST.

Fixes amiv-eth#381
@lioneltrebuchon lioneltrebuchon force-pushed the master branch 2 times, most recently from ad77da0 to 09ff765 Compare December 1, 2019 16:55
@lioneltrebuchon
Copy link
Author

@temparus I believe the base is working. Haven't changed much.

Copy link
Contributor

@NotSpecial NotSpecial left a comment

Choose a reason for hiding this comment

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

Thank you for your continued work!

Most of all, thank you for adding tests. However, I am currently having a hard time to understand what is being tested, and what the expected functionality is, so I can't really judge whether the tests are sufficient or not.

Please try to:

  • break the tests up a little,
  • explain the expected behavior more.

This would be greatly appreciated!

I have a few nitpicks here and there as well, please try to address them, too.

# Create a network so that the api service can later be connected to the db
docker network create --driver overlay backend

#
Copy link
Contributor

Choose a reason for hiding this comment

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

This line seems to serve no purpose?

@@ -169,30 +174,31 @@ docker service create \
--name amivapi-cron --network backend \
--config source=amivapi_config,target=/api/config.py \
amiveth/amivapi amivapi cron --continuous

# To attach your command line to the docker instance, use
docker attach amivapi... # Use tab completion to find the name of the service
Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking about it: This is not at all how one should use a docker service, and not really required for the amivapi, so I don't think we should recommend this here.

return "Unknown token"

# Verify if user confirmed
# definitive = request.args.get('DEFINITIVE_DELETE')
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this comment serve any purpose?

@@ -257,7 +257,6 @@
'description': 'Start time of the event itself. If you define '
'a start time, an end time is required, too.',
'example': '2018-10-17T18:00:00Z',

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I would add the line again, as this has nothing to do with the feature of this PR.

self.api.get('/delete_signup/%s' % token, status_code=302)
self.api.get('/eventsignups/%s' % signup['_id'], status_code=200)
self.api.get('/delete_signup/%s' % token, status_code=200)
self.api.post('/delete_confirmed/%s' % token, status_code=302)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for adding tests ... unfortunately I do not understand at all what is going on here, and why e.g. in this last line a status code 302 is expected.

As the flow is now considerably more complicated, please either:

  • Split this test up into multiple tests that are clear about which part is being tested.
  • If it is impossible to split them up, please modify the docstring to explain the expected behavior.

The more I look at it, the more I think our original tests here are already confusing. I would greatly appreciate it if you could try to split the tests up a bit more to make them more understandable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants