Skip to content

Commit

Permalink
fix: handle not logged in user logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shafin-deriv committed Sep 14, 2023
1 parent 88736e8 commit b261af8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const FormatMessage = ({ logType, className, extra }: TFormatMessageProps) => {
}}
/>
);
return <Localize i18n_default_text='Welcome!' />;
break;
}
default:
return null;
Expand Down
2 changes: 1 addition & 1 deletion packages/bot-web-ui/src/stores/download-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class DownloadStore {
case log_types.WELCOME: {
if (current_currency)
return localize('You are using your {{current_currency}} account.', { current_currency });
return localize('Welcome!');
break;
}
default:
return null;
Expand Down
13 changes: 10 additions & 3 deletions packages/bot-web-ui/src/stores/journal-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ export default class JournalStore {
unfiltered_messages = [];

restoreStoredJournals() {
const { loginid } = this.core?.client;

this.journal_filters = getSetting('journal_filter') || this.filters.map(filter => filter.id);
this.unfiltered_messages = getStoredItemsByUser(this.JOURNAL_CACHE, this.core?.client.loginid, []);
this.unfiltered_messages = getStoredItemsByUser(this.JOURNAL_CACHE, loginid, []);

if (this.unfiltered_messages.length > 0) {
this.welcomeBackUser();
Expand Down Expand Up @@ -107,8 +109,13 @@ export default class JournalStore {

pushMessage(message, message_type, className, extra = {}) {
const { client } = this.core;
if (!client?.loginid) return;
extra.current_currency = client?.current_currency_type === 'virtual' ? 'Demo' : client?.currency;
const { loginid, current_currency_type, currency } = client;

if (loginid) {
extra.current_currency = current_currency_type === 'virtual' ? 'Demo' : currency;
} else if (message === log_types.WELCOME) {
return;
}

const date = formatDate(this.getServerTime());
const time = formatDate(this.getServerTime(), 'HH:mm:ss [GMT]');
Expand Down

0 comments on commit b261af8

Please sign in to comment.