Skips creating duplicate poltergeists for the same user. (#1925)
This commit is contained in:
parent
1ca485f1a8
commit
5b6d7a3040
|
@ -393,13 +393,19 @@ function handle_create_poltergeist (event)
|
|||
return 404;
|
||||
end
|
||||
|
||||
local username = generate_uuid();
|
||||
store_username(room, user_id, username)
|
||||
|
||||
create_poltergeist_occupant(
|
||||
room, string.sub(username,0,8), name, avatar, status);
|
||||
|
||||
return 200;
|
||||
local username = get_username(room, user_id);
|
||||
if (username ~= nil
|
||||
and have_poltergeist_occupant(room, string.sub(username, 0, 8))) then
|
||||
log("warn", "poltergeist for username:%s already in the room:%s",
|
||||
username, room_name);
|
||||
return 202;
|
||||
else
|
||||
username = generate_uuid();
|
||||
store_username(room, user_id, username);
|
||||
create_poltergeist_occupant(
|
||||
room, string.sub(username, 0, 8), name, avatar, status);
|
||||
return 200;
|
||||
end
|
||||
end
|
||||
|
||||
--- Handles request for updating poltergeists status
|
||||
|
|
Loading…
Reference in New Issue