mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Fix bug with already used colors being used first for new tx labels (#2077)
* Extend list of available tx label colors * Ensure unknown label colors are given the least priority closes #2072 * Remove new label colors
This commit is contained in:
@@ -115,7 +115,7 @@ namespace BTCPayServer.Controllers
|
|||||||
"#ff7619",
|
"#ff7619",
|
||||||
"#84b6eb",
|
"#84b6eb",
|
||||||
"#5319e7",
|
"#5319e7",
|
||||||
"#000000",
|
"#cdcdcd",
|
||||||
"#cc317c",
|
"#cc317c",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,7 +173,12 @@ namespace BTCPayServer.Controllers
|
|||||||
allColors
|
allColors
|
||||||
.GroupBy(k => k)
|
.GroupBy(k => k)
|
||||||
.OrderBy(k => k.Count())
|
.OrderBy(k => k.Count())
|
||||||
.ThenBy(k => Array.IndexOf(LabelColorScheme, k.Key))
|
.ThenBy(k => {
|
||||||
|
var indexInColorScheme = Array.IndexOf(LabelColorScheme, k.Key);
|
||||||
|
|
||||||
|
// Ensures that any label color which may not be in our label color scheme is given the least priority
|
||||||
|
return indexInColorScheme == -1 ? double.PositiveInfinity : indexInColorScheme;
|
||||||
|
})
|
||||||
.First().Key;
|
.First().Key;
|
||||||
walletBlobInfo.LabelColors.Add(addlabel, chosenColor);
|
walletBlobInfo.LabelColors.Add(addlabel, chosenColor);
|
||||||
await WalletRepository.SetWalletInfo(walletId, walletBlobInfo);
|
await WalletRepository.SetWalletInfo(walletId, walletBlobInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user