Monorepo for Tangled tangled.org

appview: allow users to set their preferences for the punchcard being displayed #1077

merged opened by willdot.net targeting master from willdot.net/tangled-fork: punchcard-prefs

This allows users to set their preference for the punchcard.

It allows them to either:

1: Hide their punchcard so that no one can see it 2: Hide all punchcards so that they don't see anyones punchcards

Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:dadhhalkfcq3gucaq25hjqon/sh.tangled.repo.pull/3meygakiwru22
+2 -2
Interdiff #3 โ†’ #4
appview/db/db.go

This file has not been changed.

appview/db/preferences.go

This file has not been changed.

appview/db/profile.go

This file has not been changed.

appview/models/preferences.go

This file has not been changed.

appview/pages/pages.go

This file has not been changed.

appview/pages/templates/layouts/profilebase.html

This file has not been changed.

appview/pages/templates/user/settings/profile.html

This file has not been changed.

appview/settings/settings.go

This file has not been changed.

+2 -2
appview/state/profile.go
··· 167 167 168 168 loggedInUser := s.oauth.GetMultiAccountUser(r) 169 169 170 - showPunchcard := checkIfPunchcardShouldShow(profile.UserDid, loggedInUser.Did(), s.db, l) 170 + showPunchcard := checkIfPunchcardShouldShow(s.db, l, profile.UserDid, loggedInUser.Did()) 171 171 172 172 timeline, err := db.MakeProfileTimeline(s.db, profile.UserDid, showPunchcard) 173 173 if err != nil { ··· 184 184 }) 185 185 } 186 186 187 - func checkIfPunchcardShouldShow(targetDid, requesterDid string, e db.Execer, l *slog.Logger) bool { 187 + func checkIfPunchcardShouldShow(e db.Execer, l *slog.Logger, targetDid, requesterDid string) bool { 188 188 targetPunchcardPreferences, err := db.GetPunchcardPreference(e, targetDid) 189 189 if err != nil { 190 190 l.Error("failed to get target users punchcard preferences", "err", err)
appview/state/router.go

This file has not been changed.

History

5 rounds 3 comments
sign up or login to add to the discussion
1 commit
expand
appview: allow users to set their preferences for the punchcard being displayed
expand 1 comment

thanks for the work on this! this looks good to me in the current state.

pull request successfully merged
1 commit
expand
appview: allow users to set their preferences for the punchcard being displayed
expand 0 comments
1 commit
expand
appview: allow users to set their preferences for the punchcard being displayed
expand 0 comments
1 commit
expand
appview: allow users to set their preferences for the punchcard being displayed
expand 0 comments
1 commit
expand
appview: allow users to set their preferences for the punchcard being displayed
expand 2 comments
  • here: there is no bool type in sqlite! so we will have to use ints here. i tested this locally and it seems that is valid sql and executes fine, but it seems any value can be stored in that column.
  • here: nice, this is super neat

all in all, rest of the code lgtm!

Oh wow, TIL that there isn't a bool type in sqlite ๐Ÿซฃ

I've fixed that so that the field is an integer type with a default of 0 (false) and then added the relevant mapping into the query code to map 0 is false and > 0 is true.

Tested by stuffing random integers manually into the table and appears to work as expected.