MOBILE-4616 blog: Fix getOfflineEntries filters
parent
a33027e818
commit
c6f7dd00b2
|
@ -19,6 +19,7 @@ import { CoreFileEntry } from '@services/file-helper';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
|
import { CoreObject } from '@singletons/object';
|
||||||
import { CorePath } from '@singletons/path';
|
import { CorePath } from '@singletons/path';
|
||||||
import { AddonBlogFilter } from './blog';
|
import { AddonBlogFilter } from './blog';
|
||||||
import {
|
import {
|
||||||
|
@ -126,9 +127,13 @@ export class AddonBlogOfflineService {
|
||||||
*
|
*
|
||||||
* @returns Offline entries.
|
* @returns Offline entries.
|
||||||
*/
|
*/
|
||||||
async getOfflineEntries(filters?: AddonBlogFilter, siteId?: string): Promise<AddonBlogOfflineEntry[]> {
|
async getOfflineEntries(filters: AddonBlogFilter = {}, siteId?: string): Promise<AddonBlogOfflineEntry[]> {
|
||||||
|
const { entryid: id, userid } = filters;
|
||||||
const site = await CoreSites.getSite(siteId);
|
const site = await CoreSites.getSite(siteId);
|
||||||
const records = await site.getDb().getRecords<AddonBlogOfflineEntry>(OFFLINE_BLOG_ENTRIES_TABLE_NAME, filters);
|
const records = await site.getDb().getRecords<AddonBlogOfflineEntry>(
|
||||||
|
OFFLINE_BLOG_ENTRIES_TABLE_NAME,
|
||||||
|
CoreObject.withoutUndefined({ id, userid }),
|
||||||
|
);
|
||||||
|
|
||||||
return records.map(record => {
|
return records.map(record => {
|
||||||
if ('id' in record && record.id && record.id < 0) {
|
if ('id' in record && record.id && record.id < 0) {
|
||||||
|
|
Loading…
Reference in New Issue