Blocking someone removes notifications between you
Also note in the CI guide that the build caches need disk space where Docker keeps its data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import { db, schema } from '../db';
|
|||||||
import { requireUser } from '../lib/auth';
|
import { requireUser } from '../lib/auth';
|
||||||
import { HttpError } from '../lib/http';
|
import { HttpError } from '../lib/http';
|
||||||
import { FOLLOWS_CHANGED_CHANNEL, redis } from '../lib/redis';
|
import { FOLLOWS_CHANGED_CHANNEL, redis } from '../lib/redis';
|
||||||
|
import { removeNotificationsBetween } from '../services/notifications';
|
||||||
import { toUserSummary } from '../services/nowPlaying';
|
import { toUserSummary } from '../services/nowPlaying';
|
||||||
import { removeReactionsBetween } from './reactions';
|
import { removeReactionsBetween } from './reactions';
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ export async function safetyRoutes(app: FastifyInstance) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
await removeReactionsBetween(me.id, them.id);
|
await removeReactionsBetween(me.id, them.id);
|
||||||
|
await removeNotificationsBetween(me.id, them.id);
|
||||||
await followsChanged(me.id, them.id);
|
await followsChanged(me.id, them.id);
|
||||||
return { ok: true };
|
return { ok: true };
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { and, desc, eq, gt, inArray, isNull, lt } from 'drizzle-orm';
|
import { and, desc, eq, gt, inArray, isNull, lt, or } from 'drizzle-orm';
|
||||||
import webpush from 'web-push';
|
import webpush from 'web-push';
|
||||||
import {
|
import {
|
||||||
notificationPath,
|
notificationPath,
|
||||||
@@ -61,6 +61,12 @@ export async function notify(input: {
|
|||||||
return row!.id;
|
return row!.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** After a block: neither sees notifications from the other any more. */
|
||||||
|
export async function removeNotificationsBetween(a: string, b: string) {
|
||||||
|
const n = schema.notifications;
|
||||||
|
await db.delete(n).where(or(and(eq(n.userId, a), eq(n.actorId, b)), and(eq(n.userId, b), eq(n.actorId, a))));
|
||||||
|
}
|
||||||
|
|
||||||
/** Take back a reaction's notification when the reaction is removed (if it hasn't been seen). */
|
/** Take back a reaction's notification when the reaction is removed (if it hasn't been seen). */
|
||||||
export async function unnotifyReaction(userId: string, actorId: string, listenId: string) {
|
export async function unnotifyReaction(userId: string, actorId: string, listenId: string) {
|
||||||
const n = schema.notifications;
|
const n = schema.notifications;
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ describe('notifications', () => {
|
|||||||
expect((await inbox(bob.token)).unread).toBe(0);
|
expect((await inbox(bob.token)).unread).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('blocking removes notifications between the two', async () => {
|
||||||
|
const { alice } = await setup();
|
||||||
|
expect((await inbox(alice.token)).notifications).toHaveLength(1);
|
||||||
|
await app().inject({ method: 'POST', url: '/users/bob/block', headers: bearer(alice.token), payload: {} });
|
||||||
|
expect((await inbox(alice.token)).notifications).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('saves notification settings', async () => {
|
it('saves notification settings', async () => {
|
||||||
const { alice } = await setup();
|
const { alice } = await setup();
|
||||||
const me = (await app().inject({ method: 'PATCH', url: '/me', headers: bearer(alice.token), payload: { notifyPrefs: { follow: false } } })).json();
|
const me = (await app().inject({ method: 'PATCH', url: '/me', headers: bearer(alice.token), payload: { notifyPrefs: { follow: false } } })).json();
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ The pieces:
|
|||||||
|
|
||||||
The server needs about 8 GB of free memory during a build and about 15 GB of disk for the image and
|
The server needs about 8 GB of free memory during a build and about 15 GB of disk for the image and
|
||||||
caches. A first build takes 30-40 minutes; later ones reuse the Gradle cache.
|
caches. A first build takes 30-40 minutes; later ones reuse the Gradle cache.
|
||||||
|
The caches are Docker volumes, which live wherever Docker keeps its data (usually `/var/lib/docker`).
|
||||||
|
Check that disk has room (`df -h /var/lib/docker`): if it fills up, everything else using Docker on the
|
||||||
|
server, including databases, stops writing.
|
||||||
|
|
||||||
1. **Turn on Actions** if it's off. In Gitea's `app.ini`, set:
|
1. **Turn on Actions** if it's off. In Gitea's `app.ini`, set:
|
||||||
```ini
|
```ini
|
||||||
|
|||||||
Reference in New Issue
Block a user