Conversation
|
Hi, I have doubts about the implementation of the part related to rejecting an invitation. Let's me explain the two possible cases: 1. An administrator invites an already registered user. In this case we will always have the 2. An administrator invites a non existing user. In this case, the user is invited to sign up to the platform before accept the meeting invitation. So:
/cc @decidim/product @decidim/lot-core |
|
I don't have much insight, I delegates the logic to the
We could make a list of invitations, so after a sign up we redirect the user to this list (if there's any invitations, of course). From there, the user can accept or reject those invitations (one button for each action). This would work for already existing users too. This way we don't need to send tokens through the invitation email. Does this sound good to you @rbngzlv? Would this fix your problem? If this works for you please ensure @decidim/product is OK with this 😄 |
|
@mrcasals the idea of a central place to manage the invitations sounds good to me, but I think that it is out of the scope of this PR and also doesn't solve the "problem" with the unregistered users refusing invitations, because, an unregistered user will not be able to access that page. |
|
@rbngzlv when we invite a user to the platform we create the
I don't think that's out of the scope of the PR, but I'll leave that to @decidim/product. A list of meeting invitations is the best I can come up with, if you have another layout/workflow in mind then go ahead 😄 |
146888f to
8cebc8d
Compare
8cebc8d to
0a693d9
Compare
|
@rbngzlv @decidim/lot-core ready to check, no? |
|
@isaacmg410 you'll need to rebase/update your branch with |
|
@mrcasals master merged. |
|
Hi @decidim/lot-core, it is the fifth time that we merge master to resolve conflicts, can you review this PR please? /cc @decidim/lot-mods |
|
@decidim/lot-core @mrcasals can you review this, please? |
| <%= t("decidim.meetings.admin.invite_join_meeting_mailer.invite.invited_you_to_join_a_meeting", invited_by: @resource.invited_by.name, application: @resource.organization.name) %> | ||
| </p> | ||
|
|
||
| <p><%= link_to t("devise.mailer.invitation_instructions.decline"), accept_invitation_url(@resource, invitation_token: @token, invite_redirect: Decidim::EngineRouter.main_proxy(@opts[:meeting].component).decline_invitation_meeting_registration_path(meeting_id: @opts[:meeting], participatory_space_id: @opts[:meeting].component.participatory_space), host: @resource.organization.host) %></p> |
There was a problem hiding this comment.
What does Decidim::EngineRouter.main_proxy(@opts[:meeting].component) do? Have you tried with decidim_meetings.decline_invitation_meeting_registration_path?
There was a problem hiding this comment.
I think that we can't access to decicim_meetings because this mailer is executed inside devise.
| <%= t("decidim.meetings.admin.invite_join_meeting_mailer.invite.invited_you_to_join_a_meeting", invited_by: @resource.invited_by.name, application: @resource.organization.name) %> | ||
|
|
||
| <%= t("devise.mailer.invitation_instructions.decline") %>: | ||
| <% accept_invitation_url(@resource, invitation_token: @token, invite_redirect: Decidim::EngineRouter.main_proxy(@opts[:meeting].component).decline_invitation_meeting_registration_path(meeting_id: @opts[:meeting], participatory_space_id: @opts[:meeting].component.participatory_space), host: @resource.organization.host) %> |
There was a problem hiding this comment.
I think that we can't access to decicim_mettings because this mailer is executed inside devise.
|
|
||
| it "has an association with one agenda" do | ||
| subject.agenda = build(:agenda) | ||
| subject.agenda = build_stubbed(:agenda) |
There was a problem hiding this comment.
Oh, I didn't know about this build_stubbed method! 👏
|
Code looks good, build was green. Conflicts were only on the CHANGELOG file. @rbngzlv sorry for the delay reviewing this! Please, if this happens again, ping me privately on Gitter and I'll check it ASAP. GitHub notifications are far from great and it's not the first time some important things slip my filters 😞 Also, even though the PR is merged, can you check this comment? #3632 Thanks! |
| end | ||
|
|
||
| def can_decline_invitation? | ||
| meeting.registrations_enabled? && invitation.present? |
There was a problem hiding this comment.
What happens if the registrations are disabled after I get the invite? Does it appear as pending?
There was a problem hiding this comment.
Yes, it appears as pending. If the user don't respond the invitation before the registrations are closed, he can't either accept it or reject it, her time to interact is over. I think that for admin is important to know that the user doesn't respond in time.
| # | ||
| class InvitesController < Admin::ApplicationController | ||
| def index | ||
| enforce_permission_to :read_invites, :meeting, meeting: meeting |
There was a problem hiding this comment.
How come we have a single meeting if we are at the index?
There was a problem hiding this comment.
This action is listing the invites for a single meeting. Is a screen in the admin panel.
There was a problem hiding this comment.
Oh, it's listing invites, not meetings. Sorry, my bad 🤦♂️
| Decidim::Meetings::AdminLog::InvitePresenter | ||
| end | ||
|
|
||
| def self.user_collection(user) |
There was a problem hiding this comment.
This is needed for the data portability export.
| <% end %> | ||
| </tbody> | ||
| </table> | ||
| <%= paginate @invites, theme: "decidim" %> |
There was a problem hiding this comment.
Can you use decidim_paginate?
There was a problem hiding this comment.
I can't localize an admin view using decidim_paginate, I need to include the Decidim::PaginateHelper in Decidim::Admin::ApplicationHelper, is this helper new? Do you want this?
There was a problem hiding this comment.
Oh, I thought we were using it everywhere, don't worry then.
| def filter_by_search(invites) | ||
| return invites if @query.blank? | ||
| invites.joins(:user).where( | ||
| User.arel_table[:name].lower.matches("%#{@query}%").or(User.arel_table[:email].lower.matches("%#{@query}%")) |
There was a problem hiding this comment.
We should check that the users are from the same organization
There was a problem hiding this comment.
Not sure about this, the query is loading only the users related to the invites being filtered, right?
SELECT "decidim_meetings_invites".*
FROM "decidim_meetings_invites"
INNER JOIN "decidim_users" ON "decidim_users"."id" = "decidim_meetings_invites"."decidim_user_id"
WHERE "decidim_meetings_invites"."decidim_meeting_id" = $1
AND (LOWER("decidim_users"."name") ILIKE '%ab%' OR LOWER("decidim_users"."email") ILIKE '%ab%')
LIMIT $2 OFFSET $3
There was a problem hiding this comment.
Oh, you're right, no need for that!
|
It was merged while I was reviewing 😞 @rbngzlv please create a new PR with the fixes. |
|
Whoops, sorry :( |
|
Thank you both for the review. I'll check all comments, discuss here if needed, and create a new PR, don't worry. |
|
Hi @oriolgual and @mrcasals can you check my comments, please? |
|
Done @rbngzlv |
🎩 What? Why?
Allow users to accept or reject invitations to meetings, and allow admins to see their status.
📌 Related Issues
📋 Subtasks
CHANGELOGentry📷 Screenshots