Skip to content

Commit

Permalink
refactor(Database): rename the function
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenonEl committed Jan 11, 2025
1 parent 5616fe7 commit 2d42d9d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Database/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ UPDATE MutedContacts
}
}

public static async Task<List<long>> GetContactUserTGIds(int userId)
public static async Task<List<long>> GetAllContactUserTGIds(int userId)
{
var contactUserIds = new List<long>();
var TelegramIDs = new List<long>();
Expand Down
2 changes: 1 addition & 1 deletion TelegramBot/Menu/Contacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static async Task UnMuteUserContact(ITelegramBotClient botClient, Update

public static async Task ViewContacts(ITelegramBotClient botClient, Update update)
{
var contactUserTGIds = await CoreDB.GetContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.CallbackQuery!.Message!.Chat.Id));
var contactUserTGIds = await CoreDB.GetAllContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.CallbackQuery!.Message!.Chat.Id));
var contactUsersInfo = new List<string>();

foreach (var contactUserId in contactUserTGIds)
Expand Down
4 changes: 2 additions & 2 deletions TelegramBot/States/MuteUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task ProcessState(ITelegramBotClient botClient, Update update, Canc
int contactId;
if (int.TryParse(update.Message!.Text, out contactId))
{
List<long> allowedIds = await CoreDB.GetContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));
List<long> allowedIds = await CoreDB.GetAllContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));
string name = DBforGetters.GetUserNameByID(contactId);
if (name == "" || !allowedIds.Contains(DBforGetters.GetTelegramIDbyUserID(contactId)))
{
Expand All @@ -62,7 +62,7 @@ await botClient.SendMessage(chatId, string.Format(Config.GetResourceString("Will
{
string link = update.Message.Text!;
contactId = DBforGetters.GetContactIDByLink(link);
List<long> allowedIds = await CoreDB.GetContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));
List<long> allowedIds = await CoreDB.GetAllContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));

if (contactId == -1 || !allowedIds.Contains(DBforGetters.GetTelegramIDbyUserID(contactId)))
{
Expand Down
4 changes: 2 additions & 2 deletions TelegramBot/States/UnMuteUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task ProcessState(ITelegramBotClient botClient, Update update, Canc
int contactId;
if (int.TryParse(update.Message!.Text, out contactId))
{
List<long> allowedIds = await CoreDB.GetContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));
List<long> allowedIds = await CoreDB.GetAllContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));
string name = DBforGetters.GetUserNameByID(contactId);

if (name == "" || !allowedIds.Contains(DBforGetters.GetTelegramIDbyUserID(contactId)))
Expand All @@ -62,7 +62,7 @@ await botClient.SendMessage(chatId, string.Format(Config.GetResourceString("Will
{
string link = update.Message.Text!;
contactId = DBforGetters.GetContactIDByLink(link);
List<long> allowedIds = await CoreDB.GetContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));
List<long> allowedIds = await CoreDB.GetAllContactUserTGIds(DBforGetters.GetUserIDbyTelegramID(update.Message.Chat.Id));

if (contactId == -1 || !allowedIds.Contains(DBforGetters.GetTelegramIDbyUserID(contactId)))
{
Expand Down

0 comments on commit 2d42d9d

Please sign in to comment.