Frontend: Add support for setting if channel logs should be public

This commit is contained in:
mrkubax10 2023-09-18 10:15:02 +02:00
parent 94696bc4f1
commit 0a60329617

View File

@ -287,6 +287,7 @@ sub handlePath {
$addChannel.="<option value=\"$id\">$name</option>";
}
$addChannel.="</select><br />";
$addChannel.="<input name=\"public\" type=\"checkbox\" />Public<br />";
$addChannel.="<input type=\"submit\" value=\"Add\" />";
$addChannel.="</form>";
}
@ -497,6 +498,10 @@ sub handlePath {
frontend::sendBadRequest($aClient, "Server ID required");
return 1;
}
if(!defined($parameters{"public"}) || length($parameters{"public"})==0) {
frontend::sendBadRequest($aClient, "Public required");
return 1;
}
my $query = $aConnection->prepare(qq(select name from servers where id=?;));
$query->execute($parameters{"server"});
@ -524,8 +529,8 @@ sub handlePath {
$lastID = $row[0]+1;
}
$query = $aConnection->prepare(qq(insert into channels values($lastID, ?, ?, 1);));
$query->execute($parameters{"server"}, $parameters{"channel"});
$query = $aConnection->prepare(qq(insert into channels values($lastID, ?, ?, ?);));
$query->execute($parameters{"server"}, $parameters{"channel"}, $parameters{"public"});
my $actionQueue = logger::getActionQueueByServerName($serverName);
push(@$actionQueue, "JOIN", $parameters{"channel"});