From 84bba9062b2c99dbf8bdefe4ffcd7e93180c4f3d Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sat, 30 Nov 2019 01:39:44 -0500 Subject: [PATCH] redirect correctly --- lib/philomena_web/controllers/channel_controller.ex | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/philomena_web/controllers/channel_controller.ex b/lib/philomena_web/controllers/channel_controller.ex index 16de88d3..a4f658d9 100644 --- a/lib/philomena_web/controllers/channel_controller.ex +++ b/lib/philomena_web/controllers/channel_controller.ex @@ -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