From 39a6d67c25773ff9f1688ab69f110524d21e1d4b Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Wed, 22 Mar 2023 15:41:10 +0100 Subject: [PATCH] MOBILE-2652 glossary: Clean up edit form --- .../classes/glossary-entries-source.ts | 2 +- src/addons/mod/glossary/pages/edit/edit.html | 16 +- src/addons/mod/glossary/pages/edit/edit.ts | 166 +++++++++++------- .../mod/glossary/services/glossary-helper.ts | 26 --- .../mod/glossary/services/glossary-offline.ts | 24 +-- .../mod/glossary/services/glossary-sync.ts | 16 +- src/addons/mod/glossary/services/glossary.ts | 21 +-- upgrade.txt | 2 +- 8 files changed, 132 insertions(+), 141 deletions(-) diff --git a/src/addons/mod/glossary/classes/glossary-entries-source.ts b/src/addons/mod/glossary/classes/glossary-entries-source.ts index 3e0dc06c6..057856e55 100644 --- a/src/addons/mod/glossary/classes/glossary-entries-source.ts +++ b/src/addons/mod/glossary/classes/glossary-entries-source.ts @@ -259,7 +259,7 @@ export class AddonModGlossaryEntriesSource extends CoreRoutedItemsManagerSource< const entries: AddonModGlossaryEntryItem[] = []; if (page === 0) { - const offlineEntries = await AddonModGlossaryOffline.getGlossaryNewEntries(glossary.id); + const offlineEntries = await AddonModGlossaryOffline.getGlossaryOfflineEntries(glossary.id); offlineEntries.sort((a, b) => a.concept.localeCompare(b.concept)); diff --git a/src/addons/mod/glossary/pages/edit/edit.html b/src/addons/mod/glossary/pages/edit/edit.html index 8850c93d3..835718d27 100644 --- a/src/addons/mod/glossary/pages/edit/edit.html +++ b/src/addons/mod/glossary/pages/edit/edit.html @@ -16,7 +16,7 @@
{{ 'addon.mod_glossary.concept' | translate }} - + @@ -31,7 +31,7 @@ {{ 'addon.mod_glossary.categories' | translate }} - @@ -43,7 +43,7 @@ {{ 'addon.mod_glossary.aliases' | translate }} - + @@ -51,7 +51,7 @@

{{ 'addon.mod_glossary.attachment' | translate }}

- @@ -62,19 +62,19 @@ {{ 'addon.mod_glossary.entryusedynalink' | translate }} - + {{ 'addon.mod_glossary.casesensitive' | translate }} - + {{ 'addon.mod_glossary.fullmatch' | translate }} - + - + {{ 'core.save' | translate }} diff --git a/src/addons/mod/glossary/pages/edit/edit.ts b/src/addons/mod/glossary/pages/edit/edit.ts index 334672856..a3bc5bfb7 100644 --- a/src/addons/mod/glossary/pages/edit/edit.ts +++ b/src/addons/mod/glossary/pages/edit/edit.ts @@ -20,7 +20,7 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/ import { CoreSplitViewComponent } from '@components/split-view/split-view'; import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader'; import { CanLeave } from '@guards/can-leave'; -import { FileEntry } from '@ionic-native/file/ngx'; +import { CoreFileEntry } from '@services/file-helper'; import { CoreNavigator } from '@services/navigator'; import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; @@ -36,8 +36,6 @@ import { AddonModGlossaryCategory, AddonModGlossaryEntryOption, AddonModGlossaryGlossary, - AddonModGlossaryNewEntry, - AddonModGlossaryNewEntryWithFiles, AddonModGlossaryProvider, } from '../../services/glossary'; import { AddonModGlossaryHelper } from '../../services/glossary-helper'; @@ -59,32 +57,29 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { courseId!: number; loaded = false; glossary?: AddonModGlossaryGlossary; - attachments: FileEntry[] = []; definitionControl = new FormControl(); categories: AddonModGlossaryCategory[] = []; editorExtraParams: Record = {}; - entry: AddonModGlossaryNewEntry = { + data: AddonModGlossaryFormData = { concept: '', definition: '', timecreated: 0, - }; - - entries?: AddonModGlossaryEditEntriesSwipeManager; - - options = { - categories: [], + attachments: [], + categories: [], aliases: '', usedynalink: false, casesensitive: false, fullmatch: false, }; + entries?: AddonModGlossaryEditEntriesSwipeManager; + protected timecreated!: number; protected concept = ''; protected syncId?: string; protected syncObserver?: CoreEventObserver; protected isDestroyed = false; - protected originalData?: AddonModGlossaryNewEntryWithFiles; + protected originalData?: AddonModGlossaryFormData; protected saved = false; constructor(protected route: ActivatedRoute, @Optional() protected splitView: CoreSplitViewComponent) {} @@ -164,54 +159,64 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { return; } - const entry = await AddonModGlossaryOffline.getNewEntry(this.glossary.id, this.concept, this.timecreated); + const entry = await AddonModGlossaryOffline.getOfflineEntry(this.glossary.id, this.concept, this.timecreated); - this.entry.concept = entry.concept || ''; - this.entry.definition = entry.definition || ''; - this.entry.timecreated = entry.timecreated; + this.data.concept = entry.concept || ''; + this.data.definition = entry.definition || ''; + this.data.timecreated = entry.timecreated; this.originalData = { - concept: this.entry.concept, - definition: this.entry.definition, - files: [], + concept: this.data.concept, + definition: this.data.definition, + attachments: this.data.attachments.slice(), timecreated: entry.timecreated, + categories: this.data.categories.slice(), + aliases: this.data.aliases, + usedynalink: this.data.usedynalink, + casesensitive: this.data.casesensitive, + fullmatch: this.data.fullmatch, }; if (entry.options) { - this.options.categories = (entry.options.categories && ( entry.options.categories).split(',')) || []; - this.options.aliases = entry.options.aliases || ''; - this.options.usedynalink = !!entry.options.usedynalink; - if (this.options.usedynalink) { - this.options.casesensitive = !!entry.options.casesensitive; - this.options.fullmatch = !!entry.options.fullmatch; + this.data.categories = (entry.options.categories && ( entry.options.categories).split(',')) || []; + this.data.aliases = entry.options.aliases || ''; + this.data.usedynalink = !!entry.options.usedynalink; + + if (this.data.usedynalink) { + this.data.casesensitive = !!entry.options.casesensitive; + this.data.fullmatch = !!entry.options.fullmatch; } } // Treat offline attachments if any. if (entry.attachments?.offline) { - this.attachments = await AddonModGlossaryHelper.getStoredFiles(this.glossary.id, entry.concept, entry.timecreated); + this.data.attachments = await AddonModGlossaryHelper.getStoredFiles( + this.glossary.id, + entry.concept, + entry.timecreated, + ); - this.originalData.files = this.attachments.slice(); + this.originalData.attachments = this.data.attachments.slice(); } - this.definitionControl.setValue(this.entry.definition); + this.definitionControl.setValue(this.data.definition); } /** * Reset the form data. */ protected resetForm(): void { - this.entry.concept = ''; - this.entry.definition = ''; - this.entry.timecreated = 0; this.originalData = undefined; - this.options.categories = []; - this.options.aliases = ''; - this.options.usedynalink = false; - this.options.casesensitive = false; - this.options.fullmatch = false; - this.attachments.length = 0; // Empty the array. + this.data.concept = ''; + this.data.definition = ''; + this.data.timecreated = 0; + this.data.categories = []; + this.data.aliases = ''; + this.data.usedynalink = false; + this.data.casesensitive = false; + this.data.fullmatch = false; + this.data.attachments.length = 0; // Empty the array. this.definitionControl.setValue(''); } @@ -222,7 +227,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { * @param text The new text. */ onDefinitionChange(text: string): void { - this.entry.definition = text; + this.data.definition = text; } /** @@ -235,13 +240,13 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { return true; } - if (AddonModGlossaryHelper.hasEntryDataChanged(this.entry, this.attachments, this.originalData)) { + if (this.hasDataChanged()) { // Show confirmation if some data has been modified. await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit')); } // Delete the local files from the tmp folder. - CoreFileUploader.clearTmpFiles(this.attachments); + CoreFileUploader.clearTmpFiles(this.data.attachments); CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId()); @@ -252,11 +257,11 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { * Save the entry. */ async save(): Promise { - let definition = this.entry.definition; + let definition = this.data.definition; let entryId: number | undefined; - const timecreated = this.entry.timecreated || Date.now(); + const timecreated = this.data.timecreated || Date.now(); - if (!this.entry.concept || !definition) { + if (!this.data.concept || !definition) { CoreDomUtils.showErrorModal('addon.mod_glossary.fillfields', true); return; @@ -274,23 +279,23 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { const { saveOffline, attachmentsResult } = await this.uploadAttachments(timecreated); const options: Record = { - aliases: this.options.aliases, - categories: this.options.categories.join(','), + aliases: this.data.aliases, + categories: this.data.categories.join(','), }; if (this.glossary.usedynalink) { - options.usedynalink = this.options.usedynalink ? 1 : 0; - if (this.options.usedynalink) { - options.casesensitive = this.options.casesensitive ? 1 : 0; - options.fullmatch = this.options.fullmatch ? 1 : 0; + options.usedynalink = this.data.usedynalink ? 1 : 0; + if (this.data.usedynalink) { + options.casesensitive = this.data.casesensitive ? 1 : 0; + options.fullmatch = this.data.fullmatch ? 1 : 0; } } if (saveOffline) { - if (this.entry && !this.glossary.allowduplicatedentries) { + if (this.data && !this.glossary.allowduplicatedentries) { // Check if the entry is duplicated in online or offline mode. - const isUsed = await AddonModGlossary.isConceptUsed(this.glossary.id, this.entry.concept, { - timeCreated: this.entry.timecreated, + const isUsed = await AddonModGlossary.isConceptUsed(this.glossary.id, this.data.concept, { + timeCreated: this.data.timecreated, cmId: this.cmId, }); @@ -301,9 +306,9 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { } // Save entry in offline. - await AddonModGlossaryOffline.addNewEntry( + await AddonModGlossaryOffline.addOfflineEntry( this.glossary.id, - this.entry.concept, + this.data.concept, definition, this.courseId, options, @@ -311,33 +316,33 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { timecreated, undefined, undefined, - this.entry, + this.data, ); } else { // Try to send it to server. // Don't allow offline if there are attachments since they were uploaded fine. await AddonModGlossary.addEntry( this.glossary.id, - this.entry.concept, + this.data.concept, definition, this.courseId, options, attachmentsResult, { timeCreated: timecreated, - discardEntry: this.entry, - allowOffline: !this.attachments.length, + discardEntry: this.data, + allowOffline: !this.data.attachments.length, checkDuplicates: !this.glossary.allowduplicatedentries, }, ); } // Delete the local files from the tmp folder. - CoreFileUploader.clearTmpFiles(this.attachments); + CoreFileUploader.clearTmpFiles(this.data.attachments); if (entryId) { // Data sent to server, delete stored files (if any). - AddonModGlossaryHelper.deleteStoredFiles(this.glossary.id, this.entry.concept, timecreated); + AddonModGlossaryHelper.deleteStoredFiles(this.glossary.id, this.data.concept, timecreated); CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'glossary' }); } @@ -367,6 +372,24 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { } } + /** + * Check if the form data has changed. + * + * @returns True if data has changed, false otherwise. + */ + protected hasDataChanged(): boolean { + if (!this.originalData || this.originalData.concept === undefined) { + // There is no original data. + return !!(this.data.definition || this.data.concept || this.data.attachments.length > 0); + } + + if (this.originalData.definition != this.data.definition || this.originalData.concept != this.data.concept) { + return true; + } + + return CoreFileUploader.areFileListDifferent(this.data.attachments, this.originalData.attachments); + } + /** * Upload entry attachments if any. * @@ -376,7 +399,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { protected async uploadAttachments( timecreated: number, ): Promise<{saveOffline: boolean; attachmentsResult?: number | CoreFileUploaderStoreFilesResult}> { - if (!this.attachments.length || !this.glossary) { + if (!this.data.attachments.length || !this.glossary) { return { saveOffline: false, }; @@ -384,7 +407,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { try { const attachmentsResult = await CoreFileUploader.uploadOrReuploadFiles( - this.attachments, + this.data.attachments, AddonModGlossaryProvider.COMPONENT, this.glossary.id, ); @@ -401,9 +424,9 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { // Cannot upload them in online, save them in offline. const attachmentsResult = await AddonModGlossaryHelper.storeFiles( this.glossary.id, - this.entry.concept, + this.data.concept, timecreated, - this.attachments, + this.data.attachments, ); return { @@ -439,3 +462,18 @@ class AddonModGlossaryEditEntriesSwipeManager extends AddonModGlossaryEntriesSwi } } + +/** + * Form data. + */ +type AddonModGlossaryFormData = { + concept: string; + definition: string; + timecreated: number; + attachments: CoreFileEntry[]; + categories: string[]; + aliases: string; + usedynalink: boolean; + casesensitive: boolean; + fullmatch: boolean; +}; diff --git a/src/addons/mod/glossary/services/glossary-helper.ts b/src/addons/mod/glossary/services/glossary-helper.ts index d51c457d2..46e4e25ca 100644 --- a/src/addons/mod/glossary/services/glossary-helper.ts +++ b/src/addons/mod/glossary/services/glossary-helper.ts @@ -18,7 +18,6 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi import { CoreFile } from '@services/file'; import { CoreUtils } from '@services/utils/utils'; import { AddonModGlossaryOffline } from './glossary-offline'; -import { AddonModGlossaryNewEntry, AddonModGlossaryNewEntryWithFiles } from './glossary'; import { makeSingleton } from '@singletons'; import { CoreFileEntry } from '@services/file-helper'; @@ -58,31 +57,6 @@ export class AddonModGlossaryHelperProvider { return CoreFileUploader.getStoredFiles(folderPath); } - /** - * Check if the data of an entry has changed. - * - * @param entry Current data. - * @param files Files attached. - * @param original Original content. - * @returns True if data has changed, false otherwise. - */ - hasEntryDataChanged( - entry: AddonModGlossaryNewEntry, - files: CoreFileEntry[], - original?: AddonModGlossaryNewEntryWithFiles, - ): boolean { - if (!original || original.concept === undefined) { - // There is no original data. - return !!(entry.definition || entry.concept || files.length > 0); - } - - if (original.definition != entry.definition || original.concept != entry.concept) { - return true; - } - - return CoreFileUploader.areFileListDifferent(files, original.files); - } - /** * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. diff --git a/src/addons/mod/glossary/services/glossary-offline.ts b/src/addons/mod/glossary/services/glossary-offline.ts index b8df14b00..3c748248f 100644 --- a/src/addons/mod/glossary/services/glossary-offline.ts +++ b/src/addons/mod/glossary/services/glossary-offline.ts @@ -31,7 +31,7 @@ import { AddonModGlossaryEntryOption, GLOSSARY_ENTRY_ADDED } from './glossary'; export class AddonModGlossaryOfflineProvider { /** - * Delete a new entry. + * Delete an offline entry. * * @param glossaryId Glossary ID. * @param concept Glossary entry concept. @@ -39,7 +39,7 @@ export class AddonModGlossaryOfflineProvider { * @param siteId Site ID. If not defined, current site. * @returns Promise resolved if deleted, rejected if failure. */ - async deleteNewEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { + async deleteOfflineEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); const conditions: Partial = { @@ -52,12 +52,12 @@ export class AddonModGlossaryOfflineProvider { } /** - * Get all the stored new entries from all the glossaries. + * Get all the stored offline entries from all the glossaries. * * @param siteId Site ID. If not defined, current site. * @returns Promise resolved with entries. */ - async getAllNewEntries(siteId?: string): Promise { + async getAllOfflineEntries(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); const records = await site.getDb().getRecords(OFFLINE_ENTRIES_TABLE_NAME); @@ -66,7 +66,7 @@ export class AddonModGlossaryOfflineProvider { } /** - * Get a stored new entry. + * Get a stored offline entry. * * @param glossaryId Glossary ID. * @param concept Glossary entry concept. @@ -74,7 +74,7 @@ export class AddonModGlossaryOfflineProvider { * @param siteId Site ID. If not defined, current site. * @returns Promise resolved with entry. */ - async getNewEntry( + async getOfflineEntry( glossaryId: number, concept: string, timeCreated: number, @@ -101,7 +101,7 @@ export class AddonModGlossaryOfflineProvider { * @param userId User the entries belong to. If not defined, current user in site. * @returns Promise resolved with entries. */ - async getGlossaryNewEntries(glossaryId: number, siteId?: string, userId?: number): Promise { + async getGlossaryOfflineEntries(glossaryId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); const conditions: Partial = { @@ -144,7 +144,7 @@ export class AddonModGlossaryOfflineProvider { } // If there's only one entry, check that is not the one we are editing. - return CoreUtils.promiseFails(this.getNewEntry(glossaryId, concept, timeCreated, siteId)); + return CoreUtils.promiseFails(this.getOfflineEntry(glossaryId, concept, timeCreated, siteId)); } catch { // No offline data found, return false. return false; @@ -152,7 +152,7 @@ export class AddonModGlossaryOfflineProvider { } /** - * Save a new entry to be sent later. + * Save an offline entry to be sent later. * * @param glossaryId Glossary ID. * @param concept Glossary entry concept. @@ -166,7 +166,7 @@ export class AddonModGlossaryOfflineProvider { * @param discardEntry The entry provided will be discarded if found. * @returns Promise resolved if stored, rejected if failure. */ - async addNewEntry( + async addOfflineEntry( glossaryId: number, concept: string, definition: string, @@ -195,7 +195,7 @@ export class AddonModGlossaryOfflineProvider { // If editing an offline entry, delete previous first. if (discardEntry) { - await this.deleteNewEntry(glossaryId, discardEntry.concept, discardEntry.timecreated, site.getId()); + await this.deleteOfflineEntry(glossaryId, discardEntry.concept, discardEntry.timecreated, site.getId()); } await site.getDb().insertRecord(OFFLINE_ENTRIES_TABLE_NAME, entry); @@ -222,7 +222,7 @@ export class AddonModGlossaryOfflineProvider { } /** - * Get the path to the folder where to store files for a new offline entry. + * Get the path to the folder where to store files for an offline entry. * * @param glossaryId Glossary ID. * @param concept The name of the entry. diff --git a/src/addons/mod/glossary/services/glossary-sync.ts b/src/addons/mod/glossary/services/glossary-sync.ts index f404366ae..62e04f3c9 100644 --- a/src/addons/mod/glossary/services/glossary-sync.ts +++ b/src/addons/mod/glossary/services/glossary-sync.ts @@ -50,10 +50,9 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @returns Promise resolved if sync is successful, rejected if sync fails. */ - syncAllGlossaries(siteId?: string, force?: boolean): Promise { - return this.syncOnSites('all glossaries', (siteId) => this.syncAllGlossariesFunc(!!force, siteId), siteId); + async syncAllGlossaries(siteId?: string, force?: boolean): Promise { + await this.syncOnSites('all glossaries', (siteId) => this.syncAllGlossariesFunc(!!force, siteId), siteId); } /** @@ -61,7 +60,6 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllGlossariesFunc(force: boolean, siteId: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -73,14 +71,13 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv } /** - * Sync entried of all glossaries on a site. + * Sync entries of all glossaries on a site. * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllGlossariesEntries(force: boolean, siteId: string): Promise { - const entries = await AddonModGlossaryOffline.getAllNewEntries(siteId); + const entries = await AddonModGlossaryOffline.getAllOfflineEntries(siteId); // Do not sync same glossary twice. const treated: Record = {}; @@ -180,7 +177,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv // Get offline responses to be sent. const entries = await CoreUtils.ignoreErrors( - AddonModGlossaryOffline.getGlossaryNewEntries(glossaryId, siteId, userId), + AddonModGlossaryOffline.getGlossaryOfflineEntries(glossaryId, siteId, userId), [], ); @@ -285,11 +282,10 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * @param concept Glossary entry concept. * @param timeCreated Time to allow duplicated entries. * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when deleted. */ protected async deleteAddEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { await Promise.all([ - AddonModGlossaryOffline.deleteNewEntry(glossaryId, concept, timeCreated, siteId), + AddonModGlossaryOffline.deleteOfflineEntry(glossaryId, concept, timeCreated, siteId), AddonModGlossaryHelper.deleteStoredFiles(glossaryId, concept, timeCreated, siteId), ]); } diff --git a/src/addons/mod/glossary/services/glossary.ts b/src/addons/mod/glossary/services/glossary.ts index 3f37c1d27..caa61c3f6 100644 --- a/src/addons/mod/glossary/services/glossary.ts +++ b/src/addons/mod/glossary/services/glossary.ts @@ -28,7 +28,6 @@ import { makeSingleton, Translate } from '@singletons'; import { CoreEvents } from '@singletons/events'; import { AddonModGlossaryEntryDBRecord, ENTRIES_TABLE_NAME } from './database/glossary'; import { AddonModGlossaryOffline } from './glossary-offline'; -import { CoreFileEntry } from '@services/file-helper'; export const GLOSSARY_ENTRY_ADDED = 'addon_mod_glossary_entry_added'; export const GLOSSARY_ENTRY_DELETED = 'addon_mod_glossary_entry_deleted'; @@ -827,7 +826,7 @@ export class AddonModGlossaryProvider { throw new CoreError('Error adding entry.'); } - await AddonModGlossaryOffline.addNewEntry( + await AddonModGlossaryOffline.addOfflineEntry( glossaryId, concept, definition, @@ -850,7 +849,7 @@ export class AddonModGlossaryProvider { // If we are editing an offline entry, discard previous first. if (otherOptions.discardEntry) { - await AddonModGlossaryOffline.deleteNewEntry( + await AddonModGlossaryOffline.deleteOfflineEntry( glossaryId, otherOptions.discardEntry.concept, otherOptions.discardEntry.timecreated, @@ -1377,22 +1376,6 @@ export type AddonModGlossaryDiscardedEntry = { timecreated: number; }; -/** - * Entry to be added. - */ -export type AddonModGlossaryNewEntry = { - concept: string; - definition: string; - timecreated: number; -}; - -/** - * Entry to be added, including attachments. - */ -export type AddonModGlossaryNewEntryWithFiles = AddonModGlossaryNewEntry & { - files: CoreFileEntry[]; -}; - /** * Options to pass to the different get entries functions. */ diff --git a/upgrade.txt b/upgrade.txt index 5fe38986f..bf8043196 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -6,7 +6,7 @@ information provided here is intended especially for developers. - CoreIconComponent has been removed after deprecation period: Use CoreFaIconDirective instead. - The courseSummaryComponent property has been removed from the CoreCourseFormatComponent component, and the getCourseSummaryComponent method from the CoreCourseFormatHandler interface. - Font Awesome icon library has been updated to 6.3.0. -- Some methods in AddonModGlossaryProvider have changed their signatures to remove unused parameters. +- Some methods in glossary addon services have changed. === 4.1.0 ===