Consume ticket overview capabilities separately
This commit is contained in:
@@ -24,7 +24,6 @@ namespace FasdDesktopUi.Basics.Services
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private const string TicketAndServiceRequestsEnabledKey = "TicketAndServiceRequestsEnabled";
|
||||
private const bool TicketAndServiceRequestsEnabledDefault = true;
|
||||
private readonly ITicketOverviewCommunicationSource _communicationSource;
|
||||
private static readonly string[] OverviewKeys = new[]
|
||||
@@ -339,12 +338,11 @@ namespace FasdDesktopUi.Basics.Services
|
||||
|
||||
_isDemo = communication.IsDemo();
|
||||
|
||||
var requestedKeys = scope == TileScope.Personal
|
||||
? OverviewKeys.Concat(new[] { TicketAndServiceRequestsEnabledKey }).ToArray()
|
||||
: OverviewKeys;
|
||||
var rawCounts = await communication.GetTicketOverviewCounts(requestedKeys, scope == TileScope.Role).ConfigureAwait(false);
|
||||
var result = await communication.GetTicketOverviewCounts(OverviewKeys, scope == TileScope.Role).ConfigureAwait(false);
|
||||
var rawCounts = result?.Counts;
|
||||
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
var ticketAndServiceRequestsEnabled = TicketAndServiceRequestsEnabledDefault;
|
||||
var ticketAndServiceRequestsEnabled =
|
||||
result?.Capabilities?.TicketAndServiceRequestsEnabled ?? TicketAndServiceRequestsEnabledDefault;
|
||||
|
||||
if (rawCounts != null)
|
||||
{
|
||||
@@ -353,13 +351,6 @@ namespace FasdDesktopUi.Basics.Services
|
||||
if (string.IsNullOrWhiteSpace(kvp.Key))
|
||||
continue;
|
||||
|
||||
if (string.Equals(kvp.Key, TicketAndServiceRequestsEnabledKey, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (scope == TileScope.Personal)
|
||||
ticketAndServiceRequestsEnabled = _isDemo || kvp.Value > 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
counts[kvp.Key] = Math.Max(0, kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user