mirror of
https://github.com/FoxxMD/context-mod.git
synced 2026-04-19 03:00:07 -04:00
Fix author criteria hash
This commit is contained in:
@@ -385,7 +385,7 @@ export class SubredditResources {
|
||||
// so we can create a hash only using subreddit-author-criteria
|
||||
// and ignore the actual item
|
||||
const hashObj = {...authorOpts, include};
|
||||
const userName = getActivityAuthorName(item);
|
||||
const userName = getActivityAuthorName(item.author);
|
||||
const hash = `authorCrit-${this.subreddit.display_name}-${userName}-${objectHash.sha1(hashObj)}`;
|
||||
await this.stats.cache.authorCrit.identifierRequestCount.set(hash, (await this.stats.cache.authorCrit.identifierRequestCount.wrap(hash, () => 0) as number) + 1);
|
||||
this.stats.cache.authorCrit.requestTimestamps.push(Date.now());
|
||||
|
||||
@@ -28,6 +28,7 @@ import crypto from "crypto";
|
||||
import Autolinker from 'autolinker';
|
||||
import {create as createMemoryStore} from './Utils/memoryStore';
|
||||
import {MESSAGE} from "triple-beam";
|
||||
import {RedditUser} from "snoowrap/dist/objects";
|
||||
|
||||
const {format} = winston;
|
||||
const {combine, printf, timestamp, label, splat, errors} = format;
|
||||
@@ -1025,7 +1026,7 @@ export const getActivitySubredditName = (activity: any): string => {
|
||||
/**
|
||||
* Serialized activities store subreddit and user properties as their string representations (instead of proxy)
|
||||
* */
|
||||
export const getActivityAuthorName = (author: any): string => {
|
||||
export const getActivityAuthorName = (author: RedditUser | string): string => {
|
||||
if(typeof author === 'string') {
|
||||
return author;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user