posts: add client tag when posting and replying
This should help us a bit with seeing notedeck usage. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
13
src/post.rs
13
src/post.rs
@@ -7,13 +7,20 @@ pub struct NewPost {
|
||||
pub account: FullKeypair,
|
||||
}
|
||||
|
||||
fn add_client_tag(builder: NoteBuilder<'_>) -> NoteBuilder<'_> {
|
||||
builder
|
||||
.start_tag()
|
||||
.tag_str("client")
|
||||
.tag_str("Damus Notedeck")
|
||||
}
|
||||
|
||||
impl NewPost {
|
||||
pub fn new(content: String, account: FullKeypair) -> Self {
|
||||
NewPost { content, account }
|
||||
}
|
||||
|
||||
pub fn to_note(&self, seckey: &[u8; 32]) -> Note {
|
||||
NoteBuilder::new()
|
||||
add_client_tag(NoteBuilder::new())
|
||||
.kind(1)
|
||||
.content(&self.content)
|
||||
.sign(seckey)
|
||||
@@ -22,7 +29,9 @@ impl NewPost {
|
||||
}
|
||||
|
||||
pub fn to_reply(&self, seckey: &[u8; 32], replying_to: &Note) -> Note {
|
||||
let builder = NoteBuilder::new().kind(1).content(&self.content);
|
||||
let builder = add_client_tag(NoteBuilder::new())
|
||||
.kind(1)
|
||||
.content(&self.content);
|
||||
|
||||
let nip10 = NoteReply::new(replying_to.tags());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user