Added owner icon and removed ban/kick/pin buttons for owner if he/she is in list.
This commit is contained in:
@@ -13,7 +13,7 @@ using LightlessSync.WebAPI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Globalization;
|
||||
|
||||
namespace LightlessSync.UI.Components.Popup;
|
||||
namespace LightlessSync.UI;
|
||||
|
||||
public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
@@ -126,7 +126,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
}
|
||||
else
|
||||
{
|
||||
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.ScrollY);
|
||||
var tableFlags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp;
|
||||
if (pairs.Count > 10) tableFlags |= ImGuiTableFlags.ScrollY;
|
||||
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 4, tableFlags);
|
||||
if (table)
|
||||
{
|
||||
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 3);
|
||||
@@ -141,12 +143,14 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
foreach (var pair in groupedPairs.OrderBy(p =>
|
||||
{
|
||||
if (p.Value == null) return 10;
|
||||
if (p.Value.Value.IsModerator()) return 0;
|
||||
if (p.Value.Value.IsPinned()) return 1;
|
||||
if (string.Equals(p.Key.UserData.UID, GroupFullInfo.OwnerUID, StringComparison.Ordinal)) return 0;
|
||||
if (p.Value.Value.IsModerator()) return 1;
|
||||
if (p.Value.Value.IsPinned()) return 2;
|
||||
return 10;
|
||||
}).ThenBy(p => p.Key.GetNote() ?? p.Key.UserData.AliasOrUID, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
using var tableId = ImRaii.PushId("userTable_" + pair.Key.UserData.UID);
|
||||
var isUserOwner = string.Equals(pair.Key.UserData.UID, GroupFullInfo.OwnerUID, StringComparison.Ordinal);
|
||||
|
||||
ImGui.TableNextColumn(); // alias/uid/note
|
||||
var note = pair.Key.GetNote();
|
||||
@@ -165,18 +169,23 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
UiSharedService.ColorText(onlineText, boolcolor);
|
||||
|
||||
ImGui.TableNextColumn(); // special flags
|
||||
if (pair.Value != null && (pair.Value.Value.IsModerator() || pair.Value.Value.IsPinned()))
|
||||
if (pair.Value != null && (pair.Value.Value.IsModerator() || pair.Value.Value.IsPinned() || isUserOwner))
|
||||
{
|
||||
if (pair.Value.Value.IsModerator())
|
||||
{
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UserShield);
|
||||
_uiSharedService.IconText(FontAwesomeIcon.UserShield, UIColors.Get("LightlessPurple"));
|
||||
UiSharedService.AttachToolTip("Moderator");
|
||||
}
|
||||
if (pair.Value.Value.IsPinned())
|
||||
if (pair.Value.Value.IsPinned() && !isUserOwner)
|
||||
{
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Thumbtack);
|
||||
UiSharedService.AttachToolTip("Pinned");
|
||||
}
|
||||
if (isUserOwner)
|
||||
{
|
||||
_uiSharedService.IconText(FontAwesomeIcon.Crown, UIColors.Get("LightlessYellow"));
|
||||
UiSharedService.AttachToolTip("Owner");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -198,7 +207,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
if (_isOwner || (pair.Value == null || (pair.Value != null && !pair.Value.Value.IsModerator())))
|
||||
if (pair.Value == null || pair.Value != null && !pair.Value.Value.IsModerator() && !isUserOwner)
|
||||
{
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Thumbtack))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user