Commit graph

241 commits

Author SHA1 Message Date
koko
be5a29d3c9
Simplify rank badges and implement profile tags (#880)
* Simplify website rank badges to use semantic classes

* Fix ambiguity between partial display types

* Add profile vanity tags and needed migration

* Make form field read only to non-administrators

* Display lock icon if user is not admin to minimize confusion

* Also display lock icon for username field since it's readonly

* Fix up naming consistency issues and edit migration accordingly

* Apply suggestions from code review

* Add space between placeholder property and ternary operator
2023-08-28 20:37:06 +00:00
Josh
a316c866c5
Add proper relationships to Comments (#838)
* Add specific foreign keys for comment targets

* Remove inheritdoc tags from migration

* Fix punctuation of deleted comment message and add mod deletion message

* Fix broken merge

* Cleanup comment queries
2023-08-24 18:58:03 +00:00
Josh
70a66e6034
Migrate scores to use proper relationships (#830)
* Initial work for score migration

* Finish score migration

* Implement suggested changes from code review

* Make Score Timestamp default the current time

* Chunk insertions to reduce packet size and give all scores the same Timestamp

* Fix serialization of GameScore

* Break score ties by time then scoreId

* Make lighthouse score migration not dependent on current score implementation
2023-08-19 07:32:38 +00:00
dependabot[bot]
38d1197237
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from 7.0.9 to 7.0.10 (#866)
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

Bumps [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://github.com/dotnet/aspnetcore) from 7.0.9 to 7.0.10.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](https://github.com/dotnet/aspnetcore/compare/v7.0.9...v7.0.10)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 14:56:26 +00:00
koko
1d89f7c548
Fix rendering issues with case creation page (#863) 2023-08-08 19:24:03 -05:00
koko
027173b9c7
Redesign case creation page (#854)
* Redesign case creation page

* Fix user id placeholder text

* Handle empty moderation history

* Mod history dropdown nitpick

* Fix styling issue with dropdown

ui fluid dropdown inherits from ui form

* Potentially fix NRE

* Un-require reason/mod notes

* Display username in moderation history view

* Order mod history by creation time descending

* Nitpick no moderation history string

* Handle AffectedUser null check within controller

* Fix styling issues

* Move moderation history segment above create case button segment

* Link back to affected user

* Move expiration field in with the other entries

* Grammatical consistency nitpick in history dropdown

* Handle empty case reasons in mod history

* This is the last nitpick, I swear!

* I lied. Variable naming consistency :trollface:

* Consolidate setPermanent function into button onclick

* Use HTML details and Fomantic list instead of dropdown

* Fix padding issue with details list

* Format history and user/id nicely

* Styling fixes and nitpicks of list items/links

* Apply suggestions from code review

* Clarification with code review suggestion
2023-08-07 04:45:46 +00:00
Josh
65f317d9bd
Improve website tests (#842)
* Improve website tests

* Use DefaultLang instead of hard coding English
2023-08-03 20:09:32 -05:00
koko
6558d09c8d
Implement profile and level privacy settings (#841)
* Create interactions management page and basic GET logic

* Fix client side query and add blocked count as well as comments nitpick

* Implement basic backend logic for interactions management

* Remove errant null/whitespace checks and add border to blocked users partials

* Implement user page's respect to profile privacy settings

* Fix issue where user can't view their own profile if privacy settings are tightened

* Fix other issues with profile access

* Remove excess conditional expression from PSN privtype check

* Check if access is allowed within request handler and hide bio/RA if private

* Fix PSN privacy level check

* Display private users in search and add base UI class to level lock icon

* Rename everything from interactions to privacy for clarity

* Dagg requested an eyeball

Co-authored-by: vilijur <69403080+vilijur@users.noreply.github.com>

* Clarify profile settings page title

* Implement level privacy settings

* Formatting nitpicks within UserPrivacyPage

* Add discard changes buttons

* Apply suggestion from code review

* Consolidate privacy settings areas together

* Grammar nitpick for comments enable/disable dropdown

* Remove un-needed blue UI segment

* Allow mods to issue disable comments case regardless of privacy settings

Also addresses a few frontend and backend nitpicks left unaddressed by previous commits

* Remove limiting AND operator expression

* Grammar clarity on disable comments button

* Add missing hidden button divider under Wipe Earth Decorations

* No eyeball -m88youngling

Removes eyeball from actual privacy settings page to match styling

* Use long-text description for privacy type dropdowns

* Use long-text description for comments toggle dropdown

* Implement slot page privacy

* Grammar nitpicks with Daggintosh

* Daggintosh grammar review second edition

* Once again put request handler arguments on one line

* Rename LevelsPrivate variable to SlotsPrivate for internal consistency

* Fix issue with PSN slot privacy type

* Un-break comments

* Apply most of the suggestions from code review

* Correct form dropdown values for privacy types

* Potentially fix broken privacy type extension

* Slightly rework access calculation extension method

* Fix issues with if statements

* Apply suggestions from code review

* Make everything translatable

---------

Co-authored-by: vilijur <69403080+vilijur@users.noreply.github.com>
2023-07-22 21:49:56 +00:00
koko
f084189a29
Add workaround for the clickable user links in a grief report (#846) 2023-07-21 14:55:04 +00:00
Slendy
282fd4e073
Bump dependencies and fix digest unit tests 2023-07-14 16:41:15 -05:00
koko
25bb2ecfc1
Add the ability for moderators to forcibly lock levels (#831)
* Add the ability for moderators to forcibly lock levels

* Prevent forcibly locking an already locked level

I had to rollback and re-commit this because I was getting some weird error within Rider.

* Correct moderation notice header styling & remove errant text
2023-07-07 22:44:05 +00:00
koko
872a161459
Fix null case bug in BannedUserPage and properly add no expiration text (#825)
* Fix null case bug in BannedUserPage and properly add no expiration text

* Correct maximum expiration hour to 23 (uses 24-hour)

* Improve wording for do not expire string

* Handle empty case reason string

* Move list to it's own div per HTML spec

* Move maximum expiration DateTime to the model

* Correct linq statement chaining style

* Use lambda operator instead of explicit accessor for MaximumExpiration
2023-07-05 21:15:34 +00:00
dependabot[bot]
3115030c11
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from 7.0.7 to 7.0.8 (#814)
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

Bumps [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://github.com/dotnet/aspnetcore) from 7.0.7 to 7.0.8.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](https://github.com/dotnet/aspnetcore/compare/v7.0.7...v7.0.8)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-04 15:25:22 +00:00
Slendy
4098a710c3
Fix a kokoism
Move autocorrect attribute to correct input
2023-06-29 00:39:13 -05:00
koko
88f8eec8a0
Do not autocomplete admin command form values (#822) 2023-06-28 22:49:31 +00:00
Slendy
5c66b0f713
Improve input validation for story level moderation 2023-06-26 23:41:30 -05:00
koko
f965be88b7
Website announcements fixes and additions (#818)
* Render line breaks in announcement content

* Track announcement publisher

* Change paragraph tag to a div for consistency

* Fix bottom padding for announcement content

* Track publisher user entity rather than just the username

* Potentially fix a migration failure

* Final code cleanup

* Fix linq statement chaining style

---------

Co-authored-by: Dagg <daggintosh@outlook.com>
2023-06-27 03:02:11 +00:00
Josh
14ebad07f3
Allow moderators to moderate story levels (#809)
* Allow moderators to view story levels on website
Show comments to moderators on in-game story levels that show the levels id

* Only show LH ID comment on the first page
2023-06-26 23:52:15 +00:00
koko
689ebd3791
Optimize GameServer /announce and add website announcements (#810)
* Improve game server announce by using StringBuilder

* Implement web announcements (condensed commit)

* Implement discord webhook support

* Display a separate message if there are no announcements

* Fix announcement string unit tests

* Fix header admin button unit test

* Clarify announcement id variable name

* Increase webhook truncation limit to 250 chars

* Convert announce text to string when returning 200

* Fix announcement unit tests ... again

* Make announcement text input a textarea rather than a simple input

* Fix styling discrepancy

* Clarify submission button

* Improve announcement webhook & set default textarea row amount
2023-06-23 03:49:22 +00:00
Josh
e43397ac6a
Implement property dependency injection for the website (#806)
* Remove most non DI usages of DbContext

* Optimize website queries and refactor startup to use top level statements

* Remove unused functions in UserEntity and SlotEntity

* Optimize LBP1 LevelTags
2023-06-20 05:02:24 +00:00
koko
e5cfeb1e39
Censor filter logging improvements (#804)
* Move censor/msg logging to MessageController & separate LogAreas/config

* Correct LBP character limit to 95

* Log filtered comments as well

* Remove two unnecessary variables from CensorHelper

* Add censor logging to SlotPage/UserPage controllers and improve logging slightly

* Remove accidental dollar sign in log

* Grammatical nitpick in CommentController.cs

* Contextual nitpick in MessageController.cs

* Add escaped quotes in CommentController log to match the rest

* Increase limit to account for descriptions, magic mouth, etc.

* Consolidate LogChatMessages logging into Filter log area to prevent confusion

* Apply code review suggestions
2023-06-18 23:39:39 +00:00
Josh
a0d021f1e2
Refactor RepeatingTaskHandler (#796)
* Refactor RepeatingTaskHandler into an ASP.NET service

* Add unit tests for RepeatingTaskService

* Make repeating task unit tests work independent of time

* Fix weird behavior when task is canceled
2023-06-17 19:48:24 +00:00
koko
bf2e36e8a4
Handle edge case bug in banned page (#801) 2023-06-17 04:12:46 +00:00
dependabot[bot]
73bb810678
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from 7.0.5 to 7.0.7 (#797)
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

Bumps [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://github.com/dotnet/aspnetcore) from 7.0.5 to 7.0.7.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](https://github.com/dotnet/aspnetcore/compare/v7.0.5...v7.0.7)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-17 02:19:28 +00:00
koko
77e46a0721
Refactor error modal into its own partial (#785)
* Refactor error modal into its own partial

* Fix unresolved error string in TwoFactorPartial

* Use tuple model instead of ViewData for error title and message

* Apply suggestions from code review
2023-06-08 04:01:59 +00:00
koko
2a85b6a136
Disallow moderators/administrators from issuing cases against each other (#781)
* Disallow moderators/administrators from issuing cases against each other

* Resolve suggestions from reviewers

* Only request user from db if id is valid
2023-06-05 21:45:25 +00:00
koko
572c942ee8
Implement pride logo & necessary configuration options (#780)
* Implement pride logo as well as needed configuration option

* Potentially fix issue with icons not rendering

* Fix login form icon and remove unused image from PasswordResetPage
2023-06-02 14:21:56 +00:00
Josh
0c1e350fa3
Rewrite gameserver slot filter system (#763)
* Initial implementation of new slot sorting and filtering system

* Initial implementation of filtering for lbp3 community tab

* Add support for organization on lbp3

* Add playlist and user categories

* Implement unit tests for all filters
Refactor more systems to use PaginationData

* Fix PlayerCountFilter test

* Add more unit tests and integration tests for the filter system

* Fix LBP2 move filter and gameFilterType

* Fix sort by likes in LBP3 category

* Add sort for total plays

* Remove extra whitespace and make styling more consistent

* Order hearted and queued levels by primary key ID

* Fix query without order warnings
2023-05-31 21:33:39 +00:00
Slendy
de228cb242
Fix client side query in BannedPage 2023-05-31 15:12:40 -05:00
koko
b4efba7f14
Patch account suspended page display issues (#777)
Remove excess heading and fix incorrect mod case display
2023-05-31 18:40:58 +00:00
koko
21dbdff20a
Add proper ban page when logging in (#773)
* Add proper ban page upon logging in

* Remove two extra line break tags that don't need to be there

* Fix timestamp formatting

* Properly display timestamps in correct timezone

* Fix formatting issues with ban page

* Remove extra parenthesis which would be rendered on-page

* Add to redirect middleware to prevent navigating to other pages

* Small nitpick, renaming UserBannedPage to BannedUserPage

* Resolve nitpicks from reviewers

* Remove un-necessary log message in LoginForm

* Fix ban reason translatable string argument

* Word choice nitpick ("Ban Created" -> "Ban Issued")

* Final adjustments and nitpicks, visual and grammatical

* Resolve requested changes from reviewers
2023-05-30 19:25:31 +00:00
Slendy
2c69644beb
Allow moderators to access individual reports. 2023-05-26 02:27:11 -05:00
koko
9646dea44a
Fix mod reason/notes overflow issue & show expiration time if applicable (#765)
* Fix mod reason/notes overflow issue & show expiration time if applicable

* Remove extra whitespace

* Wrap using line break instead of overflow scroll bar

* Remove un-required overflow inline style
2023-05-22 01:40:34 +00:00
Josh
1bf4ed6218
Add more unit tests (#757)
* Reorganize tests into unit/integration pattern

* Make DbSets virtual so they can be overridden by tests

* Add MessageControllerTests

* Implement DigestMiddlewareTests

* Refactor SMTPHelper to follow DI pattern which allows for mocking in unit tests.

* Fix MailQueueService service registration and shutdown

* Implement tests for Status and StatisticsController and reorganize tests

* Start working on UserControllerTests

* Start refactoring tests to use In-Memory EF provider

* Refactor integration tests to reset the database every time
Change default unit testing database credentials

* Update credentials to use default root with different passwords

* Throw exception when integration db is not available instead of falling back to in-memory

* Evaluate DbConnected every time

* Remove default DbContext constructor

* Setup DbContexts with options builder

* Convert remaining Moq DbContexts to InMemory ones

* Add more tests and use Assert.IsType for testing status code

* Add collection attribute to LighthouseServerTest

* Remove unused directives and calculate digest in tests

* Fix digest calculation in tests

* Add test database call

* Clear rooms after each test

* Fix CommentControllerTests.cs

* Disable test parallelization for gameserver tests

* Fix failing tests

Fix SlotTests

Make CreateUser actually add user to database

Fix dbConnected Lazy and change expected status codes

Properly Remove fragment from url for digest calculation

Fix digest calculation for regular requests

[skip ci] Remove unused directive

Don't use Database CreateUser function

Get rid of userId argument for generating random user

Rewrite logic for generating random users

Fix integration tests

* Implement changes from self-code review

* Fix registration tests

* Replace MailQueueService usages with IMailService
2023-05-15 15:00:33 -05:00
Slendy
02f520c717
Fix account unlinking 2023-05-14 14:50:43 -05:00
Josh
3aa9033b67
Rewrite captcha system (#754)
Rewrite captcha and remove many unused directives
2023-04-29 04:32:42 +00:00
koko
586c161c71
String fix with login/register button (#755)
* Display "Login" only when registration is off, remove unused BaseLayoutStrings

* Remove un-used strings from BaseLayout
2023-04-29 03:44:33 +00:00
koko
6f55ce3226
Add basic ability to flag duplicate levels (#753)
* Add the basics for duplicate level flagging

* Use this.BadRequest instead of StatusCode(500)

* Remove redundant slot creator check

* Include creator entity

* Redirect back to slot page for unauthenticated reqs

* Check if reporter = level creator on server side

* A few formatting nitpicks with the webhook

* Move external url config to a shorter var

* Change duplicate flag button icon to a flag

* Remove accidental dollar sign

Co-authored-by: Josh <josh@slendy.pw>

* Remove another accidental dollar sign

Co-authored-by: Josh <josh@slendy.pw>

* Three dollar signs... I'm blind

Co-authored-by: Josh <josh@slendy.pw>

* Update ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationSlotController.cs

Co-authored-by: Josh <josh@slendy.pw>

---------

Co-authored-by: Josh <josh@slendy.pw>
2023-04-27 02:48:19 +00:00
dependabot[bot]
8b1fa0908e
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from 7.0.4 to 7.0.5 (#742)
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

Bumps [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://github.com/dotnet/aspnetcore) from 7.0.4 to 7.0.5.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](https://github.com/dotnet/aspnetcore/compare/v7.0.4...v7.0.5)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-25 13:54:30 +00:00
Slendy
f03d1d7c17
Utilize EF 7 bulk delete operations instead of RemoveRange 2023-04-18 20:45:42 -05:00
koko
c50e53ad9a
Display a lock icon next to locked levels (#738)
* Display a lock icon next to locked levels

* C# Return Switch shenanigans

* No clue where that line break came from

* Don't render a semicolon

* Move permission level color/lock icon to website extension

* Simplify GetLevelLockIcon

---------

Co-authored-by: Josh <josh@slendy.pw>
2023-04-11 02:16:03 +00:00
Slendy
d6788f0965
Prevent null values from being censored 2023-04-03 01:02:41 -05:00
Slendy
c34b7f3e79
Revert website Forbid and Unauthorized method usage to StatusCode
This is because by default ASP.NET expects an authentication scheme to be registered when using these methods.
2023-03-30 19:23:11 -05:00
Josh
50d1d9c7e5
Fix doubly sanitized strings (#727)
* Add migration to de-sanitize database strings

* Remove SanitizationHelper functions related to XML sanitization

* Remove sanitization usage from website

* Implement suggested changes
2023-03-30 23:03:08 +00:00
koko
89877d359f
Add comment form max char limit validation (#722)
* Add comment form max char limit validation, minor visual nitpick

* Italicize banned/disabled/etc messages within comments
2023-03-30 06:03:12 +00:00
Slendy
a603cdb002
Use Unauthorized instead of Forbid on Website & Api 2023-03-29 21:44:16 -05:00
Josh
329ab66043
Refactor serialization system (#702)
* Initial work for serialization refactor

* Experiment with new naming conventions

* Mostly implement user and slot serialization.
Still needs to be fine tuned to match original implementation
Many things are left in a broken state like website features/api endpoints/lbp3 categories

* Fix release building

* Migrate scores, reviews, and more to new serialization system.
Many things are still broken but progress is steadily being made

* Fix Api responses and migrate serialization for most types

* Make serialization better and fix bugs
Fix recursive PrepareSerialization when recursive item is set during root item's PrepareSerialization, items, should be properly indexed in order but it's only tested to 1 level of recursion

* Fix review serialization

* Fix user serialization producing malformed SQL query

* Remove DefaultIfEmpty query

* MariaDB doesn't like double nested queries

* Fix LBP1 tag counter

* Implement lbp3 categories and add better deserialization handling

* Implement expression tree caching to speed up reflection and write new serializer tests

* Remove Game column from UserEntity and rename DatabaseContextModelSnapshot.cs back to DatabaseModelSnapshot.cs

* Make UserEntity username not required

* Fix recursive serialization of lists and add relevant unit tests

* Actually commit the migration

* Fix LocationTests to use new deserialization class

* Fix comments not serializing the right author username

* Replace all occurrences of StatusCode with their respective ASP.NET named result
instead of StatusCode(403) everything is now in the form of Forbid()

* Fix SlotBase.ConvertToEntity and LocationTests

* Fix compilation error

* Give Location a default value in GameUserSlot and GameUser

* Reimplement stubbed website functions

* Convert grief reports to new serialization system

* Update DatabaseModelSnapshot and bump dotnet tool version

* Remove unused directives

* Fix broken type reference

* Fix rated comments on website

* Don't include banned users in website comments

* Optimize score submission

* Fix slot id calculating in in-game comment posting

* Move serialization interfaces to types folder and add more documentation

* Allow uploading of versus scores
2023-03-28 00:39:54 +00:00
Dagg
307b2135a3
Potentially fix score sorting issue (#721)
Update SlotPage.cshtml.cs

lel
2023-03-27 23:34:12 +00:00
Josh
b2a1d3958f
Allow head requests to status endpoints (#717) 2023-03-24 00:31:56 +00:00
dependabot[bot]
9dc889d192
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from 7.0.3 to 7.0.4 (#707)
Bump Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

Bumps [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://github.com/dotnet/aspnetcore) from 7.0.3 to 7.0.4.
- [Release notes](https://github.com/dotnet/aspnetcore/releases)
- [Changelog](https://github.com/dotnet/aspnetcore/blob/main/docs/ReleasePlanning.md)
- [Commits](https://github.com/dotnet/aspnetcore/compare/v7.0.3...v7.0.4)

---
updated-dependencies:
- dependency-name: Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-15 06:39:40 +00:00