From 378bae432391c8493ced94a8b7fc93dae4e9f39e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 2 Feb 2022 02:38:45 +0100 Subject: [PATCH 01/74] made decay block static removed duplicate implementation of decay calculation --- backend/src/config/index.ts | 1 + backend/src/graphql/model/Decay.ts | 2 +- .../graphql/resolver/TransactionResolver.ts | 40 +++------ backend/src/typeorm/repository/Transaction.ts | 7 -- backend/src/util/decay.ts | 90 +++++++------------ 5 files changed, 47 insertions(+), 93 deletions(-) diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index 99859b252..71d9415c0 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -5,6 +5,7 @@ dotenv.config() const constants = { DB_VERSION: '0016-transaction_signatures', + DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0 } const server = { diff --git a/backend/src/graphql/model/Decay.ts b/backend/src/graphql/model/Decay.ts index 48ed7b8c5..a09f7c97e 100644 --- a/backend/src/graphql/model/Decay.ts +++ b/backend/src/graphql/model/Decay.ts @@ -4,7 +4,7 @@ import { ObjectType, Field, Int } from 'type-graphql' @ObjectType() export class Decay { - constructor(json: any) { + constructor(json?: any) { if (json) { this.balance = Number(json.balance) this.decayStart = json.decay_start diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 61f590123..c674f36d1 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -29,7 +29,7 @@ import { Balance as dbBalance } from '@entity/Balance' import { apiPost } from '../../apis/HttpRequest' import { roundFloorFrom4, roundCeilFrom4 } from '../../util/round' -import { calculateDecay, calculateDecayWithInterval } from '../../util/decay' +import { calculateDecay } from '../../util/decay' import { TransactionTypeId } from '../enum/TransactionTypeId' import { TransactionType } from '../enum/TransactionType' import { hasUserAmount, isHexPublicKey } from '../../util/validate' @@ -68,8 +68,6 @@ async function calculateAndAddDecayTransactions( const userRepository = getCustomRepository(UserRepository) const userIndiced = await userRepository.getUsersIndiced(involvedUsersUnique) - const decayStartTransaction = await transactionRepository.findDecayStartBlock() - for (let i = 0; i < userTransactions.length; i++) { const userTransaction = userTransactions[i] const transaction = transactionIndiced[userTransaction.transactionId] @@ -82,26 +80,22 @@ async function calculateAndAddDecayTransactions( if (previousTransaction) { const currentTransaction = userTransaction - const decay = await calculateDecayWithInterval( + const decay = await calculateDecay( previousTransaction.balance, previousTransaction.balanceDate, currentTransaction.balanceDate, ) const balance = previousTransaction.balance - decay.balance - if ( - decayStartTransaction && - decayStartTransaction.received < currentTransaction.balanceDate - ) { + if (CONFIG.DECAY_START_TIME < currentTransaction.balanceDate) { finalTransaction.decay = decay finalTransaction.decay.balance = roundFloorFrom4(balance) if ( - decayStartTransaction && - previousTransaction.transactionId < decayStartTransaction.id && - currentTransaction.transactionId > decayStartTransaction.id + previousTransaction.balanceDate < CONFIG.DECAY_START_TIME && + currentTransaction.balanceDate > CONFIG.DECAY_START_TIME ) { finalTransaction.decay.decayStartBlock = ( - decayStartTransaction.received.getTime() / 1000 + CONFIG.DECAY_START_TIME.getTime() / 1000 ).toString() } } @@ -148,11 +142,7 @@ async function calculateAndAddDecayTransactions( if (i === userTransactions.length - 1 && decay) { const now = new Date() - const decay = await calculateDecayWithInterval( - userTransaction.balance, - userTransaction.balanceDate, - now.getTime(), - ) + const decay = await calculateDecay(userTransaction.balance, userTransaction.balanceDate, now) const balance = userTransaction.balance - decay.balance const decayTransaction = new Transaction() @@ -234,12 +224,8 @@ async function updateStateBalance( balance.amount = centAmount balance.modified = received } else { - const decaiedBalance = await calculateDecay(balance.amount, balance.recordDate, received).catch( - () => { - throw new Error('error by calculating decay') - }, - ) - balance.amount = Number(decaiedBalance) + centAmount + const decayedBalance = calculateDecay(balance.amount, balance.recordDate, received) + balance.amount = Number(decayedBalance) + centAmount balance.modified = new Date() } if (balance.amount <= 0) { @@ -263,13 +249,11 @@ async function addUserTransaction( const lastUserTransaction = await userTransactionRepository.findLastForUser(user.id) if (lastUserTransaction) { newBalance += Number( - await calculateDecay( + calculateDecay( Number(lastUserTransaction.balance), lastUserTransaction.balanceDate, transaction.received, - ).catch(() => { - throw new Error('error by calculating decay') - }), + ), ) } @@ -346,7 +330,7 @@ export class TransactionResolver { const now = new Date() transactions.balance = roundFloorFrom4(balanceEntity.amount) transactions.decay = roundFloorFrom4( - await calculateDecay(balanceEntity.amount, balanceEntity.recordDate, now), + calculateDecay(balanceEntity.amount, balanceEntity.recordDate, now).balance, ) transactions.decayDate = now.toString() } diff --git a/backend/src/typeorm/repository/Transaction.ts b/backend/src/typeorm/repository/Transaction.ts index ab09b2731..0a97067a2 100644 --- a/backend/src/typeorm/repository/Transaction.ts +++ b/backend/src/typeorm/repository/Transaction.ts @@ -3,13 +3,6 @@ import { Transaction } from '@entity/Transaction' @EntityRepository(Transaction) export class TransactionRepository extends Repository { - async findDecayStartBlock(): Promise { - return this.createQueryBuilder('transaction') - .where('transaction.transactionTypeId = :transactionTypeId', { transactionTypeId: 9 }) - .orderBy('received', 'ASC') - .getOne() - } - async joinFullTransactionsByIds(transactionIds: number[]): Promise { return this.createQueryBuilder('transaction') .where('transaction.id IN (:...transactions)', { transactions: transactionIds }) diff --git a/backend/src/util/decay.ts b/backend/src/util/decay.ts index 63cf9541d..7cb4ce384 100644 --- a/backend/src/util/decay.ts +++ b/backend/src/util/decay.ts @@ -1,70 +1,46 @@ -import { getCustomRepository } from '@dbTools/typeorm' +import CONFIG from '../config' import { Decay } from '../graphql/model/Decay' -import { TransactionRepository } from '../typeorm/repository/Transaction' function decayFormula(amount: number, seconds: number): number { return amount * Math.pow(0.99999997802044727, seconds) // This number represents 50% decay a year } -async function calculateDecay(amount: number, from: Date, to: Date): Promise { - if (amount === undefined || !from || !to) { - throw new Error('at least one parameter is undefined') +function calculateDecay(amount: number, from: Date, to: Date): Decay { + const fromMs = from.getTime() + const toMs = to.getTime() + const decayStartBlockMs = CONFIG.DECAY_START_TIME.getTime() + + if (toMs < fromMs) { + throw new Error('to < from, reverse decay calculation is invalid') } - if (from === to) { - return amount + + // Initialize with no decay + const decay = new Decay({ + balance: amount, + decayStart: null, + decayEnd: null, + decayDuration: 0, + decayStartBlock: (decayStartBlockMs / 1000).toString(), + }) + + // decay started after end date; no decay + if (decayStartBlockMs > toMs) { + return decay } - if (to < from) { - throw new Error('to < from, so the target date is in the past?') + // decay started before start date; decay for full duration + else if (decayStartBlockMs < fromMs) { + decay.decayStart = (fromMs / 1000).toString() + decay.decayDuration = (toMs - fromMs) / 1000 } - // load decay start block - const transactionRepository = getCustomRepository(TransactionRepository) - const decayStartBlock = await transactionRepository.findDecayStartBlock() - - // if decay hasn't started yet we return input amount - if (!decayStartBlock) return amount - - // what happens when from > to - // Do we want to have negative decay? - const decayDuration = (to.getTime() - from.getTime()) / 1000 - return decayFormula(amount, decayDuration) -} - -async function calculateDecayWithInterval( - amount: number, - from: number | Date, - to: number | Date, -): Promise { - const transactionRepository = getCustomRepository(TransactionRepository) - const decayStartBlock = await transactionRepository.findDecayStartBlock() - - const result = new Decay(undefined) - result.balance = amount - const fromMillis = typeof from === 'number' ? from : from.getTime() - const toMillis = typeof to === 'number' ? to : to.getTime() - result.decayStart = (fromMillis / 1000).toString() - result.decayEnd = (toMillis / 1000).toString() - - // (amount, from.getTime(), to.getTime()) - - // if no decay start block exist or decay startet after end date - if (!decayStartBlock || decayStartBlock.received.getTime() > toMillis) { - return result - } - const decayStartBlockMillis = decayStartBlock.received.getTime() - - // if decay start date is before start date we calculate decay for full duration - if (decayStartBlockMillis < fromMillis) { - result.decayDuration = toMillis - fromMillis - } - // if decay start in between start date and end date we caculcate decay from decay start time to end date + // decay started between start and end date; decay from decay start till end date else { - result.decayDuration = toMillis - decayStartBlockMillis - result.decayStart = (decayStartBlockMillis / 1000).toString() + decay.decayStart = (decayStartBlockMs / 1000).toString() + decay.decayDuration = (toMs - decayStartBlockMs) / 1000 } - // js use timestamp in milliseconds but we calculate with seconds - result.decayDuration /= 1000 - result.balance = decayFormula(amount, result.decayDuration) - return result + + decay.decayEnd = (toMs / 1000).toString() + decay.balance = decayFormula(amount, decay.decayDuration) + return decay } -export { decayFormula, calculateDecay, calculateDecayWithInterval } +export { decayFormula, calculateDecay } From 62ba171f8052e6275199837deb94c7e729d4c88a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 2 Feb 2022 02:58:49 +0100 Subject: [PATCH 02/74] migration to remove decay block from database --- .../0017-delete_decay_start_block.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 database/migrations/0017-delete_decay_start_block.ts diff --git a/database/migrations/0017-delete_decay_start_block.ts b/database/migrations/0017-delete_decay_start_block.ts new file mode 100644 index 000000000..819aa5c65 --- /dev/null +++ b/database/migrations/0017-delete_decay_start_block.ts @@ -0,0 +1,18 @@ +/* MIGRATION TO DELETE DECAY START BLOCK + * + * the decay start block is now specified as static value + * we can delete it from the database + */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // Remove transactions with type 9 (start decay block). This should affect exactly 1 row + await queryFn(`DELETE FROM transactions WHERE transaction_type_id = 9;`) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // When rolling back the database this entry is newly created. This should not hurt in any way tho. + await queryFn(` + INSERT INTO transactions + VALUES(1682,9,0xC27BE999D7B4704E5F294099E780C5D6A275B165AFABFD8BECCEA39059CBB7B600000000000000000000000000000000,'','2021-05-13 15:46:31',NULL,NULL) + `) +} From 736310f5d5ea4a00bc98a752d1e2ecefbf6a60af Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 2 Feb 2022 03:05:00 +0100 Subject: [PATCH 03/74] fix build error - type errors --- backend/src/graphql/resolver/AdminResolver.ts | 4 ++-- backend/src/graphql/resolver/BalanceResolver.ts | 2 +- backend/src/util/validate.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 4204c6c2f..0ecce0b13 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -215,11 +215,11 @@ export class AdminResolver { if (!lastUserTransaction) { newBalance = 0 } else { - newBalance = await calculateDecay( + newBalance = calculateDecay( lastUserTransaction.balance, lastUserTransaction.balanceDate, receivedCallDate, - ) + ).balance } newBalance = Number(newBalance) + Number(parseInt(pendingCreation.amount.toString())) diff --git a/backend/src/graphql/resolver/BalanceResolver.ts b/backend/src/graphql/resolver/BalanceResolver.ts index dd7280657..0ecfbb7cd 100644 --- a/backend/src/graphql/resolver/BalanceResolver.ts +++ b/backend/src/graphql/resolver/BalanceResolver.ts @@ -35,7 +35,7 @@ export class BalanceResolver { return new Balance({ balance: roundFloorFrom4(balanceEntity.amount), decay: roundFloorFrom4( - await calculateDecay(balanceEntity.amount, balanceEntity.recordDate, now), + calculateDecay(balanceEntity.amount, balanceEntity.recordDate, now).balance, ), decay_date: now.toString(), }) diff --git a/backend/src/util/validate.ts b/backend/src/util/validate.ts index b94550d63..edd663e9e 100644 --- a/backend/src/util/validate.ts +++ b/backend/src/util/validate.ts @@ -21,7 +21,7 @@ async function hasUserAmount(user: dbUser, amount: number): Promise { const balance = await balanceRepository.findOne({ userId: user.id }) if (!balance) return false - const decay = await calculateDecay(balance.amount, balance.recordDate, new Date()) + const decay = calculateDecay(balance.amount, balance.recordDate, new Date()).balance return decay > amount } From bec09fc7f4d600c30309b8558ca3ff63cb18d0f2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 2 Feb 2022 19:42:59 +0100 Subject: [PATCH 04/74] Update backend/src/graphql/resolver/TransactionResolver.ts Co-authored-by: Moriz Wahl --- backend/src/graphql/resolver/TransactionResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index c674f36d1..0a9e91fa2 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -142,7 +142,7 @@ async function calculateAndAddDecayTransactions( if (i === userTransactions.length - 1 && decay) { const now = new Date() - const decay = await calculateDecay(userTransaction.balance, userTransaction.balanceDate, now) + const decay = calculateDecay(userTransaction.balance, userTransaction.balanceDate, now) const balance = userTransaction.balance - decay.balance const decayTransaction = new Transaction() From ab38a66c84f4e9259de3d4aaee91ffd42ec853f5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 3 Feb 2022 00:48:15 +0100 Subject: [PATCH 05/74] Update backend/src/graphql/resolver/TransactionResolver.ts --- backend/src/graphql/resolver/TransactionResolver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 0a9e91fa2..8d411f4ac 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -80,7 +80,7 @@ async function calculateAndAddDecayTransactions( if (previousTransaction) { const currentTransaction = userTransaction - const decay = await calculateDecay( + const decay = calculateDecay( previousTransaction.balance, previousTransaction.balanceDate, currentTransaction.balanceDate, From 22c408f6333f06ea7248d1bdcf04187a5ff48582 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 14 Feb 2022 14:34:43 +0100 Subject: [PATCH 06/74] fix: Catch GDT Server Errors --- backend/src/graphql/resolver/GdtResolver.ts | 16 ++++++++++------ .../src/graphql/resolver/TransactionResolver.ts | 12 +++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/backend/src/graphql/resolver/GdtResolver.ts b/backend/src/graphql/resolver/GdtResolver.ts index a727c8784..a00537dd5 100644 --- a/backend/src/graphql/resolver/GdtResolver.ts +++ b/backend/src/graphql/resolver/GdtResolver.ts @@ -25,13 +25,17 @@ export class GdtResolver { const userRepository = getCustomRepository(UserRepository) const userEntity = await userRepository.findByPubkeyHex(context.pubKey) - const resultGDT = await apiGet( - `${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.email}/${currentPage}/${pageSize}/${order}`, - ) - if (!resultGDT.success) { - throw new Error(resultGDT.data) + try { + const resultGDT = await apiGet( + `${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.email}/${currentPage}/${pageSize}/${order}`, + ) + if (!resultGDT.success) { + throw new Error(resultGDT.data) + } + return new GdtEntryList(resultGDT.data) + } catch (err: any) { + throw new Error(err) } - return new GdtEntryList(resultGDT.data) } @Authorized([RIGHTS.EXIST_PID]) diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 8fe1e8484..d42f3b62e 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -331,11 +331,13 @@ export class TransactionResolver { ) // get gdt sum - const resultGDTSum = await apiPost(`${CONFIG.GDT_API_URL}/GdtEntries/sumPerEmailApi`, { - email: userEntity.email, - }) - if (!resultGDTSum.success) throw new Error(resultGDTSum.data) - transactions.gdtSum = Number(resultGDTSum.data.sum) || 0 + transactions.gdtSum = 0 + try { + const resultGDTSum = await apiPost(`${CONFIG.GDT_API_URL}/GdtEntries/sumPerEmailApi`, { + email: userEntity.email, + }) + if (resultGDTSum.success) transactions.gdtSum = Number(resultGDTSum.data.sum) || 0 + } catch (err: any) {} // get balance const balanceRepository = getCustomRepository(BalanceRepository) From a62b7e0d28af75f4eccac56cddd1b8dcfe154b6a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 14 Feb 2022 16:39:19 +0100 Subject: [PATCH 07/74] cancel hook on certain events before calculating data ensure all required fields are present and cancel when thats not the case --- backend/src/webhook/elopage.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index d2090a54b..2bf92dc98 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -53,6 +53,18 @@ export const elopageWebhook = async (req: any, res: any): Promise => { membership, } = req.body + // Do not process certain events + if (['lesson.viewed', 'lesson.completed', 'lesson.commented'].includes(event)) { + // eslint-disable-next-line no-console + console.log('User viewed, completed or commented - not saving hook') + return + } + + if (!product || !publisher || !membership || !payer) { + // eslint-disable-next-line no-console + console.log('Elopage Hook: Not an event we can process') + return + } loginElopageBuy.affiliateProgramId = parseInt(product.affiliate_program_id) || null loginElopageBuy.publisherId = parseInt(publisher.id) || null loginElopageBuy.orderId = parseInt(order_id) || null @@ -72,13 +84,6 @@ export const elopageWebhook = async (req: any, res: any): Promise => { const firstName = payer.first_name const lastName = payer.last_name - // Do not process certain events - if (['lesson.viewed', 'lesson.completed', 'lesson.commented'].includes(loginElopageBuy.event)) { - // eslint-disable-next-line no-console - console.log('User viewed, completed or commented - not saving hook') - return - } - // Save the hook data try { await LoginElopageBuys.save(loginElopageBuy) From 6be79901423bff07c2a56ebc48d79a0c48c29b5a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 14 Feb 2022 16:42:59 +0100 Subject: [PATCH 08/74] mising space --- backend/src/webhook/elopage.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index 2bf92dc98..abd139552 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -65,6 +65,7 @@ export const elopageWebhook = async (req: any, res: any): Promise => { console.log('Elopage Hook: Not an event we can process') return } + loginElopageBuy.affiliateProgramId = parseInt(product.affiliate_program_id) || null loginElopageBuy.publisherId = parseInt(publisher.id) || null loginElopageBuy.orderId = parseInt(order_id) || null From ce457ffc0c51014292d873a818155c2889a2306c Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 15 Feb 2022 11:11:34 +0100 Subject: [PATCH 09/74] Toaster titles --- frontend/src/locales/de.json | 1 + frontend/src/locales/en.json | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index fbd9c8e91..ac2b22fc7 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -208,6 +208,7 @@ "title": "Danke!" } }, + "success": "Erfolg", "transaction": { "gdd-text": "Gradido Transaktionen", "gdt-text": "GradidoTransform Transaktionen", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 534aa25e8..a3fbe2ac7 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -208,6 +208,7 @@ "title": "Thank you!" } }, + "success": "Success", "transaction": { "gdd-text": "Gradido Transactions", "gdt-text": "GradidoTransform Transactions", From df63d76a8619ce939a9a2c6ec1c3ae92f7606529 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 15 Feb 2022 11:18:50 +0100 Subject: [PATCH 10/74] global mixin for toasting error and success --- frontend/src/main.js | 3 +++ frontend/src/mixins/toaster.js | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 frontend/src/mixins/toaster.js diff --git a/frontend/src/main.js b/frontend/src/main.js index 0b47a7564..25e417359 100755 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -3,6 +3,7 @@ import DashboardPlugin from './plugins/dashboard-plugin' import App from './App.vue' import i18n from './i18n.js' import { loadAllRules } from './validation-rules' +import { toasters } from './mixins/toaster' import 'regenerator-runtime' @@ -18,6 +19,8 @@ import { apolloProvider } from './plugins/apolloProvider' Vue.use(DashboardPlugin) Vue.config.productionTip = false +Vue.mixin(toasters) + Vue.toasted.register( 'error', (payload) => { diff --git a/frontend/src/mixins/toaster.js b/frontend/src/mixins/toaster.js new file mode 100644 index 000000000..ec1bcfc0a --- /dev/null +++ b/frontend/src/mixins/toaster.js @@ -0,0 +1,24 @@ +export const toasters = { + methods: { + toastSuccess(message) { + this.toast(message, { + title: this.$t('success'), + variant: 'danger', + }) + }, + toastError(message) { + this.toast(message, { + title: this.$t('error.error'), + variant: 'success', + }) + }, + toast(message, options) { + this.$bvToast.toast(message, { + autoHideDelay: 5000, + appendToast: false, + solid: true, + ...options, + }) + }, + }, +} From b9bbcb299821bf5a61864a37dbf7ef44408e6cbb Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 15 Feb 2022 11:52:07 +0100 Subject: [PATCH 11/74] add custom style classes to toaster --- frontend/src/App.vue | 9 +++++++++ frontend/src/mixins/toaster.js | 10 +++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 25b0eadc5..23d637de4 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -41,6 +41,15 @@ export default { }