Skip to content

Commit e8a8925

Browse files
committed
Merge release-v1.0.0
2 parents 8f86d2e + 7c3b543 commit e8a8925

File tree

156 files changed

+3748
-1158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+3748
-1158
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ obj
5050
/LearningHub.Nhs.WebUI.AutomatedUiTests/appsettings.Development.json
5151
/OpenAPI/LearningHub.Nhs.OpenApi/appsettings.Development.json
5252
/OpenAPI/LearningHub.Nhs.OpenApi/web.config
53+
/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj.user
54+
/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj.user

AdminUI/LearningHub.Nhs.AdminUI/Controllers/UserGroupController.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public async Task<IActionResult> AddUsersToUserGroup(int userGroupId, string use
257257
var vr = await this.userGroupService.AddUsersToUserGroup(userGroupId, userIdList);
258258
if (vr.IsValid)
259259
{
260+
this.ClearUserCachedPermissions(userIdList);
260261
return this.Json(new
261262
{
262263
success = true,
@@ -527,5 +528,16 @@ public async Task<IActionResult> UserGroupCatalogues(int id)
527528

528529
return this.PartialView("_UserGroupCatalogues", catalogues);
529530
}
531+
532+
private void ClearUserCachedPermissions(string userIdList)
533+
{
534+
if (!string.IsNullOrWhiteSpace(userIdList))
535+
{
536+
foreach (var userId in userIdList.Split(","))
537+
{
538+
_ = Task.Run(async () => { await this.userService.ClearUserCachedPermissions(int.Parse(userId)); });
539+
}
540+
}
541+
}
530542
}
531543
}

AdminUI/LearningHub.Nhs.AdminUI/Helpers/LearningActivityHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ public static string GetResourceTypeVerb(this MyLearningDetailedItemViewModel my
116116
return "Played " + GetDurationText(myLearningDetailedItemViewModel.ActivityDurationSeconds * 1000);
117117
case ResourceTypeEnum.WebLink:
118118
return "Visited";
119+
case ResourceTypeEnum.Html:
120+
return "Viewed";
121+
case ResourceTypeEnum.Case:
122+
return "Accessed";
123+
case ResourceTypeEnum.Assessment:
124+
return "Accessed";
119125
default:
120126
return string.Empty;
121127
}

AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
9090
<PackageReference Include="IdentityModel" Version="4.4.0" />
9191
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
92-
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.31" />
92+
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.40" />
9393
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
9494
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
9595
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />

AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml

Lines changed: 399 additions & 366 deletions
Large diffs are not rendered by default.

AdminUI/LearningHub.Nhs.AdminUI/Views/User/_UserLearningRecord.cshtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<tr>
3737
<td>
3838
<span class="nhsuk-u-text-align-left table-content-spacing">
39-
@if (userLearningRecord.ResourceReferenceId > 0 && userLearningRecord.VersionStatusId != (int?)VersionStatusEnum.Unpublished)
39+
@if (userLearningRecord.IsCurrentResourceVersion && userLearningRecord.ResourceReferenceId > 0 && userLearningRecord.VersionStatusId != (int?)VersionStatusEnum.Unpublished)
4040
{
4141
<span>
4242
<a class="learning-td" href="@resourceUrl/@userLearningRecord.ResourceReferenceId" target="_blank">@userLearningRecord.Title</a><br />
@@ -46,7 +46,8 @@
4646
else
4747
{
4848
<span class="learning-td">
49-
@userLearningRecord.Title
49+
@userLearningRecord.Title<br />
50+
<b>Last @LearningActivityHelper.GetResourceTypeVerb(userLearningRecord).ToLower() on : </b> @userLearningRecord.ActivityDate.DateTime.ToString("dd MMM yyyy") at @userLearningRecord.ActivityDate.DateTime.ToShortTimeString()<br />
5051
</span>
5152

5253
}

LearningHub.Nhs.WebUI/Configuration/FindwiseSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ public class FindwiseSettings
1414
/// Gets or sets the CatalogueSearchPageSize.
1515
/// </summary>
1616
public int CatalogueSearchPageSize { get; set; }
17+
18+
/// <summary>
19+
/// Gets or sets the AllCatalogueSearchPageSize.
20+
/// </summary>
21+
public int AllCatalogueSearchPageSize { get; set; }
1722
}
1823
}

