@@ -37,7 +37,7 @@ impl PubkeySource {
|
|||||||
PubkeySource::Explicit(pubkey)
|
PubkeySource::Explicit(pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_pubkey<'a>(&'a self, deck_author: &'a Pubkey) -> &'a Pubkey {
|
pub fn as_pubkey<'a>(&'a self, deck_author: &'a Pubkey) -> &'a Pubkey {
|
||||||
match self {
|
match self {
|
||||||
PubkeySource::Explicit(pk) => pk,
|
PubkeySource::Explicit(pk) => pk,
|
||||||
PubkeySource::DeckAuthor => deck_author,
|
PubkeySource::DeckAuthor => deck_author,
|
||||||
@@ -93,7 +93,7 @@ impl ListKind {
|
|||||||
parser.parse_all(|p| {
|
parser.parse_all(|p| {
|
||||||
p.parse_token("contact")?;
|
p.parse_token("contact")?;
|
||||||
let pk_src = PubkeySource::parse_from_tokens(p)?;
|
let pk_src = PubkeySource::parse_from_tokens(p)?;
|
||||||
Ok(ListKind::Contact(*pk_src.to_pubkey(deck_author)))
|
Ok(ListKind::Contact(*pk_src.as_pubkey(deck_author)))
|
||||||
})
|
})
|
||||||
|
|
||||||
/* here for u when you need more things to parse
|
/* here for u when you need more things to parse
|
||||||
@@ -333,7 +333,7 @@ impl TimelineKind {
|
|||||||
let profile = parser.try_parse(|p| {
|
let profile = parser.try_parse(|p| {
|
||||||
p.parse_token("profile")?;
|
p.parse_token("profile")?;
|
||||||
let pk_src = PubkeySource::parse_from_tokens(p)?;
|
let pk_src = PubkeySource::parse_from_tokens(p)?;
|
||||||
Ok(TimelineKind::Profile(*pk_src.to_pubkey(deck_author)))
|
Ok(TimelineKind::Profile(*pk_src.as_pubkey(deck_author)))
|
||||||
});
|
});
|
||||||
if profile.is_ok() {
|
if profile.is_ok() {
|
||||||
return profile;
|
return profile;
|
||||||
@@ -343,7 +343,7 @@ impl TimelineKind {
|
|||||||
// still handle deprecated form (notifs)
|
// still handle deprecated form (notifs)
|
||||||
p.parse_any_token(&[NOTIFS_TOKEN, NOTIFS_TOKEN_DEPRECATED])?;
|
p.parse_any_token(&[NOTIFS_TOKEN, NOTIFS_TOKEN_DEPRECATED])?;
|
||||||
let pk_src = PubkeySource::parse_from_tokens(p)?;
|
let pk_src = PubkeySource::parse_from_tokens(p)?;
|
||||||
Ok(TimelineKind::Notifications(*pk_src.to_pubkey(deck_author)))
|
Ok(TimelineKind::Notifications(*pk_src.as_pubkey(deck_author)))
|
||||||
});
|
});
|
||||||
if notifications.is_ok() {
|
if notifications.is_ok() {
|
||||||
return notifications;
|
return notifications;
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ impl AddColumnOption {
|
|||||||
.into_timeline(&txn, ndb)
|
.into_timeline(&txn, ndb)
|
||||||
.map(AddColumnResponse::Timeline),
|
.map(AddColumnResponse::Timeline),
|
||||||
AddColumnOption::Notification(pubkey) => {
|
AddColumnOption::Notification(pubkey) => {
|
||||||
TimelineKind::Notifications(*pubkey.to_pubkey(&cur_account.map(|kp| kp.pubkey)?))
|
TimelineKind::Notifications(*pubkey.as_pubkey(&cur_account.map(|kp| kp.pubkey)?))
|
||||||
.into_timeline(&txn, ndb)
|
.into_timeline(&txn, ndb)
|
||||||
.map(AddColumnResponse::Timeline)
|
.map(AddColumnResponse::Timeline)
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ impl AddColumnOption {
|
|||||||
}
|
}
|
||||||
AddColumnOption::Contacts(pk_src) => {
|
AddColumnOption::Contacts(pk_src) => {
|
||||||
let tlk = TimelineKind::contact_list(
|
let tlk = TimelineKind::contact_list(
|
||||||
*pk_src.to_pubkey(&cur_account.map(|kp| kp.pubkey)?),
|
*pk_src.as_pubkey(&cur_account.map(|kp| kp.pubkey)?),
|
||||||
);
|
);
|
||||||
tlk.into_timeline(&txn, ndb)
|
tlk.into_timeline(&txn, ndb)
|
||||||
.map(AddColumnResponse::Timeline)
|
.map(AddColumnResponse::Timeline)
|
||||||
@@ -173,7 +173,7 @@ impl AddColumnOption {
|
|||||||
AddColumnOption::ExternalIndividual => Some(AddColumnResponse::ExternalIndividual),
|
AddColumnOption::ExternalIndividual => Some(AddColumnResponse::ExternalIndividual),
|
||||||
AddColumnOption::Individual(pubkey_source) => {
|
AddColumnOption::Individual(pubkey_source) => {
|
||||||
let tlk = TimelineKind::profile(
|
let tlk = TimelineKind::profile(
|
||||||
*pubkey_source.to_pubkey(&cur_account.map(|kp| kp.pubkey)?),
|
*pubkey_source.as_pubkey(&cur_account.map(|kp| kp.pubkey)?),
|
||||||
);
|
);
|
||||||
tlk.into_timeline(&txn, ndb)
|
tlk.into_timeline(&txn, ndb)
|
||||||
.map(AddColumnResponse::Timeline)
|
.map(AddColumnResponse::Timeline)
|
||||||
|
|||||||
Reference in New Issue
Block a user