From 4f8a243a83c0cb77e03e4a75ac5a8baf7c202763 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Thu, 9 Feb 2023 11:54:28 -0800
Subject: [PATCH] All UEDIT sysop command to pull up deleted users by alias or
 number

Requires the latest v3.20a for sytem.matchuserdata() to support deleted and
inactive user record searching.

This is part of the fix for the issue described in issue #513 where the
UEDIT sysop command was falling back (displaying/editing) user #1 because
the sysop-specified user number or alias was not an active user account.

The fallback to display/editing user #1 still happens, but first we try
really hard to find the user that the sysop specified as an argument to
the UEDIT command.
---
 exec/str_cmds.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/exec/str_cmds.js b/exec/str_cmds.js
index 2763690dca..c17df36678 100644
--- a/exec/str_cmds.js
+++ b/exec/str_cmds.js
@@ -379,10 +379,15 @@ function str_cmds(str)
 		}
 		if(word=="UEDIT") {
 			// Prompts for syspass
-			str=str.substr(5);
-			if(str.length)
-				bbs.edit_user(bbs.finduser(get_arg(str, "User Alias")));
-			else
+			str=str.substr(5).trim();
+			if(str.length) {
+				var usernum = parseInt(str, 10);
+				if(isNaN(usernum) || usernum < 1 || usernum > system.lastuser)
+					usernum = bbs.finduser(str);
+				if(usernum < 1)
+					usernum = system.matchuserdata(U_ALIAS, str, /* deleted users? */true);
+				bbs.edit_user(usernum);
+			} else
 				bbs.edit_user();
 			return;
 		}
-- 
GitLab