mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-06 05:11:27 +00:00
Profile Blocking (#662)
* Added blocked user DB object
* Added user blocking functions
* Fixed DB Migration
* Updated DB Functions
* Added blocked user support to website
* Fixed DB Migration
* I forgot to save 🫠
* More migration pain
* Fixed Unblock label
* Update ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml
sounds cool
Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com>
* Removed unnecessary imports in database
* Removed unnecessary imports in UserPage.cshtml.cs
* Made comments in-game respect blocked users
* Update ProjectLighthouse/Database.cs
Co-authored-by: Josh <josh@slendy.pw>
* Update ProjectLighthouse/Database.cs
Co-authored-by: Josh <josh@slendy.pw>
* DB Code cleanup
* Cleaned up userPage block detection code
* Get only the creator id in lieu of the whole object
* Fixed null condition when not logged in
* Fixed null condition when not logged in
* Potential DB Optimisation
* Apply suggestions from code review
Co-authored-by: Josh <josh@slendy.pw>
* Fix errors and null warning
* Use explicit type in lieu of var
* changed block icons
* Optimize blocked user check and save changes when unblocking
---------
Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com>
Co-authored-by: Josh <josh@slendy.pw>
This commit is contained in:
parent
b4326d4798
commit
3fcfaaf5cc
8 changed files with 227 additions and 8 deletions
|
@ -71,9 +71,15 @@ public class CommentController : ControllerBase
|
|||
|
||||
if (targetId == 0) return this.NotFound();
|
||||
|
||||
List<Comment> comments = await this.database.Comments.Include
|
||||
(c => c.Poster)
|
||||
.Where(c => c.TargetId == targetId && c.Type == type)
|
||||
List<int> blockedUsers = await (
|
||||
from blockedProfile in this.database.BlockedProfiles
|
||||
where blockedProfile.UserId == token.UserId
|
||||
select blockedProfile.BlockedUserId
|
||||
).ToListAsync();
|
||||
|
||||
List<Comment> comments = await this.database.Comments.Include(c => c.Poster)
|
||||
.Where(c => c.TargetId == targetId && c.Type == type && !c.Poster.IsBanned)
|
||||
.Where(c => !blockedUsers.Contains(c.PosterUserId))
|
||||
.OrderByDescending(c => c.Timestamp)
|
||||
.Skip(Math.Max(0, pageStart - 1))
|
||||
.Take(Math.Min(pageSize, 30))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue