From 0c3b08d98a58bc80e5ea2539d5432f9c32d96c6f Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Tue, 7 Oct 2025 09:04:06 -0700 Subject: [PATCH 1/4] CU-868fwmkkw Fixing issue with disabled/deletes user showing on map. --- Core/Resgrid.Services/SubscriptionsService.cs | 4 ++-- .../Controllers/v4/MappingController.cs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Core/Resgrid.Services/SubscriptionsService.cs b/Core/Resgrid.Services/SubscriptionsService.cs index f16ebbea..eefab529 100644 --- a/Core/Resgrid.Services/SubscriptionsService.cs +++ b/Core/Resgrid.Services/SubscriptionsService.cs @@ -99,10 +99,10 @@ public async Task GetPlanCountsForDepartmentAsync(int depar var response = await client.ExecuteAsync(request); if (response.StatusCode == HttpStatusCode.NotFound) - return null; + return new DepartmentPlanCount(); if (response.Data == null) - return null; + return new DepartmentPlanCount(); return response.Data.Data; } diff --git a/Web/Resgrid.Web.Services/Controllers/v4/MappingController.cs b/Web/Resgrid.Web.Services/Controllers/v4/MappingController.cs index 8d6417f8..2e93087c 100644 --- a/Web/Resgrid.Web.Services/Controllers/v4/MappingController.cs +++ b/Web/Resgrid.Web.Services/Controllers/v4/MappingController.cs @@ -102,7 +102,8 @@ public async Task> GetMapDataAndMarkers() var callTypes = await _callsService.GetCallTypesForDepartmentAsync(DepartmentId); var personnelStates = await _actionLogsService.GetLastActionLogsForDepartmentAsync(DepartmentId); - var personnelNames = await _departmentsService.GetAllPersonnelNamesForDepartmentAsync(DepartmentId); + //var personnelNames = await _departmentsService.GetAllPersonnelNamesForDepartmentAsync(DepartmentId); + var people = await _usersService.GetUserGroupAndRolesByDepartmentIdAsync(DepartmentId, false, false, false); var personnelLocations = await _usersService.GetLatestLocationsForDepartmentPersonnelAsync(DepartmentId); var personnelLocationTTL = await _departmentSettingsService.GetMappingPersonnelLocationTTLAsync(DepartmentId); @@ -373,9 +374,9 @@ public async Task> GetMapDataAndMarkers() } } - if (personnelNames != null && personnelNames.Any()) + if (people != null && people.Any()) { - foreach (var person in personnelNames) + foreach (var person in people) { if (!await _authorizationService.CanUserViewPersonLocationViaMatrixAsync(person.UserId, UserId, DepartmentId)) continue; From 1aed9bffb006c68ffa84d5e3e9958add817dce57 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Thu, 23 Oct 2025 13:26:16 -0700 Subject: [PATCH 2/4] CU-868g38fhz Adding in a changelog --- .github/workflows/changerawr-sync.yml | 73 +++++++++++++++++++ .../MongoRepository.cs | 1 - 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/changerawr-sync.yml diff --git a/.github/workflows/changerawr-sync.yml b/.github/workflows/changerawr-sync.yml new file mode 100644 index 00000000..15dd6587 --- /dev/null +++ b/.github/workflows/changerawr-sync.yml @@ -0,0 +1,73 @@ +name: Sync PR to Changerawr + +on: + pull_request: + types: + - closed + branches: + - master + +jobs: + post-to-changerawr: + # Only run if the PR was merged (not just closed) + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Post to Changerawr API + uses: actions/github-script@v7 + env: + CHANGERAWR_API_KEY: ${{ secrets.CHANGERAWR_API_KEY }} + CHANGERAWR_PROJECT_ID: ${{ secrets.CHANGERAWR_PROJECT_ID }} + with: + script: | + const prBody = context.payload.pull_request.body || ''; + const prNumber = context.payload.pull_request.number; + const prTitle = context.payload.pull_request.title; + const prUrl = context.payload.pull_request.html_url; + + // Prepare the payload for Changerawr API + const payload = { + notes: prBody, + metadata: { + pr_number: prNumber, + pr_title: prTitle, + pr_url: prUrl, + merged_at: context.payload.pull_request.merged_at, + merged_by: context.payload.pull_request.merged_by.login + } + }; + + try { + const response = await fetch( + `https://clog.resgrid.com/api/projects/${process.env.CHANGERAWR_PROJECT_ID}/changelog`, + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${process.env.CHANGERAWR_API_KEY}` + }, + body: JSON.stringify(payload) + } + ); + + if (!response.ok) { + const errorText = await response.text(); + throw new Error(`Changerawr API request failed: ${response.status} - ${errorText}`); + } + + const result = await response.json(); + console.log('Successfully posted to Changerawr:', result); + + // Optionally, comment on the PR with confirmation + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: '✅ Change notes have been posted to Changerawr.' + }); + + } catch (error) { + console.error('Error posting to Changerawr:', error); + core.setFailed(`Failed to post to Changerawr: ${error.message}`); + } diff --git a/Repositories/Resgrid.Repositories.NoSqlRepository/MongoRepository.cs b/Repositories/Resgrid.Repositories.NoSqlRepository/MongoRepository.cs index fffcd204..b2756ecd 100644 --- a/Repositories/Resgrid.Repositories.NoSqlRepository/MongoRepository.cs +++ b/Repositories/Resgrid.Repositories.NoSqlRepository/MongoRepository.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using Resgrid.Model; using Resgrid.Config; -using System.Runtime.CompilerServices; using MongoDB.Driver.Linq; namespace Resgrid.Repositories.NoSqlRepository From 8163810f25a1ac2c4812c37cda557396ffe11297 Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Thu, 23 Oct 2025 13:38:07 -0700 Subject: [PATCH 3/4] Potential fix for code scanning alert no. 529: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/changerawr-sync.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/changerawr-sync.yml b/.github/workflows/changerawr-sync.yml index 15dd6587..6d241062 100644 --- a/.github/workflows/changerawr-sync.yml +++ b/.github/workflows/changerawr-sync.yml @@ -1,4 +1,7 @@ name: Sync PR to Changerawr +permissions: + contents: read + issues: write on: pull_request: From 402f17b2e6f7ad8f56bf7c30e364849fd48e72fe Mon Sep 17 00:00:00 2001 From: Shawn Jackson Date: Thu, 23 Oct 2025 13:38:45 -0700 Subject: [PATCH 4/4] Update .github/workflows/changerawr-sync.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/changerawr-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changerawr-sync.yml b/.github/workflows/changerawr-sync.yml index 6d241062..c4cdaed8 100644 --- a/.github/workflows/changerawr-sync.yml +++ b/.github/workflows/changerawr-sync.yml @@ -37,7 +37,7 @@ jobs: pr_title: prTitle, pr_url: prUrl, merged_at: context.payload.pull_request.merged_at, - merged_by: context.payload.pull_request.merged_by.login + merged_by: context.payload.pull_request.merged_by?.login || 'unknown' } };