Browse Source

make a confirmation for contact visibility

starred-projects
Trent Larson 10 months ago
parent
commit
ec6175a550
  1. 32
      src/views/ContactsView.vue

32
src/views/ContactsView.vue

@ -118,7 +118,7 @@
<div v-if="activeDid"> <div v-if="activeDid">
<button <button
v-if="contact.seesMe" v-if="contact.seesMe"
class="text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md" class="text-sm uppercase bg-slate-500 text-white mx-0.5 my-0.5 px-2 py-1.5 rounded-md"
@click="setVisibility(contact, false, true)" @click="setVisibility(contact, false, true)"
title="They can see you" title="They can see you"
> >
@ -126,14 +126,14 @@
</button> </button>
<button <button
v-else v-else
class="text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md" class="text-sm uppercase bg-slate-500 text-white mx-0.5 my-0.5 px-2 py-1.5 rounded-md"
@click="setVisibility(contact, true, true)" @click="setVisibility(contact, true, true)"
title="They cannot see you" title="They cannot see you"
> >
<fa icon="eye-slash" class="fa-fw" /> <fa icon="eye-slash" class="fa-fw" />
</button> </button>
<button <button
class="text-sm uppercase bg-slate-500 text-white px-2 py-1.5 rounded-md" class="text-sm uppercase bg-slate-500 text-white mx-0.5 my-0.5 px-2 py-1.5 rounded-md"
@click="checkVisibility(contact)" @click="checkVisibility(contact)"
title="Check Visibility" title="Check Visibility"
v-if="activeDid" v-if="activeDid"
@ -571,17 +571,7 @@ export default class ContactsView extends Vue {
} else { } else {
addedMessage = newContact.name + " was added."; addedMessage = newContact.name + " was added.";
} }
this.$notify(
{
group: "alert",
type: "success",
title: "Contact Added",
text: addedMessage,
},
5000,
);
if (this.isRegistered) { if (this.isRegistered) {
// putting this last so that it shows on the top
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
@ -595,6 +585,15 @@ export default class ContactsView extends Vue {
-1, -1,
); );
} }
this.$notify(
{
group: "alert",
type: "success",
title: "Contact Added",
text: addedMessage,
},
5000,
);
}) })
.catch((err) => { .catch((err) => {
console.error("Error when adding contact to storage:", err); console.error("Error when adding contact to storage:", err);
@ -754,6 +753,12 @@ export default class ContactsView extends Vue {
visibility: boolean, visibility: boolean,
showSuccessAlert: boolean, showSuccessAlert: boolean,
) { ) {
const visibilityPrompt =
showSuccessAlert &&
(visibility
? "Are you sure you want to make your activity visible to them?"
: "Are you sure you want to hide all your activity from them?");
if (visibilityPrompt && confirm(visibilityPrompt)) {
const url = const url =
this.apiServer + this.apiServer +
"/api/report/" + "/api/report/" +
@ -813,6 +818,7 @@ export default class ContactsView extends Vue {
); );
} }
} }
}
async checkVisibility(contact: Contact) { async checkVisibility(contact: Contact) {
const url = const url =

Loading…
Cancel
Save