2019-11-29 20:29:01 +01:00
|
|
|
defmodule PhilomenaWeb.Topic.ReadController do
|
|
|
|
import Plug.Conn
|
|
|
|
use PhilomenaWeb, :controller
|
|
|
|
|
|
|
|
alias Philomena.Forums.Forum
|
|
|
|
alias Philomena.Topics
|
|
|
|
|
2019-12-14 20:46:50 +01:00
|
|
|
plug PhilomenaWeb.CanaryMapPlug, create: :show
|
2020-01-11 05:20:19 +01:00
|
|
|
|
|
|
|
plug :load_and_authorize_resource,
|
|
|
|
model: Forum,
|
|
|
|
id_name: "forum_id",
|
|
|
|
id_field: "short_name",
|
|
|
|
persisted: true
|
2019-11-29 20:29:01 +01:00
|
|
|
|
2019-12-14 20:46:50 +01:00
|
|
|
plug PhilomenaWeb.LoadTopicPlug, show_hidden: true
|
|
|
|
|
|
|
|
def create(conn, _params) do
|
2019-11-29 20:29:01 +01:00
|
|
|
user = conn.assigns.current_user
|
|
|
|
|
2019-12-14 20:46:50 +01:00
|
|
|
Topics.clear_notification(conn.assigns.topic, user)
|
2019-11-29 20:29:01 +01:00
|
|
|
|
|
|
|
send_resp(conn, :ok, "")
|
|
|
|
end
|
2019-12-14 20:46:50 +01:00
|
|
|
end
|