Skip to content

Commit

Permalink
tweak(ext/cfx-ui): require a minimum play time for reviews
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blattersturm committed Apr 11, 2023
1 parent b147842 commit 65a4657
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 65a4657

Please sign in to comment.