gui: use the stored CSubNet entry when unbanning

The previous code visualized the `CSubNet` object as string, then
parsed that string back to `CSubNet`. This is sub-optimal given that
the original `CSubNet` object can be used directly instead.

This avoids calling `LookupSubNet()` from the GUI.

Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
This commit is contained in:
Vasil Dimov
2023-03-06 12:49:39 +01:00
parent 40c6c85c05
commit a981af4e6f
3 changed files with 15 additions and 12 deletions

View File

@@ -178,3 +178,9 @@ bool BanTableModel::shouldShow()
{
return priv->size() > 0;
}
bool BanTableModel::unban(const QModelIndex& index)
{
CCombinedBan* ban{static_cast<CCombinedBan*>(index.internalPointer())};
return ban != nullptr && m_node.unban(ban->subnet);
}