LearningHub.Nhs.WebUI/Configuration/Settings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,5 +245,10 @@ public Settings()
245245
/// Gets or sets the MediaKindSettings.
246246
/// </summary>
247247
public MediaKindSettings MediaKindSettings { get; set; } = new MediaKindSettings();
248+
249+
/// <summary>
250+
/// Gets or sets AllCataloguePageSize.
251+
/// </summary>
252+
public int AllCataloguePageSize { get; set; }
248253
}
249254
}

LearningHub.Nhs.WebUI/Controllers/Api/ContributeController.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,18 @@ public async Task<ActionResult> PublishResourceVersionAsync([FromBody] PublishVi
349349
{
350350
if (associatedResource.ResourceType != ResourceTypeEnum.Scorm && associatedResource.ResourceType != ResourceTypeEnum.Html)
351351
{
352+
try
353+
{
352354
var obsoleteFiles = await this.resourceService.GetObsoleteResourceFile(publishViewModel.ResourceVersionId);
353355
if (obsoleteFiles != null && obsoleteFiles.Any())
354356
{
355-
await this.fileService.PurgeResourceFile(null, obsoleteFiles);
357+
_ = Task.Run(async () => { await this.fileService.PurgeResourceFile(null, obsoleteFiles); });
356358
}
359+
}
360+
catch (Exception ex)
361+
{
362+
this.Logger.LogError($"File Archive Error: {ex.Message}", $"ResourceVersionId -{publishViewModel.ResourceVersionId}");
363+
}
357364
}
358365
}
359366

@@ -707,8 +714,8 @@ private async Task RemoveBlockCollectionFiles(int resourceVersionId, BlockCollec
707714
{
708715
foreach (var oldblock in existingImages)
709716
{
710-
var entry = newBlocks.FirstOrDefault(x => x.BlockType == BlockType.Media && x.MediaBlock != null && x.MediaBlock.MediaType == MediaType.Image && x.MediaBlock.Image != null && (x.MediaBlock?.Image?.File?.FileId == oldblock.MediaBlock?.Image?.File?.FileId || x.MediaBlock?.Image?.File?.FilePath == oldblock.MediaBlock?.Image?.File?.FilePath));
711-
if (entry == null)
717+
var entry = newBlocks.FirstOrDefault(x => x.BlockType == BlockType.Media && x.MediaBlock != null && x.MediaBlock.MediaType == MediaType.Image && x.MediaBlock.Image != null && (x.MediaBlock?.Image?.File?.FileId == oldblock.MediaBlock?.Image?.File?.FileId || x.MediaBlock?.Image?.File?.FilePath == oldblock.MediaBlock?.Image?.File?.FilePath));
718+
if (entry == null)
712719
{
713720
filePaths.Add(oldblock?.MediaBlock?.Image?.File?.FilePath);
714721
}
@@ -790,8 +797,10 @@ private async Task RemoveBlockCollectionFiles(int resourceVersionId, BlockCollec
790797
_ = Task.Run(async () => { await this.fileService.PurgeResourceFile(null, deleteList); });
791798
}
792799
}
793-
catch
800+
catch (Exception ex)
794801
{
802+
var param = new object[] { resourceVersionId, existingResource, newResource };
803+
this.Logger.LogError($"BlockCollection Archive Error: {ex.Message}", param);
795804
}
796805
}
797806

LearningHub.Nhs.WebUI/Controllers/Api/ResourceController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace LearningHub.Nhs.WebUI.Controllers.Api
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.Linq;
56
using System.Threading.Tasks;
67
using LearningHub.Nhs.Models.Enums;
78
using LearningHub.Nhs.Models.Resource;
@@ -105,7 +106,6 @@ public async Task<IActionResult> DownloadResourceAndRecordActivity(int resourceV
105106
ActivityStatus = ActivityStatusEnum.Completed,
106107
};
107108
await this.activityService.CreateResourceActivityAsync(activity);
108-
109109
return this.File(file.Content, file.ContentType, fileName);
110110
}
111111
else
@@ -566,9 +566,9 @@ public async Task<ActionResult> DeleteResourceProviderAsync(int resourceVersionI
566566
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
567567
[HttpPost]
568568
[Route("ArchiveResourceFile")]
569-
public ActionResult ArchiveResourceFile(List<string> filePaths)
569+
public ActionResult ArchiveResourceFile(IEnumerable<string> filePaths)
570570
{
571-
_ = Task.Run(async () => { await this.fileService.PurgeResourceFile(null, filePaths); });
571+
_ = Task.Run(async () => { await this.fileService.PurgeResourceFile(null, filePaths.ToList()); });
572572
return this.Ok();
573573
}
574574

0 commit comments

Comments
 (0)