5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 17:16:22 +00:00

ayuda mutua

This commit is contained in:
f 2019-09-11 13:31:14 -03:00
parent e091560359
commit f431f87a44
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
6 changed files with 28 additions and 1 deletions

View file

@ -104,6 +104,10 @@ module ApplicationHelper
"#{attribute.join('-')}-datalist"
end
def local_channel
"sutty-#{I18n.locale}"
end
private
def post_t(*attribute, post:, type:)

View file

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

View file

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

View file

@ -91,6 +91,7 @@ en:
breadcrumb:
title: 'Your location in Sutty'
logout: Exit
mutual_aid: Mutual aid
collaborations:
collaborate:
submit: Register

View file

@ -97,6 +97,7 @@ es:
breadcrumb:
title: 'Tu ubicación en Sutty'
logout: Salir
mutual_aid: Ayuda mutua
collaborations:
collaborate:
submit: Registrarme

View file

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