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