Yōten: A social tracker for your language learning journey built on the atproto.

fix: null reference access via links on study sessions

brookjeynes.dev b14eaba4 ed17ed61

verified
+7 -3
+2
internal/server/handlers/resource.go
··· 203 203 Properties: posthog.NewProperties(). 204 204 Set("resource_id", newResource.ID). 205 205 Set("resource_type", newResource.Type). 206 + Set("title", newResource.Title). 206 207 Set("title_length", len(newResource.Title)). 207 208 Set("description_length", len(newResource.Description)). 208 209 Set("link_provided", newResource.Link != nil), ··· 443 444 Properties: posthog.NewProperties(). 444 445 Set("resource_id", updatedResource.ID). 445 446 Set("resource_type", updatedResource.Type). 447 + Set("title", updatedResource.Title). 446 448 Set("title_length", len(updatedResource.Title)). 447 449 Set("description_length", len(updatedResource.Description)). 448 450 Set("link_provided", updatedResource.Link != nil),
+5 -3
internal/server/views/partials/study-session.templ
··· 124 124 <a 125 125 rel="noopener noreferrer" 126 126 target="_blank" 127 - href={ templ.URL(*params.StudySession.Resource.Link) } 128 - aria-label={ fmt.Sprintf("Visit %s", *params.StudySession.Resource.Link) } 129 - title={ fmt.Sprintf("Visit %s", *params.StudySession.Resource.Link) } 127 + if params.StudySession.Resource.Link != nil { 128 + href={ templ.URL(*params.StudySession.Resource.Link) } 129 + aria-label={ fmt.Sprintf("Visit %s", *params.StudySession.Resource.Link) } 130 + title={ fmt.Sprintf("Visit %s", *params.StudySession.Resource.Link) } 131 + } 130 132 class="flex flex-col sm:flex-row sm:items-center gap-2 py-2 px-4 bg-gray-light hover:opacity-75 rounded-md" 131 133 > 132 134 <div class="flex items-center gap-2 flex-1 min-w-0">