Skip to content

Commit

Permalink
fix clicks on username/mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
kpfaulkner committed May 26, 2024
1 parent 1dd8514 commit 90eeeeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var (
AccountID int64
Version = "0.1.0"
Version = "0.1.1"
)

func setupLogging() {
Expand Down
8 changes: 4 additions & 4 deletions ui/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ func (u *UI) handleMessageColumnEvents(gtx layout.Context) error {
}

if username, ok := o.Get("username").(string); ok && username != "" {
if userID, ok := o.Get("userID").(string); ok && userID != "" {
if userID, ok := o.Get("userID").(mastodon.ID); ok && userID != "" {
log.Debugf("username clicked %s : %s\n", username, userID)
u.addNewUsernameColumn(username, userID)
u.addNewUsernameColumn(username, string(userID))
}
}

Expand All @@ -481,9 +481,9 @@ func (u *UI) handleMessageColumnEvents(gtx layout.Context) error {
case richtext.Click:

if username, ok := o.Get("username").(string); ok && username != "" {
if userID, ok := o.Get("userID").(string); ok && userID != "" {
if userID, ok := o.Get("userID").(mastodon.ID); ok && userID != "" {
log.Debugf("username clicked %s : %s\n", username, userID)
u.addNewUsernameColumn(username, userID)
u.addNewUsernameColumn(username, string(userID))
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ui/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func (ss *StatusState) generateDetailsSpanStyles(status mastodon.Status) []richt
// search for mentions in status
for _, mention := range mentions {
if mention.Username == path.Base(linkText)[1:] {
span.Set("userID", fmt.Sprintf("%d", mention.ID))
span.Set("userID", mention.ID)
}
}
}
Expand Down Expand Up @@ -384,7 +384,7 @@ func (ss *StatusState) generateNameSpanStyles(status mastodon.Status) []richtext
Interactive: true,
}
span.Set("username", status.Account.Username)
span.Set("userID", fmt.Sprintf("%d", status.Account.ID))
span.Set("userID", status.Account.ID)
spans = append(spans, span)
} else {
if status.Reblog != nil {
Expand All @@ -396,7 +396,7 @@ func (ss *StatusState) generateNameSpanStyles(status mastodon.Status) []richtext
Interactive: true,
}
span.Set("username", status.Account.Username)
span.Set("userID", fmt.Sprintf("%d", status.Account.ID))
span.Set("userID", status.Account.ID)
spans = append(spans, span)

span2 := richtext.SpanStyle{
Expand Down

0 comments on commit 90eeeeb

Please sign in to comment.