Skip to content

Commit 52ed641

Browse files
committed
fix: more internal follow user fixes
1 parent da160cd commit 52ed641

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

src/api/v1/accounts.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
isNotNull,
1313
isNull,
1414
lt,
15+
not,
1516
notInArray,
1617
or,
1718
sql,
@@ -26,6 +27,7 @@ import {
2627
serializeRelationship,
2728
} from "../../entities/account";
2829
import { serializeList } from "../../entities/list";
30+
import { HOLLO_RELAY_ACTOR_ID } from "../../entities/relay";
2931
import { getPostRelations, serializePost } from "../../entities/status";
3032
import { federation } from "../../federation";
3133
import {
@@ -411,9 +413,12 @@ app.get(
411413
}
412414
}
413415
const accountList = await db.query.accounts.findMany({
414-
where: or(
415-
ilike(accounts.handle, `%${query.q}%`),
416-
ilike(accounts.name, `%${query.q}%`),
416+
where: and(
417+
or(
418+
ilike(accounts.handle, `%${query.q}%`),
419+
ilike(accounts.name, `%${query.q}%`),
420+
),
421+
not(eq(accounts.id, HOLLO_RELAY_ACTOR_ID)),
417422
),
418423
with: { owner: true, successor: true },
419424
orderBy: [

src/pages/accounts.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,28 @@ accounts.post("/", async (c) => {
118118
const bioResult = await formatText(db, bio ?? "", fedCtx);
119119
const nameEmojis = await extractCustomEmojis(db, name);
120120
const emojis = { ...nameEmojis, ...bioResult.emojis };
121+
const handle = `@${username}@${fedCtx.host}`;
122+
if (handle === `@${HOLLO_OFFICIAL_ACCOUNT}@${fedCtx.host}`) {
123+
return c.html(
124+
<NewAccountPage
125+
values={{
126+
username,
127+
name,
128+
bio,
129+
protected: protected_,
130+
discoverable,
131+
language,
132+
visibility,
133+
news,
134+
}}
135+
errors={{
136+
username: "This handle is reserved",
137+
}}
138+
officialAccount={HOLLO_OFFICIAL_ACCOUNT}
139+
/>,
140+
400,
141+
);
142+
}
121143
const [account, owner] = await db.transaction(async (tx) => {
122144
await tx
123145
.insert(instances)
@@ -136,7 +158,7 @@ accounts.post("/", async (c) => {
136158
type: "Person",
137159
name,
138160
emojis,
139-
handle: `@${username}@${fedCtx.host}`,
161+
handle: handle,
140162
bioHtml: bioResult.html,
141163
url: fedCtx.getActorUri(username).href,
142164
protected: protected_,

0 commit comments

Comments
 (0)