Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ui/opensnitch/dialogs/ruleseditor/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,5 +894,13 @@ def save_rule(self):

if self.ruleNameEdit.text() == "":
self.rule.name = slugify("%s %s %s" % (self.rule.action, self.rule.operator.type, self.rule.operator.data))
elif self._old_rule_name is not None:
# If the rule name was auto-generated (starts with an action prefix),
# and the action has changed, update the prefix to match the new action.
for old_action in (Config.ACTION_ALLOW, Config.ACTION_DENY, Config.ACTION_REJECT):
if self._old_rule_name.startswith(old_action + "-") and old_action != self.rule.action:
self.rule.name = self.rule.action + self._old_rule_name[len(old_action):]
self.ruleNameEdit.setText(self.rule.name)
break

return True, ""