diff --git a/src/addon/mod/forum/pages/discussion/discussion.ts b/src/addon/mod/forum/pages/discussion/discussion.ts index cc4cd42f6..e49b8684d 100644 --- a/src/addon/mod/forum/pages/discussion/discussion.ts +++ b/src/addon/mod/forum/pages/discussion/discussion.ts @@ -326,10 +326,17 @@ export class AddonModForumDiscussionPage implements OnDestroy { }).then(() => { let posts = offlineReplies.concat(onlinePosts); + const startingPost = this.forumProvider.extractStartingPost(posts); + if (startingPost) { + // Update discussion data from first post. + this.discussion = Object.assign(this.discussion || {}, startingPost); + } + // If sort type is nested, normal sorting is disabled and nested posts will be displayed. if (this.sort == 'nested') { // Sort first by creation date to make format tree work. this.forumProvider.sortDiscussionPosts(posts, 'ASC'); + posts = this.utils.formatTree(posts, 'parent', 'id', this.discussion.id); } else { // Set default reply subject. @@ -364,7 +371,7 @@ export class AddonModForumDiscussionPage implements OnDestroy { } })); - // Fetch the discussion if not passed as parameter. + // The discussion object was not passed as parameter and there is no starting post. Should not happen. if (!this.discussion) { promises.push(this.loadDiscussion(this.forumId, this.discussionId)); } @@ -373,12 +380,9 @@ export class AddonModForumDiscussionPage implements OnDestroy { }).catch(() => { // Ignore errors. }).then(() => { - const startingPost = this.forumProvider.extractStartingPost(posts); - if (startingPost) { - // Update discussion data from first post. - this.discussion = Object.assign(this.discussion || {}, startingPost); - } else if (!this.discussion) { - // The discussion object was not passed as parameter and there is no starting post. + + if (!this.discussion) { + // The discussion object was not passed as parameter and there is no starting post. Should not happen. return Promise.reject('Invalid forum discussion.'); } diff --git a/src/addon/mod/forum/providers/discussion-link-handler.ts b/src/addon/mod/forum/providers/discussion-link-handler.ts index e884b6545..546e477f0 100644 --- a/src/addon/mod/forum/providers/discussion-link-handler.ts +++ b/src/addon/mod/forum/providers/discussion-link-handler.ts @@ -51,7 +51,7 @@ export class AddonModForumDiscussionLinkHandler extends CoreContentLinksHandlerB return [{ action: (siteId, navCtrl?): void => { const pageParams: any = { - courseId: courseId || parseInt(params.courseid, 10) || parseInt(params.cid, 10), + courseId: courseId || parseInt(params.courseid, 10) || parseInt(params.cid, 10) || undefined, discussionId: parseInt(params.d, 10), cmId: data.cmid && parseInt(data.cmid, 10), forumId: data.instance && parseInt(data.instance, 10) diff --git a/src/addon/mod/forum/providers/forum.ts b/src/addon/mod/forum/providers/forum.ts index a852c2aec..96fd64ce1 100644 --- a/src/addon/mod/forum/providers/forum.ts +++ b/src/addon/mod/forum/providers/forum.ts @@ -278,14 +278,9 @@ export class AddonModForumProvider { * @return Starting post or undefined if not found. */ extractStartingPost(posts: any[]): any { - // Check the last post first, since they'll usually be ordered by create time. - for (let i = posts.length - 1; i >= 0; i--) { - if (posts[i].parent == 0) { - return posts.splice(i, 1).pop(); // Remove it from the array. - } - } + const index = posts.findIndex((post) => post.parent == 0); - return undefined; + return index >= 0 ? posts.splice(index, 1).pop() : undefined; } /** diff --git a/src/addon/mod/lesson/pages/player/player.ts b/src/addon/mod/lesson/pages/player/player.ts index 4d9859d42..c29ad99b5 100644 --- a/src/addon/mod/lesson/pages/player/player.ts +++ b/src/addon/mod/lesson/pages/player/player.ts @@ -101,7 +101,11 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { // Create the navigation modal. this.menuModal = modalCtrl.create('AddonModLessonMenuModalPage', { page: this - }); + }, { cssClass: 'core-modal-lateral', + showBackdrop: true, + enableBackdropDismiss: true, + enterAnimation: 'core-modal-lateral-transition', + leaveAnimation: 'core-modal-lateral-transition' }); } /** diff --git a/src/addon/mod/survey/providers/sync.ts b/src/addon/mod/survey/providers/sync.ts index 0733baf8d..2f43c7f28 100644 --- a/src/addon/mod/survey/providers/sync.ts +++ b/src/addon/mod/survey/providers/sync.ts @@ -202,9 +202,11 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid }); }).then(() => { if (courseId) { - // Data has been sent to server, update survey data. - return this.courseProvider.getModuleBasicInfoByInstance(surveyId, 'survey', siteId).then((module) => { - return this.prefetchAfterUpdate(module, courseId, undefined, siteId); + return this.surveyProvider.invalidateSurveyData(courseId, siteId).then(() => { + // Data has been sent to server, update survey data. + return this.courseProvider.getModuleBasicInfoByInstance(surveyId, 'survey', siteId).then((module) => { + return this.prefetchAfterUpdate(module, courseId, undefined, siteId); + }); }).catch(() => { // Ignore errors. }); diff --git a/src/app/app.scss b/src/app/app.scss index a77cf58e8..6e71d9caf 100644 --- a/src/app/app.scss +++ b/src/app/app.scss @@ -367,6 +367,9 @@ ion-app.app-root { color: $black; border-radius: 5px; background: rgba(255, 255, 255, .5); + @include darkmode() { + background-color: rgba(0, 0, 0, .5); + } text-align: center; width: 32px; @@ -376,6 +379,8 @@ ion-app.app-root { font-size: 24px; ion-icon { font-size: 24px; + + } } diff --git a/src/components/rich-text-editor/rich-text-editor.scss b/src/components/rich-text-editor/rich-text-editor.scss index d4ba94b06..e2dd2ac07 100644 --- a/src/components/rich-text-editor/rich-text-editor.scss +++ b/src/components/rich-text-editor/rich-text-editor.scss @@ -7,7 +7,7 @@ ion-app.app-root core-rich-text-editor { display: flex; flex-direction: column; @include darkmode() { - background-color: $black; + background-color: $gray-darker; } .core-rte-editor, .core-textarea { @@ -17,7 +17,7 @@ ion-app.app-root core-rich-text-editor { resize: none; background-color: $white; @include darkmode() { - background-color: $black; + background-color: $gray-darker; color: $white; } } diff --git a/src/core/course/pages/list-mod-type/list-mod-type.html b/src/core/course/pages/list-mod-type/list-mod-type.html index 39678efed..eeb723d8a 100644 --- a/src/core/course/pages/list-mod-type/list-mod-type.html +++ b/src/core/course/pages/list-mod-type/list-mod-type.html @@ -8,11 +8,13 @@ - + - - + + + + diff --git a/src/core/course/pages/list-mod-type/list-mod-type.ts b/src/core/course/pages/list-mod-type/list-mod-type.ts index 42700fa85..aa2c218f7 100644 --- a/src/core/course/pages/list-mod-type/list-mod-type.ts +++ b/src/core/course/pages/list-mod-type/list-mod-type.ts @@ -31,7 +31,7 @@ import { CoreConstants } from '@core/constants'; }) export class CoreCourseListModTypePage { - modules = []; + sections = []; title: string; loaded = false; downloadEnabled = false; @@ -69,17 +69,15 @@ export class CoreCourseListModTypePage { // Get all the modules in the course. return this.courseProvider.getSections(this.courseId, false, true).then((sections) => { - this.modules = []; - - sections.forEach((section) => { + this.sections = sections.filter((section) => { if (!section.modules) { - return; + return false; } - section.modules.forEach((mod) => { + section.modules = section.modules.filter((mod) => { if (mod.uservisible === false || !this.courseProvider.moduleHasView(mod)) { // Ignore this module. - return; + return false; } if (this.modName === 'resources') { @@ -90,21 +88,18 @@ export class CoreCourseListModTypePage { } if (this.archetypes[mod.modname] == CoreConstants.MOD_ARCHETYPE_RESOURCE) { - this.modules.push(mod); + return true; } } else if (mod.modname == this.modName) { - this.modules.push(mod); + return true; } }); + + return section.modules.length > 0; }); - // Get the handler data for the modules. - const fakeSection = { - visible: 1, - modules: this.modules - }; - this.courseHelper.addHandlerDataForModules([fakeSection], this.courseId); + this.courseHelper.addHandlerDataForModules(this.sections, this.courseId); }).catch((error) => { this.domUtils.showErrorModalDefault(error, 'Error getting data'); }); diff --git a/src/core/settings/pages/space-usage/space-usage.html b/src/core/settings/pages/space-usage/space-usage.html index a21f0208d..f4d247a89 100644 --- a/src/core/settings/pages/space-usage/space-usage.html +++ b/src/core/settings/pages/space-usage/space-usage.html @@ -12,8 +12,8 @@

{{ site.fullName }}

-

{{ site.spaceUsage | coreBytesToSize }}

-

{{ 'core.settings.entriesincache' | translate: { $a: site.cacheEntries } }}

+

{{ site.spaceUsage | coreBytesToSize }}

+

{{ 'core.settings.entriesincache' | translate: { $a: site.cacheEntries } }}