From 77ab9a85d1cddcd5f1e8798d4cc234aac03b181d Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Fri, 9 Nov 2018 13:45:02 +0000 Subject: [PATCH] MOBILE_2721 course: Use shortname in course title if courselistshortnames is enabled --- .../course/formats/singleactivity/providers/handler.ts | 10 ++++++++-- src/core/course/providers/default-format.ts | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/course/formats/singleactivity/providers/handler.ts b/src/core/course/formats/singleactivity/providers/handler.ts index 8a4a3d776..328ae5ee6 100644 --- a/src/core/course/formats/singleactivity/providers/handler.ts +++ b/src/core/course/formats/singleactivity/providers/handler.ts @@ -49,7 +49,7 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa } /** - * Get the title to use in course page. If not defined, course fullname. + * Get the title to use in course page. If not defined, course displayname or fullname. * This function will be called without sections first, and then call it again when the sections are retrieved. * * @param {any} course The course. @@ -61,7 +61,13 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa return sections[0].modules[0].name; } - return course.fullname || ''; + if (course.displayname) { + return course.displayname; + } else if (course.fullname) { + return course.fullname; + } else { + return ''; + } } /** diff --git a/src/core/course/providers/default-format.ts b/src/core/course/providers/default-format.ts index 45bcfe551..921a91c00 100644 --- a/src/core/course/providers/default-format.ts +++ b/src/core/course/providers/default-format.ts @@ -44,7 +44,13 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { * @return {string} Title. */ getCourseTitle(course: any): string { - return course.fullname || ''; + if (course.displayname) { + return course.displayname; + } else if (course.fullname) { + return course.fullname; + } else { + return ''; + } } /**