Monorepo for Tangled tangled.org

appview: add personal pronouns to profile #688

merged opened by serendipty01.dev targeting master from serendipty01.dev/tangled-core: pronouns
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:pzcr34e3e2emtcnyzrpmilht/sh.tangled.repo.pull/3m3pooe7qj322
+14 -3
Interdiff #2 โ†’ #3
api/tangled/actorprofile.go

This file has not been changed.

+1 -1
appview/db/db.go
··· 1108 1109 runMigration(conn, logger, "add-pronouns-profile", func(tx *sql.Tx) error { 1110 _, err := tx.Exec(` 1111 - alter table profile add column pronouns text not null default ''; 1112 `) 1113 return err 1114 })
··· 1108 1109 runMigration(conn, logger, "add-pronouns-profile", func(tx *sql.Tx) error { 1110 _, err := tx.Exec(` 1111 + alter table profile add column pronouns text; 1112 `) 1113 return err 1114 })
+13 -2
appview/db/profile.go
··· 234 for rows.Next() { 235 var profile models.Profile 236 var includeBluesky int 237 238 - err = rows.Scan(&profile.ID, &profile.Did, &profile.Description, &includeBluesky, &profile.Location, &profile.Pronouns) 239 if err != nil { 240 return nil, err 241 } ··· 244 profile.IncludeBluesky = true 245 } 246 247 profileMap[profile.Did] = &profile 248 } 249 if err = rows.Err(); err != nil { ··· 305 306 func GetProfile(e Execer, did string) (*models.Profile, error) { 307 var profile models.Profile 308 profile.Did = did 309 310 includeBluesky := 0 ··· 312 err := e.QueryRow( 313 `select description, include_bluesky, location, pronouns from profile where did = ?`, 314 did, 315 - ).Scan(&profile.Description, &includeBluesky, &profile.Location, &profile.Pronouns) 316 if err == sql.ErrNoRows { 317 profile := models.Profile{} 318 profile.Did = did ··· 327 profile.IncludeBluesky = true 328 } 329 330 rows, err := e.Query(`select link from profile_links where did = ?`, did) 331 if err != nil { 332 return nil, err
··· 234 for rows.Next() { 235 var profile models.Profile 236 var includeBluesky int 237 + var pronouns sql.Null[string] 238 239 + err = rows.Scan(&profile.ID, &profile.Did, &profile.Description, &includeBluesky, &profile.Location, &pronouns) 240 if err != nil { 241 return nil, err 242 } ··· 245 profile.IncludeBluesky = true 246 } 247 248 + if pronouns.Valid { 249 + profile.Pronouns = pronouns.V 250 + } 251 + 252 profileMap[profile.Did] = &profile 253 } 254 if err = rows.Err(); err != nil { ··· 310 311 func GetProfile(e Execer, did string) (*models.Profile, error) { 312 var profile models.Profile 313 + var pronouns sql.Null[string] 314 + 315 profile.Did = did 316 317 includeBluesky := 0 ··· 319 err := e.QueryRow( 320 `select description, include_bluesky, location, pronouns from profile where did = ?`, 321 did, 322 + ).Scan(&profile.Description, &includeBluesky, &profile.Location, &pronouns) 323 if err == sql.ErrNoRows { 324 profile := models.Profile{} 325 profile.Did = did ··· 334 profile.IncludeBluesky = true 335 } 336 337 + if pronouns.Valid { 338 + profile.Pronouns = pronouns.V 339 + } 340 + 341 rows, err := e.Query(`select link from profile_links where did = ?`, did) 342 if err != nil { 343 return nil, err
appview/ingester.go

This file has not been changed.

appview/models/profile.go

This file has not been changed.

appview/pages/templates/user/fragments/editBio.html

This file has not been changed.

appview/pages/templates/user/fragments/profileCard.html

This file has not been changed.

appview/state/profile.go

This file has not been changed.

lexicons/actor/profile.json

This file has not been changed.

History

4 rounds 5 comments
sign up or login to add to the discussion
1 commit
expand
appview: add personal pronouns to profile
expand 1 comment

lgtm thanks!

pull request successfully merged
1 commit
expand
appview: add personal pronouns to profile
expand 1 comment

this is looking pretty neat! i'd like the pronouns column to still be nullable however. we can use pronouns sql.Null[String] in the scanner instead, and do a pronouns.Valid check before assigning to the profile.

1 commit
expand
appview: add personal pronouns to profile
expand 0 comments
1 commit
expand
appview: add personal pronouns to profile
expand 3 comments

thanks for the PR! couple of things:

  • the timeline fails to load, GetProfiles does not handle null pronouns gracefully
  • can we use text-gray-500 dark:text-gray-400 on the rendered field?

otherwise, quite happy with this changeset!

thanks, let me do those changes

updated the PR