Skip to content

Commit a9d5f10

Browse files
committed
fix: more internal follow user fixes
1 parent ead5a47 commit a9d5f10

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

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 {
@@ -416,9 +418,12 @@ app.get(
416418
}
417419
}
418420
const accountList = await db.query.accounts.findMany({
419-
where: or(
420-
ilike(accounts.handle, `%${query.q}%`),
421-
ilike(accounts.name, `%${query.q}%`),
421+
where: and(
422+
or(
423+
ilike(accounts.handle, `%${query.q}%`),
424+
ilike(accounts.name, `%${query.q}%`),
425+
),
426+
not(eq(accounts.id, HOLLO_RELAY_ACTOR_ID)),
422427
),
423428
with: { owner: true, successor: true },
424429
orderBy: [

src/pages/accounts.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,28 @@ accounts.post("/", async (c) => {
121121
const bioResult = await formatText(db, bio ?? "", fedCtx);
122122
const nameEmojis = await extractCustomEmojis(db, name);
123123
const emojis = { ...nameEmojis, ...bioResult.emojis };
124+
const handle = `@${username}@${fedCtx.host}`;
125+
if (handle === `@${HOLLO_OFFICIAL_ACCOUNT}@${fedCtx.host}`) {
126+
return c.html(
127+
<NewAccountPage
128+
values={{
129+
username,
130+
name,
131+
bio,
132+
protected: protected_,
133+
discoverable,
134+
language,
135+
visibility,
136+
news,
137+
}}
138+
errors={{
139+
username: "This handle is reserved",
140+
}}
141+
officialAccount={HOLLO_OFFICIAL_ACCOUNT}
142+
/>,
143+
400,
144+
);
145+
}
124146
const [account, owner] = await db.transaction(async (tx) => {
125147
await tx
126148
.insert(instances)
@@ -139,7 +161,7 @@ accounts.post("/", async (c) => {
139161
type: "Person",
140162
name,
141163
emojis,
142-
handle: `@${username}@${fedCtx.host}`,
164+
handle: handle,
143165
bioHtml: bioResult.html,
144166
url: fedCtx.getActorUri(username).href,
145167
protected: protected_,

0 commit comments

Comments
 (0)