From 1128f0495436777e95af4fcccbafde34ea4845db Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Mar 2024 12:42:15 -0300 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20mostrar=20los=20botones=20de=20invit?= =?UTF-8?q?aci=C3=B3n=20en=20una=20sola=20l=C3=ADnea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/sites/index.haml | 53 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/app/views/sites/index.haml b/app/views/sites/index.haml index ed87180a..f771be3b 100644 --- a/app/views/sites/index.haml +++ b/app/views/sites/index.haml @@ -29,29 +29,30 @@ = site.title %p.lead= site.description %br - = link_to t('.visit'), site.url, class: 'btn btn-secondary' - - if rol.temporal - = button_to t('sites.invitations.accept'), - site_usuaries_accept_invitation_path(site), - method: :patch, - title: t('help.sites.invitations.accept'), - class: 'btn btn-secondary' - = button_to t('sites.invitations.reject'), - site_usuaries_reject_invitation_path(site), - method: :patch, - title: t('help.sites.invitations.reject'), - class: 'btn btn-secondary' - - else - - if policy(site).show? - = render 'layouts/btn_with_tooltip', - tooltip: t('help.sites.edit_posts'), - type: 'success', - link: site_path(site), - text: t('sites.posts') - - if policy(SiteUsuarie.new(site, current_usuarie)).index? - = render 'layouts/btn_with_tooltip', - tooltip: t('usuaries.index.help.self'), - text: t('usuaries.index.title'), - type: 'info', - link: site_usuaries_path(site) - = render 'sites/build', site: site + .d-flex.flex-row + = link_to t('.visit'), site.url, class: 'btn btn-secondary' + - if rol.temporal + = button_to t('sites.invitations.accept'), + site_usuaries_accept_invitation_path(site), + method: :patch, + title: t('help.sites.invitations.accept'), + class: 'btn btn-secondary' + = button_to t('sites.invitations.reject'), + site_usuaries_reject_invitation_path(site), + method: :patch, + title: t('help.sites.invitations.reject'), + class: 'btn btn-secondary' + - else + - if policy(site).show? + = render 'layouts/btn_with_tooltip', + tooltip: t('help.sites.edit_posts'), + type: 'success', + link: site_path(site), + text: t('sites.posts') + - if policy(SiteUsuarie.new(site, current_usuarie)).index? + = render 'layouts/btn_with_tooltip', + tooltip: t('usuaries.index.help.self'), + text: t('usuaries.index.title'), + type: 'info', + link: site_usuaries_path(site) + = render 'sites/build', site: site From 316b192d1e2bb5b504d9edfbba43de206c74404f Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Mar 2024 12:42:26 -0300 Subject: [PATCH 2/2] fix: poder aceptar o rechazar invitaciones #15154 --- app/policies/site_usuarie_policy.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/policies/site_usuarie_policy.rb b/app/policies/site_usuarie_policy.rb index f07dc1c9..31e98cfe 100644 --- a/app/policies/site_usuarie_policy.rb +++ b/app/policies/site_usuarie_policy.rb @@ -36,8 +36,7 @@ class SiteUsuariePolicy end def accept_invitation? - su = site_usuarie - (usuarie? || invitade?) && su.usuarie.rol_for_site(su.site).temporal + !!site_usuarie.usuarie.rol_for_site(site_usuarie.site)&.temporal end def reject_invitation?