From b25bf4f7a324fe05a25289d37d8f4f8c9fe8e0d1 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 24 Aug 2022 21:45:20 +0100 Subject: [PATCH] fix: quote showing icon from incorrect quote pack --- src/components/widgets/quote/Quote.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/widgets/quote/Quote.jsx b/src/components/widgets/quote/Quote.jsx index 71445506..fc3fb7f9 100644 --- a/src/components/widgets/quote/Quote.jsx +++ b/src/components/widgets/quote/Quote.jsx @@ -240,21 +240,21 @@ export default class Quote extends PureComponent { const installed = JSON.parse(localStorage.getItem('installed')); installed.forEach(item => { if (item.type === 'quotes') { - quotePack.push(...item.quotes) + const quotes = item.quotes.map(quote => ({ + ...quote, + fallbackauthorimg: item.icon_url + })); + quotePack.push(...quotes); } }); if (quotePack) { const data = quotePack[Math.floor(Math.random() * quotePack.length)]; - const installed = JSON.parse(localStorage.getItem('installed')); - // todo: make this actually get the correct quote pack, instead of the first available - const info = installed.find((i) => i.type === 'quotes'); - return this.setState({ quote: '"' + data.quote + '"', author: data.author, authorlink: this.getAuthorLink(data.author), - authorimg: info.icon_url, + authorimg: data.fallbackauthorimg, }); } else { return this.doOffline();