5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-02 07:14:16 +00:00

Merge branch 'issue-15154' into 'rails'

Issue #15154

See merge request sutty/sutty!249
This commit is contained in:
fauno 2024-05-18 14:23:56 +00:00
commit 00df57a096
2 changed files with 34 additions and 32 deletions

View file

@ -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?

View file

@ -4,7 +4,7 @@
%p.lead= t('.help')
- if policy(Site).new?
= link_to t('sites.new.title'), new_site_path,
class: 'btn btn-secondary'
class: 'btn btn-secondary'
%section.col
- if @sites.empty?
@ -15,39 +15,42 @@
%tbody
- @sites.each do |site|
- next unless site.jekyll?
%tr
%td
%h2
- if policy(site).show?
= link_to site.title, site_posts_path(site, locale: site.default_locale)
= link_to site.title,
site_posts_path(site,
locale: site.default_locale)
- else
= site.title
%p.lead= site.description
%br
= link_to t('.visit'), site.url, class: 'btn btn-secondary'
- if current_usuarie.rol_for_site(site).temporal?
= render 'components/btn_base',
text: t('sites.invitations.accept'),
path: site_usuaries_accept_invitation_path(site),
title: t('help.sites.invitations.accept'),
class: 'btn-secondary'
= render 'components/btn_base',
text: t('sites.invitations.reject'),
path: site_usuaries_reject_invitation_path(site),
title: t('help.sites.invitations.reject'),
class: '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')
= render 'sites/build', site: site
= render 'sites/moderation_queue', site: site
- 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)
.d-flex.flex-row
= link_to t('.visit'), site.url, class: 'btn btn-secondary'
- if current_usuarie.rol_for_site(site).temporal?
= render 'components/btn_base',
text: t('sites.invitations.accept'),
path: site_usuaries_accept_invitation_path(site),
title: t('help.sites.invitations.accept'),
class: 'btn-secondary'
= render 'components/btn_base',
text: t('sites.invitations.reject'),
path: site_usuaries_reject_invitation_path(site),
title: t('help.sites.invitations.reject'),
class: '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')
= render 'sites/build', site: site
= render 'sites/moderation_queue', site: site
- 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)