From a4edff16bb883b8ffcdc668163fd586e1fda3a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 19 Jul 2023 12:55:47 +0200 Subject: [PATCH] MOBILE-4379 chat: Remove legacy chat time message --- scripts/langindex.json | 2 +- scripts/update_lang_functions.sh | 2 +- .../index/addon-mod-chat-index.html | 4 ++-- src/addons/mod/chat/components/index/index.ts | 19 +++++-------------- src/addons/mod/chat/lang.json | 2 +- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/scripts/langindex.json b/scripts/langindex.json index be537c0a2..df42ad923 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -496,7 +496,7 @@ "addon.mod_chat.nosessionsfound": "local_moodlemobileapp", "addon.mod_chat.saidto": "chat", "addon.mod_chat.send": "chat", - "addon.mod_chat.sessionstart": "chat", + "addon.mod_chat.sessionstartsin": "chat", "addon.mod_chat.showincompletesessions": "local_moodlemobileapp", "addon.mod_chat.talk": "chat", "addon.mod_chat.viewreport": "chat", diff --git a/scripts/update_lang_functions.sh b/scripts/update_lang_functions.sh index 5ae2e83ab..42834411b 100755 --- a/scripts/update_lang_functions.sh +++ b/scripts/update_lang_functions.sh @@ -22,7 +22,7 @@ function copy_lang { lang=$1 index_keys=$(jq -r 'to_entries[] | "\"\(.key)\","' langindex.json) - index_keys=${index_keys:0:-1} + index_keys=${index_keys:0:${#index_keys}-1} hyphenlang=${lang/_/-} langfilepath=$LANG_PATH/$hyphenlang.json diff --git a/src/addons/mod/chat/components/index/addon-mod-chat-index.html b/src/addons/mod/chat/components/index/addon-mod-chat-index.html index 612815bbd..a10e1a5f1 100644 --- a/src/addons/mod/chat/components/index/addon-mod-chat-index.html +++ b/src/addons/mod/chat/components/index/addon-mod-chat-index.html @@ -13,10 +13,10 @@ [courseId]="courseId" (completionChanged)="onCompletionChange()"> - + - {{ 'addon.mod_chat.sessionstart' | translate:{$a: chatInfo} }} + {{ 'addon.mod_chat.sessionstartsin' | translate:{$a: chatTime} }} diff --git a/src/addons/mod/chat/components/index/index.ts b/src/addons/mod/chat/components/index/index.ts index b298143c0..8f2941d1d 100644 --- a/src/addons/mod/chat/components/index/index.ts +++ b/src/addons/mod/chat/components/index/index.ts @@ -34,10 +34,7 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp component = AddonModChatProvider.COMPONENT; pluginName = 'chat'; chat?: AddonModChatChat; - chatInfo?: { - date: string; - fromnow: string; - }; + chatTime?: string; constructor( protected content?: IonContent, @@ -62,17 +59,11 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp this.chat = await AddonModChat.getChat(this.courseId, this.module.id); this.description = this.chat.intro; - const now = CoreTimeUtils.timestamp(); - const span = (this.chat.chattime || 0) - now; + const chatTimeSeconds = (this.chat.chattime || 0) - CoreTimeUtils.timestamp(); - if (this.chat.chattime && this.chat.schedule && span > 0) { - this.chatInfo = { - date: CoreTimeUtils.userDate(this.chat.chattime * 1000), - fromnow: CoreTime.formatTime(span), - }; - } else { - this.chatInfo = undefined; - } + this.chatTime = this.chat.schedule && chatTimeSeconds > 0 + ? CoreTime.formatTime(chatTimeSeconds) + : undefined; this.dataRetrieved.emit(this.chat); } diff --git a/src/addons/mod/chat/lang.json b/src/addons/mod/chat/lang.json index 5826b5126..1702aa79f 100644 --- a/src/addons/mod/chat/lang.json +++ b/src/addons/mod/chat/lang.json @@ -22,7 +22,7 @@ "nosessionsfound": "No sessions found", "saidto": "said to", "send": "Send", - "sessionstart": "The next chat session will start on {{$a.date}}, ({{$a.fromnow}} from now)", + "sessionstartsin": "The next chat session will start {{$a}} from now.", "showincompletesessions": "Show incomplete sessions", "talk": "Talk", "viewreport": "Past sessions"