-
-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text formatting overhaul #1406
Text formatting overhaul #1406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good to me so far, thanks for all your hard work!
I left some comments where I didn't fully understand stuff, but I should also add a disclaimer that:
a) my brain is tired today and
b) text / unicode stuff is far from my specialty in any case
Another question, and again perhaps it's already explained in the code and i just missed it because brain tired: does a remote lookup still happen when you mention an account that hasn't been dereferenced yet? Eg., if I mention @[email protected]
will my instance try to webfinger + GET the AP representation of that account from somewhere.com
? It did already, just wanna check that it still does.
I kept all of the logic for ingesting mentions and hashtags, it's just been relocated. Specifically I'm pretty sure that this happens in the |
internal/db/bundb/bundb.go
Outdated
if err := dbService.conn.NewSelect().Model(tag).Where("LOWER(?) = LOWER(?)", bun.Ident("name"), t).Scan(ctx); err != nil { | ||
if err == sql.ErrNoRows { | ||
// tag doesn't exist yet so populate it | ||
newID, err := id.NewRandomULID() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tsmethurst do we want to be using NewULID()
here or this NewRandomULID()
? I know the latter uses a random timestamp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think NewRandomULID
is OK here because we'll probably not be paging through hashtags chronologically (unless you can think of a case where we'll do that?).
Description
This pulled request implements all of the changes suggested here as well as a few other so-called "improvements"
Summary of changes:
Formatter.FromEmojiOnly
, which makes use of the existing goldmark parser to find emojis in a text (e.g. a display name) without processing mentions or tags.Formatter.FromPlain
to use a modified goldmark parser.closes #1271
closes #789
Checklist
Please put an x inside each checkbox to indicate that you've read and followed it:
[ ]
->[x]
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
go fmt ./...
andgolangci-lint run
.