arreglo certificados de registro

This commit is contained in:
2026-07-23 12:37:06 +02:00
parent 33c9c03822
commit dd31460cf0
25 changed files with 1370 additions and 119 deletions

View File

@@ -122,6 +122,9 @@
.inbox-activity-cell {
width: 9.25rem;
max-width: 12rem;
overflow: hidden;
text-overflow: ellipsis;
}
.inbox-action-cell {
@@ -226,6 +229,7 @@
<option value="all">Todas</option>
<option value="new">Nuevas / sin leer</option>
<option value="updated">Actualizaciones del ciudadano</option>
<option value="receiver">Actividad OAAF</option>
</select>
</div>
@@ -355,7 +359,7 @@
<td class="inbox-channel-cell" title="@(report.ContextName ?? report.ContextId ?? string.Empty)"><span class="d-inline-block text-truncate">@(report.ContextName ?? report.ContextId ?? "-")</span></td>
<td>@FormatDate(report.CreationDate)</td>
<td class="inbox-activity-cell">@FormatCitizenActivity(report)</td>
<td class="inbox-activity-cell">@FormatReceiverActivity(report)</td>
<td class="inbox-activity-cell" title="@GetReceiverActivityTitle(report)">@FormatReceiverActivity(report)</td>
<td>
<span class="badge @GetStatusBadgeCss(report)">
@GetStatusLabel(report)
@@ -432,7 +436,7 @@
{
<div class="border rounded p-3 mb-2 @(comment.IsNew ? "border-success bg-success-subtle" : "bg-light")">
<div class="d-flex flex-column flex-md-row justify-content-between gap-2 small text-muted mb-2">
<strong>@GetCommentAuthorLabel(comment.Type)</strong>
<strong>@GetCommentAuthorLabel(comment)</strong>
<span>@FormatDate(comment.CreationDate)</span>
</div>
@if (comment.IsNew)
@@ -482,6 +486,10 @@
<span class="small text-muted">@FormatDate(file.CreationDate)</span>
</div>
<div class="small text-muted">@FormatBytes(file.Size) @(string.IsNullOrWhiteSpace(file.ContentType) ? string.Empty : $" - {file.ContentType}")</div>
@if (!string.IsNullOrWhiteSpace(file.AuthorName))
{
<div class="small text-muted">Añadido por @file.AuthorName</div>
}
@if (file.IsNew)
{
<span class="badge bg-success mt-2">Nuevo</span>
@@ -703,6 +711,36 @@
return;
}
var selectedReports = Reports
.Where(report => SelectedIds.Contains(report.Id))
.Where(CanUseReport)
.OrderBy(report => report.Progressive ?? 0)
.ToList();
if (selectedReports.Count == 0)
{
SetStatus("No hay denuncias accesibles seleccionadas para importar.", "alert-warning");
return;
}
var reportsFromOtherOwners = selectedReports
.Where(report => report.RequiresOwnerConfirmation)
.ToArray();
if (reportsFromOtherOwners.Length > 0)
{
var ownerSummary = string.Join(
Environment.NewLine,
reportsFromOtherOwners.Select(report =>
$"Denuncia #{report.Progressive ?? 0}: propiedad de {report.OwnerUsername}."));
var confirmed = await JSRuntime.InvokeAsync<bool>(
"confirm",
$"Vas a importar denuncias propiedad de otros usuarios de tu grupo:{Environment.NewLine}{Environment.NewLine}{ownerSummary}{Environment.NewLine}{Environment.NewLine}¿Deseas continuar?");
if (!confirmed)
{
return;
}
}
ImportBusy = true;
var importedCount = 0;
var errors = new List<string>();
@@ -710,18 +748,6 @@
try
{
var selectedReports = Reports
.Where(report => SelectedIds.Contains(report.Id))
.Where(CanUseReport)
.OrderBy(report => report.Progressive ?? 0)
.ToList();
if (selectedReports.Count == 0)
{
SetStatus("No hay denuncias accesibles seleccionadas para importar.", "alert-warning");
return;
}
using var busy = Busy.Show(
"Importando denuncias",
$"Descargando y procesando {selectedReports.Count} denuncia(s) desde GlobalLeaks.",
@@ -739,7 +765,10 @@
try
{
var result = await ApiDenuncias.ImportReportAsync(report, CancellationToken.None);
var result = await ApiDenuncias.ImportReportAsync(
report,
report.RequiresOwnerConfirmation,
CancellationToken.None);
importedCount += result.ImportedCount;
errors.AddRange(result.Errors.Select(error => $"#{report.Progressive ?? 0}: {error}"));
if (result.Warnings is not null)
@@ -898,7 +927,10 @@
filtered = Filter switch
{
"new" => filtered.Where(report => string.IsNullOrWhiteSpace(report.AccessDate) || string.Equals(report.Status, "new", StringComparison.OrdinalIgnoreCase)),
"updated" => filtered.Where(report => report.CitizenHasNewActivity || report.Updated),
"updated" => filtered.Where(report =>
report.CitizenHasNewActivity ||
(!report.ActivityAnalyzed && report.Updated)),
"receiver" => filtered.Where(report => report.ReceiverHasNewActivity),
_ => filtered
};
@@ -1144,7 +1176,9 @@
var receiverDate = FormatOptionalDate(report.ReceiverLastActivity);
if (!string.IsNullOrWhiteSpace(receiverDate))
{
return receiverDate;
return string.IsNullOrWhiteSpace(report.ReceiverLastActivityAuthorName)
? receiverDate
: $"{receiverDate} · {report.ReceiverLastActivityAuthorName}";
}
if (!report.ActivityAnalyzed)
@@ -1155,6 +1189,16 @@
return "Sin actividad";
}
private static string GetReceiverActivityTitle(ReportDto report)
{
if (string.IsNullOrWhiteSpace(report.ReceiverLastActivityAuthorName))
{
return FormatReceiverActivity(report);
}
return $"Ultima actividad OAAF realizada por {report.ReceiverLastActivityAuthorName}.";
}
private static string FormatBytes(long? value)
{
if (value is null or <= 0)
@@ -1176,11 +1220,13 @@
return $"{bytes / 1024d / 1024d:0.#} MB";
}
private static string GetCommentAuthorLabel(string? type)
=> IsWhistleblowerActivityType(type)
private static string GetCommentAuthorLabel(ReportCommentDto comment)
=> IsWhistleblowerActivityType(comment.Type)
? "Denunciante"
: IsReceiverActivityType(type)
? "Receptor"
: IsReceiverActivityType(comment.Type)
? string.IsNullOrWhiteSpace(comment.AuthorName)
? "Gestor OAAF"
: $"Gestor OAAF: {comment.AuthorName}"
: "Comentario";
private static bool IsWhistleblowerActivityType(string? value)
@@ -1298,7 +1344,7 @@
};
private static bool CanUseReport(ReportDto report)
=> report.Accessible != false && !IsReceiverOnlyUpdate(report);
=> report.Accessible != false;
private static bool IsReceiverOnlyUpdate(ReportDto report)
=> report.AlreadyInGestiona &&
@@ -1313,11 +1359,6 @@
return "GlobalLeaks indica que esta denuncia no es accesible para este usuario.";
}
if (IsReceiverOnlyUpdate(report))
{
return "La actividad nueva procede de OAAF/gestor; no se importa como actualizacion del ciudadano.";
}
return null;
}
@@ -1328,11 +1369,6 @@
return "GlobalLeaks indica que esta denuncia no es accesible para este usuario.";
}
if (IsReceiverOnlyUpdate(report))
{
return "Actividad interna detectada; puedes consultar el detalle, pero no importarla como actualizacion.";
}
return "Consulta mensajes y ficheros. GlobalLeaks puede marcar la denuncia como leida.";
}
@@ -1395,7 +1431,7 @@
if (IsReceiverOnlyUpdate(report))
{
return "table-secondary report-row-disabled";
return "table-secondary";
}
if (report.AlreadyInGestiona)