2016-02-17 12:26:21 +01:00
|
|
|
class MessagegroupsController < ApplicationController
|
|
|
|
def index
|
2023-05-12 13:01:12 +02:00
|
|
|
@messagegroups = Messagegroup.order('name')
|
2016-02-17 12:26:21 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def join
|
|
|
|
@messagegroup = Messagegroup.find(params[:id])
|
|
|
|
@messagegroup.users << current_user
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to messagegroups_url, notice: I18n.t('messagegroups.join.notice')
|
2016-02-17 12:26:21 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def leave
|
|
|
|
@messagegroup = Messagegroup.find(params[:id])
|
|
|
|
@messagegroup.users.destroy(current_user)
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to messagegroups_url, notice: I18n.t('messagegroups.leave.notice')
|
2016-02-17 12:26:21 +01:00
|
|
|
end
|
|
|
|
end
|