Browse Source

chore: remove old 'master' settings concept outside PlatformServiceMixin

pull/205/head
Trent Larson 2 weeks ago
parent
commit
0c627f4822
  1. 12
      src/utils/PlatformServiceMixin.ts
  2. 2
      src/views/ContactAmountsView.vue

12
src/utils/PlatformServiceMixin.ts

@ -514,7 +514,7 @@ export const PlatformServiceMixin = {
* Utility method for retrieving master settings * Utility method for retrieving master settings
* Common pattern used across many components * Common pattern used across many components
*/ */
async $getMasterSettings( async _getMasterSettings(
fallback: Settings | null = null, fallback: Settings | null = null,
): Promise<Settings | null> { ): Promise<Settings | null> {
try { try {
@ -571,7 +571,7 @@ export const PlatformServiceMixin = {
): Promise<Settings> { ): Promise<Settings> {
try { try {
// Get default settings // Get default settings
const defaultSettings = await this.$getMasterSettings(defaultFallback); const defaultSettings = await this._getMasterSettings(defaultFallback);
// If no account DID, return defaults // If no account DID, return defaults
if (!accountDid) { if (!accountDid) {
@ -970,7 +970,7 @@ export const PlatformServiceMixin = {
* @returns Fresh settings object from database * @returns Fresh settings object from database
*/ */
async $settings(defaults: Settings = {}): Promise<Settings> { async $settings(defaults: Settings = {}): Promise<Settings> {
const settings = await this.$getMasterSettings(defaults); const settings = await this._getMasterSettings(defaults);
if (!settings) { if (!settings) {
return defaults; return defaults;
@ -1003,7 +1003,7 @@ export const PlatformServiceMixin = {
): Promise<Settings> { ): Promise<Settings> {
try { try {
// Get default settings first // Get default settings first
const defaultSettings = await this.$getMasterSettings(defaults); const defaultSettings = await this._getMasterSettings(defaults);
if (!defaultSettings) { if (!defaultSettings) {
return defaults; return defaults;
@ -1848,7 +1848,7 @@ export const PlatformServiceMixin = {
async $debugMergedSettings(did: string): Promise<void> { async $debugMergedSettings(did: string): Promise<void> {
try { try {
// Get default settings // Get default settings
const defaultSettings = await this.$getMasterSettings({}); const defaultSettings = await this._getMasterSettings({});
logger.debug( logger.debug(
`[PlatformServiceMixin] Default settings:`, `[PlatformServiceMixin] Default settings:`,
defaultSettings, defaultSettings,
@ -1898,7 +1898,6 @@ export interface IPlatformServiceMixin {
params?: unknown[], params?: unknown[],
): Promise<SqlValue[] | undefined>; ): Promise<SqlValue[] | undefined>;
$dbRawQuery(sql: string, params?: unknown[]): Promise<unknown | undefined>; $dbRawQuery(sql: string, params?: unknown[]): Promise<unknown | undefined>;
$getMasterSettings(fallback?: Settings | null): Promise<Settings | null>;
$getMergedSettings( $getMergedSettings(
defaultKey: string, defaultKey: string,
accountDid?: string, accountDid?: string,
@ -2023,7 +2022,6 @@ declare module "@vue/runtime-core" {
params?: unknown[], params?: unknown[],
): Promise<unknown[] | undefined>; ): Promise<unknown[] | undefined>;
$dbRawQuery(sql: string, params?: unknown[]): Promise<unknown | undefined>; $dbRawQuery(sql: string, params?: unknown[]): Promise<unknown | undefined>;
$getMasterSettings(defaults?: Settings | null): Promise<Settings | null>;
$getMergedSettings( $getMergedSettings(
key: string, key: string,
did?: string, did?: string,

2
src/views/ContactAmountsView.vue

@ -223,7 +223,7 @@ export default class ContactAmountssView extends Vue {
const contact = await this.$getContact(contactDid); const contact = await this.$getContact(contactDid);
this.contact = contact; this.contact = contact;
const settings = await this.$getMasterSettings(); const settings = await this.$settings();
// Get activeDid from active_identity table (single source of truth) // Get activeDid from active_identity table (single source of truth)
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any

Loading…
Cancel
Save