FEATURE: go to inbox after archiving a message

This commit is contained in:
Sam
2016-01-12 15:49:05 +11:00
parent 06b5798fb9
commit 65e808b26d
3 changed files with 40 additions and 7 deletions

View File

@ -281,6 +281,9 @@ class TopicsController < ApplicationController
def toggle_archive_message(archive)
topic = Topic.find(params[:id].to_i)
group_id = nil
group_ids = current_user.groups.pluck(:id)
if group_ids.present?
allowed_groups = topic.allowed_groups
@ -289,6 +292,7 @@ class TopicsController < ApplicationController
GroupArchivedMessage.where(group_id: id, topic_id: topic.id).destroy_all
if archive
group_id = id
GroupArchivedMessage.create!(group_id: id, topic_id: topic.id)
end
end
@ -302,7 +306,12 @@ class TopicsController < ApplicationController
end
end
render nothing: true
if group_id
name = Group.find_by(id: group_id).try(:name)
render_json_dump(group_name: name)
else
render nothing: true
end
end
def bookmark