Skip to content

Commit

Permalink
federated usernames in follow lists
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Apr 12, 2022
1 parent 35c5a87 commit 53847a1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions server/src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,23 @@ export class Database {
async listFollows(creator: string): Promise<Follow[]> {
const list = await this.db('follows')
.join('user_dids', 'follows.target', '=', 'user_dids.did')
.select('follows.target', 'user_dids.username')
.select('follows.target', 'user_dids.username', 'user_dids.host')
.where('follows.creator', creator)
return list.map((f) => ({ did: f.target, username: f.username }))
return list.map((f) => ({
did: f.target,
username: `${f.username}@${f.host}`,
}))
}

async listFollowers(target: string): Promise<Follow[]> {
const list = await this.db('follows')
.join('user_dids', 'follows.creator', '=', 'user_dids.did')
.select('follows.creator', 'user_dids.username')
.select('follows.creator', 'user_dids.username', 'user_dids.host')
.where('follows.target', target)
return list.map((f) => ({ did: f.creator, username: f.username }))
return list.map((f) => ({
did: f.creator,
username: `${f.username}@${f.host}`,
}))
}

async followCount(creator: string): Promise<number> {
Expand Down

0 comments on commit 53847a1

Please sign in to comment.