-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invitation for booth responsibles #2535
Conversation
5b91899
to
98a57e0
Compare
Codecov Report
@@ Coverage Diff @@
## GSoC19 #2535 +/- ##
==========================================
- Coverage 82.58% 75.94% -6.65%
==========================================
Files 146 146
Lines 4767 4847 +80
==========================================
- Hits 3937 3681 -256
- Misses 830 1166 +336
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## GSoC19 #2535 +/- ##
=========================================
+ Coverage 82.21% 82.31% +0.1%
=========================================
Files 146 147 +1
Lines 4773 4795 +22
=========================================
+ Hits 3924 3947 +23
+ Misses 849 848 -1
Continue to review full report at Codecov.
|
6a122c5
to
f094553
Compare
@rahul2240 you also need to fix the lint offenses and tests (in general it is a good practice to run the test locally before sending the PR 😉) |
@Ana06 I have 1 lint only for 105 lines used whose limit is 100, so can you tell me what i should do and i dont know what error is breaking the other tests as it is something related to Selenium::WebDriver::Error::UnknownError: so i send a PR to ask about it. |
but you didn't ask 🤣 It is fine. Let's check if I can help you. 😉
When a class gets to big, it is normally because there are things on it that doesn't belong there. So, you need to split things out (moving model related logic to the models, using concerns, introduce new controllers, etc.). invite is currently in the User model, but it is not necessarily related to the user. It is maybe time to put everything related with the invitation (in both user model and booth controller) out and together.
This is not related to your PR, it is failing in other PRs as well. We need to fix it, but not as part of this PR. |
@Ana06 I forgot to ask :P, Thanks for the help, For the upcoming work that I mentioned I am creating an invitation controller (for admins only) and model also to handle things related to model. But for booths I thought it would be better if I use invitation in booths controller itself as it is the only feature that user going to have, related to invitation. |
@rahul2240 let's discuss a bit what you are trying to accomplish. What's the plan? The following is more of a conversation starter than a final plan.
|
3873e20
to
b17738f
Compare
@differentreality @Ana06 I have removed some commits to make this PR small and related to 1 thing only. I will create other PR for an unsubscribing link in the invitation email and customized invitation message. |
@differentreality User can invite any number of people. I can add minItem: 2 at the form to only allow 2 users to invite at a time. |
0a8de7c
to
5bf6d63
Compare
@@ -9,6 +9,8 @@ class ApplicationController < ActionController::Base | |||
# Ensure every controller authorizes resource or skips authorization (skip_authorization_check) | |||
check_authorization unless: :devise_controller? | |||
|
|||
before_action :devise_configure_permitted_parameters, if: :devise_controller? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devise_parameter_sanitizer.permit(:accept_invitation, keys: [:username])
used to add username field in the registration page for invited users otherwise only password and password confirmation fields were present.
5bf6d63
to
9e1df67
Compare
How is this going to happen exactly? In your steps you mention that you will create an unconfirmed user. How is this user going to be related to a booth? |
@differentreality unconfirmed user's id will be used to associate that user with the booth using
If a user registers then there is no problem. |
app/helpers/invite_helper.rb
Outdated
|
||
emails_array.each do |email| | ||
new_user = User.find_by(email: email) | ||
if new_user.nil? || !new_user.confirmed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!new_user.confirmed?
that's not bulletproof. It's possible that we have unconfirmed users (when using) but the users are actually able to log in and don't require invitation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@differentreality we can add user's "last_sign_in_at", if it is nil then we can send invitations again, is that okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is already a user record, why do we need to check anything else?
I mean there are a few ways we can go with this approach and make the feature more useful and meaningful, but what is currently being implemented is pretty basic, so I don't think we should add any more functionality than what is absolutely necessary, unless you plan on documenting (and adding tests) for the more advanced scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@differentreality alright, for now, I will keep it simple but will work on improving it later in other PR.
571fd76
to
a1a7857
Compare
@rahul2240 please rebase The tests are not very thorough here :/ We should revisit them soon. |
ef9ae35
to
0500a24
Compare
0500a24
to
5bab917
Compare
Sure. |
It is added so that user can enter email ids of other users, who they want to invite to become booth responsible.
email validation and input as tags is added using selectize
Devise invitable gem is required to invite users.
User will enter email of users to invite to become booth responsible, which will create a user in User db with that email and a new booth request will be created.
5bab917
to
29c15c5
Compare
This isn't right though! Active users used to be something completely different, and now they are the ones who logged in during the last 3 months. We need to actually get all active (as in not disabled) users for our selection field. Do you want to submit a PR for that in master, or should I? |
OK let's get this in as a starting point, and work on it a bit more later on to add more possibilities
|
Related to #2527
Checklist
master
branch.Need
Whenever a conference is organized, people submit booth request for that conference. It is possible to add responsibles to booth but only registered users can be added as responsibles.
With this PR, booth submitter will be able to invite unregistered users to join the app and handle the booth. Making it easier for the submitter to add users as responsibles only one time rather than waiting for users to first join and then adding them as responsibles.
Workflow
new booth view
mail
Registartion page after accepting link
After registration my booth option available
columns added to User