mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'disabled-no-status' into 'main'
Don't display posts of disabled user on their profile Closes #162 See merge request soapbox-pub/ditto!393
This commit is contained in:
commit
6bdd29922a
5 changed files with 11 additions and 6 deletions
|
|
@ -180,6 +180,13 @@ const accountStatusesController: AppController = async (c) => {
|
|||
|
||||
const store = await Storages.db();
|
||||
|
||||
const [user] = await store.query([{ kinds: [30382], authors: [Conf.pubkey], '#d': [pubkey], limit: 1 }], { signal });
|
||||
const names = getTagSet(user?.tags, 'n');
|
||||
|
||||
if (names.has('disabled')) {
|
||||
return c.json([]);
|
||||
}
|
||||
|
||||
if (pinned) {
|
||||
const [pinEvent] = await store.query([{ kinds: [10001], authors: [pubkey], limit: 1 }], { signal });
|
||||
if (pinEvent) {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ const adminActionController: AppController = async (c) => {
|
|||
n.silenced = true;
|
||||
}
|
||||
if (data.type === 'suspend') {
|
||||
n.disabled = true;
|
||||
n.suspended = true;
|
||||
store.remove([{ authors: [authorId] }]).catch(console.warn);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise<void
|
|||
if (n.has('disabled')) {
|
||||
throw new RelayError('blocked', 'user is disabled');
|
||||
}
|
||||
if (n.has('suspended')) {
|
||||
throw new RelayError('blocked', 'user is suspended');
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
storeEvent(event, signal),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export class AdminStore implements NStore {
|
|||
|
||||
const n = getTagSet(user?.tags ?? [], 'n');
|
||||
|
||||
if (n.has('disabled') || n.has('suspended')) {
|
||||
if (n.has('disabled')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ async function renderAccount(
|
|||
const { pubkey } = event;
|
||||
|
||||
const names = getTagSet(event.user?.tags ?? [], 'n');
|
||||
if (names.has('disabled') || names.has('suspended')) {
|
||||
if (names.has('disabled')) {
|
||||
const account = await accountFromPubkey(pubkey, opts);
|
||||
account.pleroma.deactivated = true;
|
||||
return account;
|
||||
|
|
@ -84,7 +84,7 @@ async function renderAccount(
|
|||
accepts_zaps: Boolean(getLnurl({ lud06, lud16 })),
|
||||
},
|
||||
pleroma: {
|
||||
deactivated: names.has('disabled') || names.has('suspended'),
|
||||
deactivated: names.has('disabled'),
|
||||
is_admin: names.has('admin'),
|
||||
is_moderator: names.has('admin') || names.has('moderator'),
|
||||
is_suggested: names.has('suggested'),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue