Complete notification migration across 13 components and views

- Replace raw $notify calls with notification helper system
- Add createNotifyHelpers and TIMEOUTS constants integration
- Migrate AccountViewView, ClaimAddRawView, ContactGiftingView, ContactImportView, ContactsView, NewActivityView, ProjectViewView, RecentOffersToUserProjectsView, RecentOffersToUserView, ShareMyContactInfoView
- Update MembersList, TopMessage, UserNameDialog components
- Add notification constants for standardized messaging
- Enhance validation script to eliminate false positives
- Achieve 86% notification migration completion rate
This commit is contained in:
Matthew Raymer
2025-07-07 06:53:30 +00:00
parent ea851a7dfd
commit a5784cdfc1
15 changed files with 345 additions and 592 deletions

View File

@@ -599,7 +599,6 @@ import QuickNav from "../components/QuickNav.vue";
import EntityIcon from "../components/EntityIcon.vue";
import ProjectIcon from "../components/ProjectIcon.vue";
import { APP_SERVER, NotificationIface } from "../constants/app";
import * as databaseUtil from "../db/databaseUtil";
import { logConsoleAndDb } from "../db/index";
import { Contact } from "../db/tables/contacts";
import * as libsUtil from "../libs/util";
@@ -607,9 +606,10 @@ import * as serverUtil from "../libs/endorserServer";
import { retrieveAccountDids } from "../libs/util";
import HiddenDidDialog from "../components/HiddenDidDialog.vue";
import { logger } from "../utils/logger";
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
import { useClipboard } from "@vueuse/core";
import { transformImageUrlForCors } from "../libs/util";
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
/**
* Project View Component
* @author Matthew Raymer
@@ -652,6 +652,7 @@ import { transformImageUrlForCors } from "../libs/util";
QuickNav,
TopMessage,
},
mixins: [PlatformServiceMixin],
})
export default class ProjectViewView extends Vue {
/** Notification function injected by Vue */
@@ -659,6 +660,9 @@ export default class ProjectViewView extends Vue {
/** Router instance for navigation */
$router!: Router;
/** Notification helpers instance */
notify!: ReturnType<typeof createNotifyHelpers>;
// Account and Settings State
/** Currently active DID */
activeDid = "";
@@ -752,14 +756,12 @@ export default class ProjectViewView extends Vue {
* @emits Notification on profile loading errors
*/
async created() {
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
this.notify = createNotifyHelpers(this.$notify);
const settings = await this.$accountSettings();
this.activeDid = settings.activeDid || "";
this.apiServer = settings.apiServer || "";
const platformService = PlatformServiceFactory.getInstance();
const queryResult = await platformService.dbQuery("SELECT * FROM contacts");
this.allContacts = databaseUtil.mapQueryResultToValues(
queryResult,
) as unknown as Contact[];
this.allContacts = await this.$getAllContacts();
this.isRegistered = !!settings.isRegistered;
try {
@@ -770,14 +772,9 @@ export default class ProjectViewView extends Vue {
"Error retrieving all account DIDs on home page:" + error,
true,
);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error Loading Profile",
text: "See the Help page to fix problems with your personal data.",
},
5000,
this.notify.error(
"See the Help page to fix problems with your personal data.",
TIMEOUTS.LONG,
);
}
@@ -809,14 +806,9 @@ export default class ProjectViewView extends Vue {
useClipboard()
.copy(deepLink)
.then(() => {
this.$notify(
{
group: "alert",
type: "toast",
title: "Copied",
text: "A link to this project was copied to the clipboard.",
},
2000,
this.notify.copied(
"link to this project",
TIMEOUTS.SHORT,
);
});
}
@@ -877,26 +869,16 @@ export default class ProjectViewView extends Vue {
} else {
// actually, axios throws an error on 404 so we probably never get here
logger.error("Error getting project:", resp);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "There was a problem getting that project.",
},
5000,
this.notify.error(
"There was a problem getting that project.",
TIMEOUTS.LONG,
);
}
} catch (error: unknown) {
logger.error("Error retrieving project:", error);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving that project.",
},
5000,
this.notify.error(
"Something went wrong retrieving that project.",
TIMEOUTS.LONG,
);
}
@@ -944,26 +926,16 @@ export default class ProjectViewView extends Vue {
this.givesToThis = this.givesToThis.concat(resp.data.data);
this.givesHitLimit = resp.data.hitLimit;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve more gives to this project.",
},
5000,
this.notify.error(
"Failed to retrieve more gives to this project.",
TIMEOUTS.LONG,
);
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving more gives to this project.",
},
5000,
this.notify.error(
"Something went wrong retrieving more gives to this project.",
TIMEOUTS.LONG,
);
logger.error(
"Something went wrong retrieving more gives to this project:",
@@ -1003,26 +975,16 @@ export default class ProjectViewView extends Vue {
);
this.givesProvidedByHitLimit = resp.data.hitLimit;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve gives that were provided by this project.",
},
5000,
this.notify.error(
"Failed to retrieve gives that were provided by this project.",
TIMEOUTS.LONG,
);
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving gives that were provided by this project.",
},
5000,
this.notify.error(
"Something went wrong retrieving gives that were provided by this project.",
TIMEOUTS.LONG,
);
logger.error(
"Something went wrong retrieving gives that were provided by this project:",
@@ -1059,26 +1021,16 @@ export default class ProjectViewView extends Vue {
this.offersToThis = this.offersToThis.concat(resp.data.data);
this.offersHitLimit = resp.data.hitLimit;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve more offers to this project.",
},
5000,
this.notify.error(
"Failed to retrieve more offers to this project.",
TIMEOUTS.LONG,
);
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving more offers to this project.",
},
5000,
this.notify.error(
"Something went wrong retrieving more offers to this project.",
TIMEOUTS.LONG,
);
logger.error(
"Something went wrong retrieving more offers to this project:",
@@ -1115,26 +1067,16 @@ export default class ProjectViewView extends Vue {
this.fulfillersToThis = this.fulfillersToThis.concat(resp.data.data);
this.fulfillersToHitLimit = resp.data.hitLimit;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve more plans that fullfill this project.",
},
5000,
this.notify.error(
"Failed to retrieve more plans that fullfill this project.",
TIMEOUTS.LONG,
);
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving more plans that fulfull this project.",
},
5000,
this.notify.error(
"Something went wrong retrieving more plans that fulfull this project.",
TIMEOUTS.LONG,
);
logger.error(
"Something went wrong retrieving more plans that fulfill this project:",
@@ -1162,26 +1104,16 @@ export default class ProjectViewView extends Vue {
if (resp.status === 200) {
this.fulfilledByThis = resp.data.data;
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to retrieve plans fulfilled by this project.",
},
5000,
this.notify.error(
"Failed to retrieve plans fulfilled by this project.",
TIMEOUTS.LONG,
);
}
} catch (error: unknown) {
const serverError = error as AxiosError;
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Something went wrong retrieving plans fulfilled by this project.",
},
5000,
this.notify.error(
"Something went wrong retrieving plans fulfilled by this project.",
TIMEOUTS.LONG,
);
logger.error(
"Error retrieving plans fulfilled by this project:",
@@ -1444,14 +1376,9 @@ export default class ProjectViewView extends Vue {
this.axios,
);
if (result.success) {
this.$notify(
{
group: "alert",
type: "success",
title: "Success",
text: "Confirmation submitted.",
},
5000,
this.notify.success(
"Confirmation submitted.",
TIMEOUTS.LONG,
);
this.recentlyCheckedAndUnconfirmableJwts = [
...this.recentlyCheckedAndUnconfirmableJwts,
@@ -1462,14 +1389,9 @@ export default class ProjectViewView extends Vue {
const message =
(result.error as string) ||
"There was a problem submitting the confirmation.";
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: message,
},
5000,
this.notify.error(
message,
TIMEOUTS.LONG,
);
}
}
@@ -1521,14 +1443,9 @@ export default class ProjectViewView extends Vue {
}
} catch (error) {
logger.error("Error loading totals:", error);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "Failed to load totals for this project.",
},
5000,
this.notify.error(
"Failed to load totals for this project.",
TIMEOUTS.LONG,
);
} finally {
this.loadingTotals = false;