Browse Source

show warning about using nostr, and show errors if location was enabled but data is missing

master
Trent Larson 6 days ago
parent
commit
be010f7777
  1. 43
      src/views/NewEditProjectView.vue

43
src/views/NewEditProjectView.vue

@ -152,11 +152,13 @@
<div class="flex" @click="sendToTrustroots = !sendToTrustroots"> <div class="flex" @click="sendToTrustroots = !sendToTrustroots">
<input type="checkbox" class="mr-2" v-model="sendToTrustroots" /> <input type="checkbox" class="mr-2" v-model="sendToTrustroots" />
<label>Send to Trustroots</label> <label>Send to Trustroots</label>
<fa icon="circle-info" class="text-blue-500 ml-2 cursor-pointer" @click.stop="showNostrPartnerInfo" />
</div> </div>
<!-- <!--
<div class="flex" @click="sendToTripHopping = !sendToTripHopping"> <div class="flex" @click="sendToTripHopping = !sendToTripHopping">
<input type="checkbox" class="mr-2" v-model="sendToTripHopping" /> <input type="checkbox" class="mr-2" v-model="sendToTripHopping" />
<label>Send to TripHopping</label> <label>Send to TripHopping</label>
<fa icon="circle-info" class="text-blue-500 ml-2 cursor-pointer" @click.stop="showNostrPartnerInfo" />
</div> </div>
--> -->
</div> </div>
@ -408,6 +410,18 @@ export default class NewEditProjectView extends Vue {
delete vcClaim.image; delete vcClaim.image;
} }
if (this.includeLocation) { if (this.includeLocation) {
if (!this.latitude || !this.longitude) {
this.$notify(
{
group: "alert",
type: "danger",
title: "Location Error",
text: "The location was invalid so it was not set.",
},
5000,
);
delete vcClaim.location;
} else {
vcClaim.location = { vcClaim.location = {
geo: { geo: {
"@type": "GeoCoordinates", "@type": "GeoCoordinates",
@ -415,6 +429,7 @@ export default class NewEditProjectView extends Vue {
longitude: this.longitude, longitude: this.longitude,
}, },
}; };
}
} else { } else {
delete vcClaim.location; delete vcClaim.location;
} }
@ -431,7 +446,7 @@ export default class NewEditProjectView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error", title: "Date Error",
text: "The date was invalid so it was not set.", text: "The date was invalid so it was not set.",
}, },
5000, 5000,
@ -455,6 +470,8 @@ export default class NewEditProjectView extends Vue {
const projectPath = encodeURIComponent(resp.data.success.handleId); const projectPath = encodeURIComponent(resp.data.success.handleId);
if (this.sendToTrustroots || this.sendToTripHopping) {
if (this.latitude && this.longitude) {
let signedPayload: VerifiedEvent | undefined; // sign something to prove ownership of pubkey let signedPayload: VerifiedEvent | undefined; // sign something to prove ownership of pubkey
if (this.sendToTrustroots) { if (this.sendToTrustroots) {
signedPayload = await this.signPayload(); signedPayload = await this.signPayload();
@ -476,6 +493,18 @@ export default class NewEditProjectView extends Vue {
signedPayload, signedPayload,
); );
} }
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Partner Error",
text: "A partner was selected but the location was not set, so it was not sent to any partner.",
},
5000,
);
}
}
(this.$router as Router).push({ path: "/project/" + projectPath }); (this.$router as Router).push({ path: "/project/" + projectPath });
} else { } else {
@ -689,5 +718,17 @@ export default class NewEditProjectView extends Vue {
public onCancelClick() { public onCancelClick() {
(this.$router as Router).back(); (this.$router as Router).back();
} }
public showNostrPartnerInfo() {
this.$notify(
{
group: "alert",
type: "info",
title: "About Nostr Events",
text: "This will cause a submission to a partner on the nostr network. It will contain your public key data which may allow correlation, so don't allow this if you're not comfortable with that.",
},
7000,
);
}
} }
</script> </script>

Loading…
Cancel
Save