mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 17:16:22 +00:00
ayuda mutua
This commit is contained in:
parent
e091560359
commit
f431f87a44
6 changed files with 28 additions and 1 deletions
|
@ -104,6 +104,10 @@ module ApplicationHelper
|
|||
"#{attribute.join('-')}-datalist"
|
||||
end
|
||||
|
||||
def local_channel
|
||||
"sutty-#{I18n.locale}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def post_t(*attribute, post:, type:)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'open-uri'
|
||||
|
||||
# Usuarie de la plataforma
|
||||
class Usuarie < ApplicationRecord
|
||||
devise :invitable, :database_authenticatable,
|
||||
|
@ -11,6 +13,8 @@ class Usuarie < ApplicationRecord
|
|||
has_many :roles
|
||||
has_many :sites, through: :roles
|
||||
|
||||
after_create :register_in_lounge!, if: Rails.env.production?
|
||||
|
||||
def name
|
||||
email.split('@', 2).first
|
||||
end
|
||||
|
@ -34,4 +38,15 @@ class Usuarie < ApplicationRecord
|
|||
increment_failed_attempts
|
||||
lock_access! if attempts_exceeded? && !access_locked?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# XXX: Tenemos que hacer esto en línea porque necesitamos la
|
||||
# contraseña y no la queremos dejar registrada por error en ningún
|
||||
# lado
|
||||
def register_in_lounge!
|
||||
Thread.new do
|
||||
open("https://chat.#{Site.domain}/#{ENV['LOUNGE']}/#{email}/#{password}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
%li.breadcrumb-item= crumb
|
||||
|
||||
%ul.navbar-nav
|
||||
%li
|
||||
%li.nav-item
|
||||
= link_to t('.mutual_aid'), mutual_aid_url(local_channel)
|
||||
%li.nav-item
|
||||
= link_to t('.logout'), destroy_usuarie_session_path,
|
||||
method: :delete, role: 'button', class: 'btn btn-primary'
|
||||
|
|
|
@ -91,6 +91,7 @@ en:
|
|||
breadcrumb:
|
||||
title: 'Your location in Sutty'
|
||||
logout: Exit
|
||||
mutual_aid: Mutual aid
|
||||
collaborations:
|
||||
collaborate:
|
||||
submit: Register
|
||||
|
|
|
@ -97,6 +97,7 @@ es:
|
|||
breadcrumb:
|
||||
title: 'Tu ubicación en Sutty'
|
||||
logout: Salir
|
||||
mutual_aid: Ayuda mutua
|
||||
collaborations:
|
||||
collaborate:
|
||||
submit: Registrarme
|
||||
|
|
|
@ -5,6 +5,10 @@ Rails.application.routes.draw do
|
|||
|
||||
root 'application#index'
|
||||
|
||||
direct :mutual_aid do |channel|
|
||||
"https://chat.#{Site.domain}/?channels=#{channel}"
|
||||
end
|
||||
|
||||
get 'markdown', to: 'application#markdown'
|
||||
|
||||
# XXX Mantenemos solo esta ruta acá porque form_for no reconoce @site
|
||||
|
|
Loading…
Reference in a new issue