Code Style

Fixed an indent.
This commit is contained in:
JacobTech 2023-05-21 19:58:14 -04:00
parent 39c5401cdb
commit 5e3dca5ce2
2 changed files with 108 additions and 110 deletions

View File

@ -65,8 +65,8 @@ public static class Luski
public static AppConfig Config = null!; public static AppConfig Config = null!;
public static bool HasAccessToChannel(long User, long Channel, params ServerPermissions[] RequiredPerms) public static bool HasAccessToChannel(long User, long Channel, params ServerPermissions[] RequiredPerms)
{ {
long[] UserRoleIDList = Tables.Users.Read(Users.Roles, Users.ID.CreateParameter(User)); long[] UserRoleIDList = Tables.Users.Read(Users.Roles, Users.ID.CreateParameter(User));
List<ServerPermissions> pp = RequiredPerms.ToList(); List<ServerPermissions> pp = RequiredPerms.ToList();
if (!pp.Contains(ServerPermissions.ViewChannels)) pp.Add(ServerPermissions.ViewChannels); if (!pp.Contains(ServerPermissions.ViewChannels)) pp.Add(ServerPermissions.ViewChannels);
@ -166,7 +166,7 @@ public static bool HasAccessToChannel(long User, long Channel, params ServerPerm
if (GoodPerms.Count == pp.Count) return true; if (GoodPerms.Count == pp.Count) return true;
return false; return false;
} }
public static class Info public static class Info
{ {

View File

@ -23,8 +23,7 @@ public class SocketMessageController : ControllerBase
try try
{ {
if (!this.CanTokenRequest(out long ID, out IActionResult? toc) && toc != null) return toc; if (!this.CanTokenRequest(out long ID, out IActionResult? toc) && toc != null) return toc;
if (Luski.HasAccessToChannel(ID, data.ChannelID, ServerPermissions.SendMessages)) if (!Luski.HasAccessToChannel(ID, data.ChannelID, ServerPermissions.SendMessages)) return this.ResponseToResult(new HTTPResponse() { error = ErrorCode.Forbidden });
{
Luski.Snowflake Id = Luski.Snowflake.GenerateSnowflake(Tables.Channels.Read(Channels.Epoch, Channels.ID.CreateParameter(data.ChannelID))); Luski.Snowflake Id = Luski.Snowflake.GenerateSnowflake(Tables.Channels.Read(Channels.Epoch, Channels.ID.CreateParameter(data.ChannelID)));
ChannelType type = Tables.Channels.Read(Channels.Type, Channels.ID.CreateParameter(data.ChannelID)); ChannelType type = Tables.Channels.Read(Channels.Type, Channels.ID.CreateParameter(data.ChannelID));
MessageEvent MessageEvent = new() MessageEvent MessageEvent = new()
@ -49,7 +48,6 @@ public class SocketMessageController : ControllerBase
Type = DataType.MessageCreate, Type = DataType.MessageCreate,
Data = MessageEvent Data = MessageEvent
}, Array.Empty<long>()); }, Array.Empty<long>());
}
Response.StatusCode = 201; Response.StatusCode = 201;
return null!; return null!;
} }