Skip to content

Commit

Permalink
fix move users still allowing moves to restricted channels (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
moni-dz authored Oct 22, 2023
1 parent ca784e2 commit 25106f0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion crates/robbb_commands/src/commands/move_users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ pub async fn move_users(

if target_channel == ctx.channel_id() {
abort_with!("You're already here!")
} else if target_channel == config.channel_showcase || target_channel == config.channel_feedback
} else if target_channel == config.channel_showcase
|| target_channel == config.channel_feedback
|| target_channel == config.channel_announcements
|| target_channel == config.channel_rules
{
abort_with!("I won't move you there");
}
Expand Down
4 changes: 4 additions & 0 deletions crates/robbb_util/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub struct Config {
pub roles_color: Vec<RoleId>,

pub category_mod_private: ChannelId,
pub channel_announcements: ChannelId,
pub channel_rules: ChannelId,
pub channel_showcase: ChannelId,
pub channel_feedback: ChannelId,
pub channel_modlog: ChannelId,
Expand Down Expand Up @@ -50,6 +52,8 @@ impl Config {
.map(|x| Ok(RoleId(x.trim().parse()?)))
.collect::<anyhow::Result<_>>()?,
category_mod_private: ChannelId(parse_required_env_var("CATEGORY_MOD_PRIVATE")?),
channel_announcements: ChannelId(parse_required_env_var("CHANNEL_ANNOUNCEMENTS")?),
channel_rules: ChannelId(parse_required_env_var("CHANNEL_RULES")?),
channel_showcase: ChannelId(parse_required_env_var("CHANNEL_SHOWCASE")?),
channel_feedback: ChannelId(parse_required_env_var("CHANNEL_FEEDBACK")?),
channel_modlog: ChannelId(parse_required_env_var("CHANNEL_MODLOG")?),
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
export $(cat .env)
'';
# Extra inputs can be added here
packages = commonArgs.nativeBuildInputs ++ commonArgs.buildInputs;
packages = [ pkgs.darwin.apple_sdk.frameworks.Security ] ++ commonArgs.nativeBuildInputs ++ commonArgs.buildInputs;
};
});
}
6 changes: 5 additions & 1 deletion gen-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ EOF

# clean the env
unset mod intern mute col start
unset feedback showcase techsupport modcat botstuff modlog botmod botlog humantrafficking polls
unset announcements rules feedback showcase techsupport modcat botstuff modlog botmod botlog humantrafficking polls


#
Expand Down Expand Up @@ -65,6 +65,8 @@ channels=$(curl -s -X GET \
# note: posix sh doesn't support escape codes in variables
while IFS=$(printf '\t') read -r id name; do
case $name in
announcements) announcements=$id;;
rules) rules=$id;;
server-feedback) feedback=$id;;
showcase) showcase=$id;;
tech-support) techsupport=$id;;
Expand All @@ -91,6 +93,8 @@ export ROLE_HELPER=$intern
export ROLE_MUTE=$mute
export ROLES_COLOR=$col
export CATEGORY_MOD_PRIVATE=$modcat
export CHANNEL_ANNOUNCEMENTS=$announcements
export CHANNEL_RULES=$rules
export CHANNEL_SHOWCASE=$showcase
export CHANNEL_FEEDBACK=$feedback
export CHANNEL_MODLOG=$modlog
Expand Down

0 comments on commit 25106f0

Please sign in to comment.