This commit is contained in:
Dimitris Apostolou 2024-01-10 20:24:14 +02:00 committed by GitHub
parent 87e4641e0c
commit ff2f9db97e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 16 deletions
packages

@ -197,7 +197,7 @@ const profileMod = moderateProfile(profileView, getOpts())
// =
if (postMod.content.filter) {
// dont render in feeds or similar
// don't render in feeds or similar
// in contexts where this is disruptive (eg threads) you should ignore this and instead check blur
}
if (postMod.content.blur) {
@ -315,7 +315,7 @@ import { BskyAgent } from '@atproto/api'
const agent = new BskyAgent({ service: 'https://example.com' })
// provide a custom fetch implementation (shouldnt be needed in node or the browser)
// provide a custom fetch implementation (shouldn't be needed in node or the browser)
import {
AtpAgentFetchHeaders,
AtpAgentFetchHandlerResponse,

@ -85,7 +85,7 @@ import { moderatePost } from '@atproto/api'
const postMod = moderatePost(postView, getOpts())
if (postMod.content.filter) {
// dont render in feeds or similar
// don't render in feeds or similar
// in contexts where this is disruptive (eg threads) you should ignore this and instead check blur
}
if (postMod.content.blur) {
@ -123,8 +123,8 @@ import { moderateProfile } from '@atproto/api'
const profileMod = moderateProfile(profileView, getOpts())
if (profileMod.acount.filter) {
// dont render in discovery
if (profileMod.account.filter) {
// don't render in discovery
}
if (profileMod.account.blur) {
// render the whole account behind a cover (use profileMod.account.cause to explain)

@ -56,7 +56,7 @@ export function moderateProfile(
account.blur = true
}
// dont give profile.filter because that is meaningless
// don't give profile.filter because that is meaningless
profile.filter = false
// downgrade based on authorship
@ -67,7 +67,7 @@ export function moderateProfile(
downgradeDecision(profile, 'alert')
}
// derive avatar blurring from account & profile, but override for mutes because that shouldnt blur
// derive avatar blurring from account & profile, but override for mutes because that shouldn't blur
let avatarBlur = false
let avatarNoOverride = false
if ((account.blur || account.blurMedia) && account.cause?.type !== 'muted') {
@ -78,7 +78,7 @@ export function moderateProfile(
avatarNoOverride = account.noOverride || profile.noOverride
}
// dont blur the account for blocking & muting
// don't blur the account for blocking & muting
if (
account.cause?.type === 'blocking' ||
account.cause?.type === 'blocked-by' ||
@ -188,7 +188,7 @@ export function moderatePost(
// derive embed blurring from the quoted post and the quoted post author's account
const mergedQuote = takeHighestPriorityDecision(quote, quotedAccount)
// derive avatar blurring from account & profile, but override for mutes because that shouldnt blur
// derive avatar blurring from account & profile, but override for mutes because that shouldn't blur
let blurAvatar = false
if ((account.blur || account.blurMedia) && account.cause?.type !== 'muted') {
blurAvatar = true

@ -300,7 +300,7 @@ describe('Moderation', () => {
})
/*
TODO enable when 3P labeler support is addded
TODO enable when 3P labeler support is added
it('Ignores labels from unknown labelers', () => {
const res1 = moderateProfile(
mock.profileViewBasic({

@ -17,7 +17,7 @@ export async function up(db: Kysely<unknown>): Promise<void> {
.columns(['subjectDid', 'sortAt', 'cid'])
.execute()
// drop old indices that are superceded by these
// drop old indices that are superseded by these
await db.schema.dropIndex('like_creator_idx').execute()
await db.schema.dropIndex('follow_subjectdid_idx').execute()
}

@ -42,7 +42,7 @@ export const tidyNotifications = async (db: PrimaryDatabase, did: string) => {
// take most recent of read/unread cutoffs
const cutoffAt = greatest(readCutoffAt, unreadCutoffAt)
if (cutoffAt) {
// skip delete if it wont catch any notifications
// skip delete if it won't catch any notifications
const earliestAt = least(readStats?.earliestAt, unreadStats?.earliestAt)
if (earliestAt && earliestAt < cutoffAt.toISOString()) {
await db.db

@ -32,7 +32,7 @@ Going to remove pg-db_test-1
### `with-redis-and-test-db.sh`
This script is similar to `with-test-db.sh`, but in addition to an ephemeral/single-use postgres database it also provies a single-use redis instance. When the script starts, Dockerized postgres and redis containers start-up, and when the script completes the containers are removed.
This script is similar to `with-test-db.sh`, but in addition to an ephemeral/single-use postgres database it also provides a single-use redis instance. When the script starts, Dockerized postgres and redis containers start-up, and when the script completes the containers are removed.
The environment variables `DB_POSTGRES_URL` and `REDIS_HOST` will be set with a connection strings that can be used to connect to postgres and redis respectively.

@ -122,7 +122,7 @@ export class Lexicons {
} else if (def.type === 'object') {
return ComplexValidators.object(this, 'Object', def, value)
} else {
// shouldnt happen
// shouldn't happen
throw new InvalidLexiconError('Definition must be a record or object')
}
}

@ -46,9 +46,9 @@ export const isValidDatetime = (dtStr: string): boolean => {
return true
}
/* Takes a flexible datetime sting and normalizes representation.
/* Takes a flexible datetime string and normalizes representation.
*
* This function will work with any valid atproto datetime (eg, anything which isValidDatetime() is true for). It *additinally* is more flexible about accepting datetimes that don't comply to RFC 3339, or are missing timezone information, and normalizing them to a valid datetime.
* This function will work with any valid atproto datetime (eg, anything which isValidDatetime() is true for). It *additionally* is more flexible about accepting datetimes that don't comply to RFC 3339, or are missing timezone information, and normalizing them to a valid datetime.
*
* One use-case is a consistent, sortable string. Another is to work with older invalid createdAt datetimes.
*