url-encode the ssb id for profile buttons

This commit is contained in:
mycognosist 2022-06-14 09:03:08 +01:00
parent bf7f2c8e31
commit f3d4ba9fe5
1 changed files with 10 additions and 5 deletions

View File

@ -83,13 +83,15 @@ fn social_interaction_buttons_template(profile: &Profile) -> Markup {
@match (profile.following, &profile.id) {
(Some(false), Some(ssb_id)) => {
form id="followForm" class="center" action="/scuttlebutt/follow" method="post" {
input type="hidden" id="publicKey" name="public_key" value=(ssb_id);
// url encode the ssb_id value
input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F"));
input id="followPeer" class="button button-primary center" type="submit" title="Follow Peer" value="Follow";
}
},
(Some(true), Some(ssb_id)) => {
form id="unfollowForm" class="center" action="/scuttlebutt/unfollow" method="post" {
input type="hidden" id="publicKey" name="public_key" value=(ssb_id);
// url encode the ssb_id value
input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F"));
input id="unfollowPeer" class="button button-primary center" type="submit" title="Unfollow Peer" value="Unfollow";
}
},
@ -98,13 +100,15 @@ fn social_interaction_buttons_template(profile: &Profile) -> Markup {
@match (profile.blocking, &profile.id) {
(Some(false), Some(ssb_id)) => {
form id="blockForm" class="center" action="/scuttlebutt/block" method="post" {
input type="hidden" id="publicKey" name="public_key" value=(ssb_id);
// url encode the ssb_id value
input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F"));
input id="blockPeer" class="button button-primary center" type="submit" title="Block Peer" value="Block";
}
},
(Some(true), Some(ssb_id)) => {
form id="unblockForm" class="center" action="/scuttlebutt/unblock" method="post" {
input type="hidden" id="publicKey" name="public_key" value=(ssb_id);
// url encode the ssb_id value
input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F"));
input id="unblockPeer" class="button button-primary center" type="submit" title="Unblock Peer" value="Unblock";
}
},
@ -112,7 +116,8 @@ fn social_interaction_buttons_template(profile: &Profile) -> Markup {
}
@if let Some(ssb_id) = &profile.id {
form class="center" {
a id="privateMessage" class="button button-primary center" href={ "/scuttlebutt/private/" (ssb_id) } title="Private Message" {
// url encode the ssb_id
a id="privateMessage" class="button button-primary center" href={ "/scuttlebutt/private/" (ssb_id.replace('/', "%2F")) } title="Private Message" {
"Send Private Message"
}
}