# HG changeset patch # User Kim Alvefur # Date 1742640983 -3600 # Node ID 833fa5d08d13610ac1fd6dd793dd3c9da17cce71 # Parent c3a02b00cab27326023e7e0509068bf46ad774a8# Parent 4cfabfbb06919f85d52ab60bad52ac9fe1f52fca Merge 13.0->trunk diff -r c3a02b00cab2 -r 833fa5d08d13 core/usermanager.lua --- a/core/usermanager.lua Mon Mar 17 16:49:22 2025 +0000 +++ b/core/usermanager.lua Sat Mar 22 11:56:23 2025 +0100 @@ -307,7 +307,8 @@ end log("warn", "Usage of legacy is_admin() API, which will be disabled in a future build: %s", debug.traceback()); log("warn", "See https://prosody.im/doc/developers/permissions about the new permissions API"); - return legacy_admin_roles[get_jid_role(jid, host)] or false; + local role = get_jid_role(jid, host); + return role and legacy_admin_roles[role.name] or false; end local function get_users_with_role(role, host) diff -r c3a02b00cab2 -r 833fa5d08d13 plugins/mod_storage_sql.lua --- a/plugins/mod_storage_sql.lua Mon Mar 17 16:49:22 2025 +0000 +++ b/plugins/mod_storage_sql.lua Sat Mar 22 11:56:23 2025 +0100 @@ -866,38 +866,38 @@ success,err = engine:transaction(function() return engine:execute(check_encoding_query, params.database, engine.charset, engine.charset.."_bin"); - end); - if not success then - module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error"); - return false; - end - else - local indices = {}; - engine:transaction(function () - if params.driver == "SQLite3" then - for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do - indices[row[1]] = true; - end - elseif params.driver == "PostgreSQL" then - for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do - indices[row[1]] = true; - end + end); + if not success then + module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error"); + return false; + end + else + local indices = {}; + engine:transaction(function () + if params.driver == "SQLite3" then + for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do + indices[row[1]] = true; end - end) - if indices["prosody_index"] then - if apply_changes then - local success = engine:transaction(function () - return assert(engine:execute([[DROP INDEX "prosody_index";]])); - end); - if not success then - module:log("error", "Failed to delete obsolete index \"prosody_index\""); - return false; - end - else - changes = true; + elseif params.driver == "PostgreSQL" then + for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do + indices[row[1]] = true; end end + end) + if indices["prosody_index"] then + if apply_changes then + local success = engine:transaction(function () + return assert(engine:execute([[DROP INDEX "prosody_index";]])); + end); + if not success then + module:log("error", "Failed to delete obsolete index \"prosody_index\""); + return false; + end + else + changes = true; + end end + end return changes; end diff -r c3a02b00cab2 -r 833fa5d08d13 spec/core_storagemanager_spec.lua --- a/spec/core_storagemanager_spec.lua Mon Mar 17 16:49:22 2025 +0000 +++ b/spec/core_storagemanager_spec.lua Sat Mar 22 11:56:23 2025 +0100 @@ -63,7 +63,7 @@ end assert(hm.activate(test_host, {})); sm.initialize_host(test_host); - assert(mm.load(test_host, "storage_"..backend_config.storage)); + mm.load(test_host, "storage_"..backend_config.storage); describe("key-value stores", function () -- These tests rely on being executed in order, disable any order