Commit 6eda5588 authored by Peter van der meulen's avatar Peter van der meulen

Only update user when user status changes

parent 374eb760
...@@ -106,7 +106,6 @@ defmodule SnugglesApp.Accounts do ...@@ -106,7 +106,6 @@ defmodule SnugglesApp.Accounts do
{:ok, updated_user } = update_user(user, eve_user) {:ok, updated_user } = update_user(user, eve_user)
Discord.manage_alliance_permissions(updated_user.discord_id, user.access, updated_user.access) Discord.manage_alliance_permissions(updated_user.discord_id, user.access, updated_user.access)
manage_corp_discord_permissions(updated_user, user.corp_id, updated_user.corp_id) manage_corp_discord_permissions(updated_user, user.corp_id, updated_user.corp_id)
Discord.update_user_name(updated_user)
{:ok, updated_user} {:ok, updated_user}
end end
......
...@@ -27,6 +27,9 @@ defmodule SnugglesApp.Application do ...@@ -27,6 +27,9 @@ defmodule SnugglesApp.Application do
# Start the seperate Discord.Post supervisor # Start the seperate Discord.Post supervisor
SnugglesApp.Discord.start_post_supervisor SnugglesApp.Discord.start_post_supervisor
# Start the sepearete AccountConsumer supervisor
# SnugglesApp.RabbitService.start_account_consumer
end end
# Tell Phoenix to update the endpoint configuration # Tell Phoenix to update the endpoint configuration
......
...@@ -39,10 +39,12 @@ defmodule SnugglesApp.Discord do ...@@ -39,10 +39,12 @@ defmodule SnugglesApp.Discord do
def manage_alliance_permissions(discord_id, _, true) do def manage_alliance_permissions(discord_id, _, true) do
add_default_role_to_user(discord_id) add_default_role_to_user(discord_id)
Discord.update_user_name(updated_user)
end end
def manage_alliance_permissions(discord_id, _, false) do def manage_alliance_permissions(discord_id, _, false) do
remove_default_role_from_user(String.to_integer(discord_id)) remove_default_role_from_user(String.to_integer(discord_id))
Discord.update_user_name(updated_user)
end end
defp add_default_role_to_user(discord_id) do defp add_default_role_to_user(discord_id) do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment