Allow changing the visibitly (public/privat) of messages (fixes #625)

This commit is contained in:
Patrick Gansterer 2019-02-11 13:22:54 +01:00
parent c955a6ee40
commit 226192f7cb
6 changed files with 38 additions and 0 deletions

View file

@ -48,6 +48,16 @@ class MessagesController < ApplicationController
end
end
def toggle_private
message = Message.find(params[:id])
if message.can_toggle_private?(current_user)
message.update_attribute :private, !message.private
redirect_to message
else
redirect_to message, alert: I18n.t('messages.toggle_private.not_allowed')
end
end
def thread
@messages = Message.thread(params[:id]).order(:created_at)
end