Skip to content

Commit

Permalink
Fix for broken PM user not found error #360
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffputz committed Feb 6, 2024
1 parent 6fa1e18 commit c8f94ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/PopForums/Composers/PrivateMessageStateComposer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public async Task<PrivateMessageState> GetState(PrivateMessage pm)
var clientMessages = ClientPrivateMessagePost.MapForClient(messages);
state.Messages = clientMessages;
state.Users = pm.Users;
var isUserNotFound = await _privateMessageService.IsUserNotFound(pm.PMID);
var pmUsersFromPMRecord = pm.Users.EnumerateArray();
var pmUsers = await _privateMessageService.GetUsers(pm.PMID);
var isUserNotFound = pmUsers.Count != pmUsersFromPMRecord.Count();
state.IsUserNotFound = isUserNotFound;
return state;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PopForums/PopForums.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>PopForums Class Library</Description>
<VersionPrefix>21.0.0-alpha1</VersionPrefix>
<VersionPrefix>20.0.1</VersionPrefix>
<Authors>Jeff Putz</Authors>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>PopForums</AssemblyName>
Expand Down
6 changes: 6 additions & 0 deletions src/PopForums/Services/PrivateMessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public interface IPrivateMessageService
Task Unarchive(User user, PrivateMessage pm);
Task<int?> GetFirstUnreadPostID(int pmID, DateTime lastViewDate);
Task<bool> IsUserNotFound(int pmID);
Task<List<PrivateMessageUser>> GetUsers(int pmID);
}

public class PrivateMessageService : IPrivateMessageService
Expand Down Expand Up @@ -177,4 +178,9 @@ public async Task<bool> IsUserNotFound(int pmID)
{
return await _privateMessageRepository.IsUserNotFound(pmID);
}

public async Task<List<PrivateMessageUser>> GetUsers(int pmID)
{
return await _privateMessageRepository.GetUsers(pmID);
}
}

0 comments on commit c8f94ba

Please sign in to comment.