Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPA-6687: Pagenames should be stored with _ and not spaces #1802

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion components/match2/commons/match_group_input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function MatchGroupInput.mergeRecordWithOpponent(record, opponent)
return {
displayname = player.displayName,
flag = player.flag,
name = player.pageName,
name = player.pageName and player.pageName:gsub(' ', '_') or nil,
}
end)
end
Expand Down
5 changes: 4 additions & 1 deletion components/match2/commons/player_ext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ function PlayerExt.populatePageName(player)
or globalVars:get(player.displayName .. '_page')
or player.displayName and mw.ext.TeamLiquidIntegration.resolve_redirect(player.displayName)

player.pageIsResolved = player.pageName and true or nil
if player.pageName then
player.pageIsResolved = true
player.pageName = player.pageName:gsub(' ', '_')
end
end

--[[
Expand Down
5 changes: 3 additions & 2 deletions components/opponent/commons/opponent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ function Opponent.toName(opponent)
return TeamTemplate.getPageName(opponent.template)
elseif Opponent.typeIsParty(opponent.type) then
local pageNames = Array.map(opponent.players, function(player)
return player.pageName or player.displayName
local pageName = player.pageName or player.displayName
return pageName and pageName:gsub(' ', '_') or nil
end)
return table.concat(pageNames, ' / ')
else -- opponent.type == Opponent.literal
Expand Down Expand Up @@ -379,7 +380,7 @@ function Opponent.toLpdbStruct(opponent)
for playerIndex, player in ipairs(opponent.players) do
local prefix = 'p' .. playerIndex

players[prefix] = player.pageName
players[prefix] = player.pageName and player.pageName:gsub(' ', '_') or nil
players[prefix .. 'dn'] = player.displayName
players[prefix .. 'flag'] = player.flag
players[prefix .. 'team'] = player.team and Opponent.toName({type = Opponent.team, template = player.team}) or nil
Expand Down