add tempVIP check to vote

This commit is contained in:
Michael C
2021-12-30 22:21:27 -05:00
parent ceabeefe21
commit 9ae16ea9b6
3 changed files with 33 additions and 16 deletions

View File

@@ -3,13 +3,11 @@ import { UserID } from "../types/user.model";
import { HashedValue } from "../types/hash.model";
import { Logger } from "./logger";
export function skipSegmentsKey(videoID: VideoID, service: Service): string {
return `segments.v3.${service}.videoID.${videoID}`;
}
export const skipSegmentsKey = (videoID: VideoID, service: Service): string =>
`segments.v3.${service}.videoID.${videoID}`;
export function skipSegmentGroupsKey(videoID: VideoID, service: Service): string {
return `segments.groups.v2.${service}.videoID.${videoID}`;
}
export const skipSegmentGroupsKey = (videoID: VideoID, service: Service): string =>
`segments.groups.v2.${service}.videoID.${videoID}`;
export function skipSegmentsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string {
hashedVideoIDPrefix = hashedVideoIDPrefix.substring(0, 4) as VideoIDHash;
@@ -18,9 +16,8 @@ export function skipSegmentsHashKey(hashedVideoIDPrefix: VideoIDHash, service: S
return `segments.v3.${service}.${hashedVideoIDPrefix}`;
}
export function reputationKey(userID: UserID): string {
return `reputation.user.${userID}`;
}
export const reputationKey = (userID: UserID): string =>
`reputation.user.${userID}`;
export function ratingHashKey(hashPrefix: VideoIDHash, service: Service): string {
hashPrefix = hashPrefix.substring(0, 4) as VideoIDHash;
@@ -33,4 +30,7 @@ export function shaHashKey(singleIter: HashedValue): string {
if (singleIter.length !== 64) Logger.warn(`Redis sha.hash key is not length 64! ${singleIter}`);
return `sha.hash.${singleIter}`;
}
}
export const tempVIPKey = (userID: UserID): string =>
`vip.temp.${userID}`;

View File

@@ -2,9 +2,11 @@ import { config } from "../config";
import { Logger } from "../utils/logger";
import axios from "axios";
function getVoteAuthorRaw(submissionCount: number, isVIP: boolean, isOwnSubmission: boolean): string {
function getVoteAuthorRaw(submissionCount: number, isTempVIP: boolean, isVIP: boolean, isOwnSubmission: boolean): string {
if (isOwnSubmission) {
return "self";
} else if (isTempVIP) {
return "temp vip";
} else if (isVIP) {
return "vip";
} else if (submissionCount === 0) {
@@ -14,11 +16,13 @@ function getVoteAuthorRaw(submissionCount: number, isVIP: boolean, isOwnSubmissi
}
}
function getVoteAuthor(submissionCount: number, isVIP: boolean, isOwnSubmission: boolean): string {
function getVoteAuthor(submissionCount: number, isTempVIP: boolean, isVIP: boolean, isOwnSubmission: boolean): string {
if (submissionCount === 0) {
return "Report by New User";
} else if (isOwnSubmission) {
return "Report by Submitter";
} else if (isTempVIP) {
return "Report by Temp VIP";
} else if (isVIP) {
return "Report by VIP User";
}