make a confirmation for contact visibility

This commit is contained in:
2024-01-05 12:14:56 -07:00
parent c1361e088f
commit ec6175a550

View File

@@ -118,7 +118,7 @@
<div v-if="activeDid">
<button
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)"
title="They can see you"
>
@@ -126,14 +126,14 @@
</button>
<button
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)"
title="They cannot see you"
>
<fa icon="eye-slash" class="fa-fw" />
</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)"
title="Check Visibility"
v-if="activeDid"
@@ -571,17 +571,7 @@ export default class ContactsView extends Vue {
} else {
addedMessage = newContact.name + " was added.";
}
this.$notify(
{
group: "alert",
type: "success",
title: "Contact Added",
text: addedMessage,
},
5000,
);
if (this.isRegistered) {
// putting this last so that it shows on the top
this.$notify(
{
group: "alert",
@@ -595,6 +585,15 @@ export default class ContactsView extends Vue {
-1,
);
}
this.$notify(
{
group: "alert",
type: "success",
title: "Contact Added",
text: addedMessage,
},
5000,
);
})
.catch((err) => {
console.error("Error when adding contact to storage:", err);
@@ -754,6 +753,12 @@ export default class ContactsView extends Vue {
visibility: 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 =
this.apiServer +
"/api/report/" +
@@ -813,6 +818,7 @@ export default class ContactsView extends Vue {
);
}
}
}
async checkVisibility(contact: Contact) {
const url =