mirror of
https://github.com/wassname/talk.git
synced 2026-08-14 12:50:17 +08:00
* feat: initial support for synced tenants * fix: cleanup * fix: logger now respects logging level * fix: cache now ignores updates issued from itself * feat: print subscriber count * fix: support tenant cache for oidc strategy * fix: replace some constructor initializers with property initializers * fix: audit * [next] Comments and Moderation (#1759) * feat: initial moderation + validation for new comments * fix: added Promiseable type * feat: initial actions impl * feat: more moderation phases * fix: handle settings inheritence * fix: moved settings into new file * fix: defaults and documentation * fix: replace merge with object spread * feat: added integration with akismet * fix: fixed compile * fix: import ordering * fix: merge issue causing build to fail
23 lines
560 B
TypeScript
23 lines
560 B
TypeScript
import { get } from "lodash";
|
|
|
|
import { KarmaThresholds } from "talk-server/models/settings";
|
|
import { User } from "talk-server/models/user";
|
|
|
|
export const getCommentTrustScore = (user: User): number =>
|
|
get(user, "metadata.trust.comment.karma", 0);
|
|
|
|
export const isReliableCommenter = (
|
|
thresholds: KarmaThresholds,
|
|
user: User
|
|
): boolean | null => {
|
|
const score = getCommentTrustScore(user);
|
|
|
|
if (score >= thresholds.comment.reliable) {
|
|
return true;
|
|
} else if (score <= thresholds.comment.unreliable) {
|
|
return false;
|
|
}
|
|
|
|
return null;
|
|
};
|