From 2420e3a6fb5a2fcca164e1a892a204915ce8af8b Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Tue, 19 Feb 2019 10:59:39 +0100 Subject: [PATCH] MOBILE-1928 ws: Save "notingroup" errors to the cache --- scripts/langindex.json | 1 + src/assets/lang/en.json | 1 + src/classes/site.ts | 7 +++++-- src/lang/en.json | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index 047c14c1c..f7c408447 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1551,6 +1551,7 @@ "core.noresults": "moodle", "core.notapplicable": "local_moodlemobileapp", "core.notice": "moodle", + "core.notingroup": "moodle", "core.notsent": "local_moodlemobileapp", "core.now": "moodle", "core.numwords": "moodle", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index 81ca8e7ce..4dceedd94 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1550,6 +1550,7 @@ "core.noresults": "No results", "core.notapplicable": "n/a", "core.notice": "Notice", + "core.notingroup": "Sorry, but you need to be part of a group to see this page.", "core.notsent": "Not sent", "core.now": "now", "core.numwords": "{{$a}} words", diff --git a/src/classes/site.ts b/src/classes/site.ts index 36fd3d598..9776bac47 100644 --- a/src/classes/site.ts +++ b/src/classes/site.ts @@ -632,10 +632,13 @@ export class CoreSite { error.message = this.translate.instant('core.unicodenotsupported'); return Promise.reject(error); - } else if (error.exception === 'required_capability_exception' || error.errorcode === 'nopermission') { + } else if (error.exception === 'required_capability_exception' || error.errorcode === 'nopermission' || + error.errorcode === 'notingroup') { + // Translate error messages with missing strings. if (error.message === 'error/nopermission') { - // This error message is returned by some web services but the string does not exist. error.message = this.translate.instant('core.nopermissionerror'); + } else if (error.message === 'error/notingroup') { + error.message = this.translate.instant('core.notingroup'); } // Save the error instead of deleting the cache entry so the same content is displayed in offline. diff --git a/src/lang/en.json b/src/lang/en.json index a8aeed519..9da338b2e 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -170,6 +170,7 @@ "noresults": "No results", "notapplicable": "n/a", "notice": "Notice", + "notingroup": "Sorry, but you need to be part of a group to see this page.", "notsent": "Not sent", "now": "now", "numwords": "{{$a}} words",