-
-
Notifications
You must be signed in to change notification settings - Fork 124
feat(socialPoster): add Nostr pubkey tagging with hideNostr check in … #2100
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
base: master
Are you sure you want to change the base?
Conversation
worker/socialPoster.js
Outdated
await nostr.publish({ | ||
created_at: Math.floor(new Date().getTime() / 1000), | ||
content: message, | ||
tags: [], | ||
tags: nostrPubkey ? [['p', nostrPubkey]] : [], | ||
kind: 1 | ||
}, { |
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.
You are tagging the user, but we want to mention them like in this note:
edit: Sorry, just realized my ticket was not clear on that since I used "tag" in the title but then used "mention" in the description. I meant "mention" like I showed in the example note.
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.
14769be
to
5fda156
Compare
Hi @ekzyis , I've addressed all feedback provided, please have another look. |
5fda156
to
06d02cd
Compare
worker/socialPoster.js
Outdated
|
||
const message = await itemToMessage({ item, postAuthorNostrProfile }) | ||
console.log('Message:', message) | ||
await postToTwitter({ message }) |
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 includes the nostr mention in the twitter message. This will look bad on twitter.
worker/socialPoster.js
Outdated
return `${item.title} | ||
|
||
by ${item.userName} in ~${item.subName} | ||
by ${item.userName}${postAuthorNostrProfile ? `, nostr profile: nostr:${postAuthorNostrProfile}` : ''} in ~${item.subName} |
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.
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.
Was not clarified @ekzyis, I assumed we'd want to know the username on stacker too
06d02cd
to
392e62a
Compare
Please have another look. @ekzyis |
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.
According to nip 27 you'll also want to add a p
tag.
worker/socialPoster.js
Outdated
|
||
const postAuthor = await models.user.findUnique({ | ||
where: { id: item.userId, hideNostr: false }, | ||
select: { nostrPubkey: true } |
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.
You're going to want to also check nostrAuthPubkey
... sorry, we have two ways of adding a nostr pubkey.
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.
Got it, tested with an account with both assigned as well as either one assigned. Latest seems to work for both.
lib/nostr.js
Outdated
|
||
export function getNostrProfile (pubkey) { | ||
try { | ||
const { data } = nip19.decode(pubkey) |
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.
We store all nostr pubkeys in hex so you don't need to do this + throws an error when it encounters hex.
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.
@huumn the |
3b5ef22
to
760cbbb
Compare
Requested changes addressed, please have a look. @huumn |
Description
Add Nostr pubkey tagging with hideNostr check in social poster, using the NIP as guidance I've included the item author as a 'p' tag in the npub.
I created a test social post using the socialPoster worker: to check that the tag is added.
closes #2090
Screenshots
Additional Context
Was anything unclear during your work on this PR? Anything we should definitely take a closer look at?
Checklist
Are your changes backwards compatible? Please answer below:
yes
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
10
For frontend changes: Tested on mobile, light and dark mode? Please answer below:
n/a
Did you introduce any new environment variables? If so, call them out explicitly here:
no