mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
do not add unnecessary tags when mentioning people.
This commit is contained in:
parent
bc88fe979c
commit
7540ee473a
@ -183,13 +183,22 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
ui.menu_button("@", |ui| {
|
ui.menu_button("@", |ui| {
|
||||||
for pair in pairs {
|
for pair in pairs {
|
||||||
if ui.button(pair.0).clicked() {
|
if ui.button(pair.0).clicked() {
|
||||||
|
let idx = app
|
||||||
|
.draft_tags
|
||||||
|
.iter()
|
||||||
|
.position(|tag| match tag {
|
||||||
|
Tag::Pubkey { pubkey, .. } if pubkey.0 == *pair.1 => true,
|
||||||
|
_ => false,
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| {
|
||||||
app.draft_tags.push(Tag::Pubkey {
|
app.draft_tags.push(Tag::Pubkey {
|
||||||
pubkey: pair.1,
|
pubkey: pair.1,
|
||||||
recommended_relay_url: None, // FIXME
|
recommended_relay_url: None, // FIXME
|
||||||
petname: None,
|
petname: None,
|
||||||
});
|
});
|
||||||
app.draft
|
app.draft_tags.len() - 1
|
||||||
.push_str(&format!("#[{}]", app.draft_tags.len() - 1));
|
});
|
||||||
|
app.draft.push_str(&format!("#[{}]", idx));
|
||||||
app.tag_someone = "".to_owned();
|
app.tag_someone = "".to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user