Skip to content

Commit

Permalink
Fixed isBlueskyUser and isFediverseUser
Browse files Browse the repository at this point in the history
  • Loading branch information
gabboman committed Jan 22, 2025
1 parent ab2847d commit f2f5cd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/backend/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const User = sequelize.define(
isBlueskyUser: {
type: DataTypes.VIRTUAL,
get() {
return !!(!this.email && this.bskyDid)
return !!(this.url.split('@').length == 2 && this.bskyDid)
},
set(value) {
throw new Error('Do not try to set the `isBlueskyUser` value!')
Expand All @@ -183,7 +183,7 @@ const User = sequelize.define(
isFediverseUser: {
type: DataTypes.VIRTUAL,
get() {
return !!(!this.email && this.remoteId)
return !!(this.url.split('@').length == 3 && this.remoteId)
},
set(value) {
throw new Error('Do not try to set the `isFediverseUser` value!')
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/routes/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ export default function userRoutes(app: Application) {
if (success) {
res.send({
...blog.dataValues,
isBlueskyUser: blog.isBlueskyUser,
isFediverseUser: blog.isFediverseUser,
postCount,
muted,
blocked,
Expand Down

0 comments on commit f2f5cd2

Please sign in to comment.