redirect correctly

This commit is contained in:
byte[] 2019-11-30 01:39:44 -05:00
parent 1e1b0054d0
commit 84bba9062b

View file

@ -25,6 +25,15 @@ defmodule PhilomenaWeb.ChannelController do
if user, do: Channels.clear_notification(channel, user)
redirect(conn, external: channel.url)
redirect(conn, external: url(channel))
end
defp url(%{type: "LivestreamChannel", short_name: short_name}),
do: "http://www.livestream.com/#{short_name}"
defp url(%{type: "PicartoChannel", short_name: short_name}),
do: "https://picarto.tv/#{short_name}"
defp url(%{type: "PiczelChannel", short_name: short_name}),
do: "https://piczel.tv/watch/#{short_name}"
defp url(%{type: "TwitchChannel", short_name: short_name}),
do: "https://www.twitch.tv/#{short_name}"
end