From 65a465790b092fb5138f64cef67dd2c1557a61c6 Mon Sep 17 00:00:00 2001 From: blattersturm Date: Tue, 11 Apr 2023 23:27:44 +0200 Subject: [PATCH] tweak(ext/cfx-ui): require a minimum play time for reviews This hot-fixes a common end-user request involving 'sockpuppet accounts' being used to post negative reviews about servers. Notable shortcomings of this hotfix: 1. It is only implemented client-side, and if a server-side check is added, it must be kept in sync with the counter here. A server-side configuration service would help here. 2. It does not indicate *why* the review form is disabled, that is, for a user which does not qualify to submit a review, the form will simply not show at all. --- .../services/servers/reviews/DiscourseServerReviews.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/cfx-ui/src/cfx/apps/mpMenu/services/servers/reviews/DiscourseServerReviews.ts b/ext/cfx-ui/src/cfx/apps/mpMenu/services/servers/reviews/DiscourseServerReviews.ts index e3815cfe00..1988089a10 100644 --- a/ext/cfx-ui/src/cfx/apps/mpMenu/services/servers/reviews/DiscourseServerReviews.ts +++ b/ext/cfx-ui/src/cfx/apps/mpMenu/services/servers/reviews/DiscourseServerReviews.ts @@ -13,6 +13,10 @@ import { DiscourseServerReviewItem, IUserStub, RecognizedTopicTags } from "./rev // discourse' server reviews category id const REVIEWS_CATEGORY_ID = 76; +// the required play time (in seconds) to be allowed to post a review +const HOURS = 3600; +const REVIEW_REQUIRED_PLAYTIME = (2 * HOURS); + enum OwnReviewState { Loading, LoadingError, @@ -63,6 +67,10 @@ export class DiscourseServerReviews implements IServerReviews { return false; } + if (!this.ownPlaytime || this.ownPlaytime.seconds < REVIEW_REQUIRED_PLAYTIME) { + return false; + } + switch (this.ownReviewState) { case OwnReviewState.Exists: case OwnReviewState.Loading: