From 906bb46954998bb94ddf03494934c8bd5d54fd50 Mon Sep 17 00:00:00 2001 From: Noah Schechter <100018299+noah-schechter@users.noreply.github.com> Date: Fri, 27 Dec 2024 17:38:07 +0000 Subject: [PATCH] Cleanup type checking --- platform/lib/platform/updates.ex | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/platform/lib/platform/updates.ex b/platform/lib/platform/updates.ex index ab7cb216b..86ba747b6 100644 --- a/platform/lib/platform/updates.ex +++ b/platform/lib/platform/updates.ex @@ -308,27 +308,12 @@ defmodule Platform.Updates do @doc """ Helper API function that takes attribute change information and uses it to create an Update changeset. Requires 'explanation' to be in attrs. """ - def change_from_media_creation(media, user_or_token) - - def change_from_media_creation(%Media{} = media, %User{} = user) do + def change_from_media_creation(%Media{} = media, user_or_token) when is_struct(user_or_token, User) or is_struct(user_or_token, APIToken) do change_update( %Update{}, media, - user, - %{ - "type" => :create - } - ) - end - - def change_from_media_creation(%Media{} = media, %APIToken{} = api_token) do - change_update( - %Update{}, - media, - api_token, - %{ - "type" => :create - } + user_or_token, + %{"type" => :create} ) end