Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt new nes properties to correct style #2152

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,17 +864,17 @@
}
}

if (showIt && message.noObjects) {
if (showIt && message['number-of-objects']) {
const res = await this.getObjectListAsync({ include_docs: true });
const noObjects = res.rows.length;

showIt = eval(`${noObjects} ${message.noObjects}`);
showIt = eval(`${noObjects} ${message['number-of-objects']}`);

Check warning

Code scanning / CodeQL

Unsafe code constructed from library input Medium

This string concatenation which depends on
library input
is later
interpreted as code
.
}

if (showIt && message.objectsDbType) {
if (showIt && message['objects-db-type']) {
const objectsDbType = await this.getObjectsDbType();

if (!message.objectsDbType.includes(objectsDbType)) {
if (!message['objects-db-type'].includes(objectsDbType)) {
showIt = false;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/src/dialogs/NewsAdminDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ interface Message {
/** E.g. a base64 encoded image like, data:image/png;base64,iVBORw0KG... */
img?: 'string';
/** e.g. >= 15000 to address installations with more than 15k objects */
noObjects?: string;
'number-of-objects'?: string;
/** All object db types which this message is valid for */
objectsDbType?: (DbType)[];
'objects-db-type'?: (DbType)[];
}

export const checkMessages = (messages: Message[], lastMessageId: string, context: Context) => {
Expand Down Expand Up @@ -255,12 +255,12 @@ export const checkMessages = (messages: Message[], lastMessageId: string, contex
}
}

if (showIt && message.noObjects) {
showIt = eval(`${context.noObjects} ${message.noObjects}`);
if (showIt && message['number-of-objects']) {
showIt = eval(`${context.noObjects} ${message['number-of-objects']}`);
}

if (showIt && message.objectsDbType) {
if (!message.objectsDbType.includes(context.objectsDbType)) {
if (showIt && message['objects-db-type']) {
if (!message['objects-db-type'].includes(context.objectsDbType)) {
showIt = false;
}
}
Expand Down
Loading