hasfield gets now a record object. see #675
This commit is contained in:
parent
08f9568955
commit
038e6f6fed
1 changed files with 5 additions and 6 deletions
|
|
@ -55,15 +55,14 @@ export class taStorage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a record exists and contains the specified field.
|
||||
* @param {string} messageId - The Message-ID header string.
|
||||
* Check if a record contains the specified field.
|
||||
* @param {object|null} record - The record object (from getRecord).
|
||||
* @param {string} field - The field name to check ("spam", "summary", or "translation").
|
||||
* @returns {Promise<boolean>} True if the record exists and the field is present.
|
||||
* @returns {boolean} True if the record exists and the field is present.
|
||||
*/
|
||||
async hasField(messageId, field) {
|
||||
hasField(record, field) {
|
||||
try {
|
||||
let record = await this.getRecord(messageId);
|
||||
return record !== null && field in record;
|
||||
return record !== null && record !== undefined && field in record;
|
||||
} catch (e) {
|
||||
this.taLog.error('hasField error: ' + e);
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue