From cf98e99531bd5fd670aff03d02d42cdeb6baf575 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 13 Jan 2022 11:43:36 +0100 Subject: [PATCH] fix dm room name --- src/app/services/chat/ws-chat-methods.service.ts | 4 ++-- src/index.html | 9 +++++++++ src/plugin/deep.js | 2 +- src/plugin/text.js | 7 +++++++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/plugin/text.js diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index 39ea53622..02ddbdb9a 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -3,7 +3,7 @@ import { RoomService } from './room.service'; import { WsChatService } from 'src/app/services/chat/ws-chat.service'; import { MessageService } from 'src/app/services/chat/message.service' import { SessionStore } from 'src/app/store/session.service'; - +import { capitalizeTxt } from 'src/plugin/text' @Injectable({ providedIn: 'root' @@ -101,7 +101,7 @@ export class WsChatMethodsService { return name != SessionStore.user.RochetChatUser })[0] - return roomName + return capitalizeTxt(roomName.split('.')[0]) + ' ' + capitalizeTxt(roomName.split('.')[1]) } else { return roomData.fname } diff --git a/src/index.html b/src/index.html index 2d125ea04..63e7662dc 100644 --- a/src/index.html +++ b/src/index.html @@ -66,6 +66,15 @@ + + diff --git a/src/plugin/deep.js b/src/plugin/deep.js index 586c8077c..312724756 100644 --- a/src/plugin/deep.js +++ b/src/plugin/deep.js @@ -14,5 +14,5 @@ function deepFind(obj, path) { } module.exports = { - deepFind: deepFind, + deepFind: deepFind, }; \ No newline at end of file diff --git a/src/plugin/text.js b/src/plugin/text.js new file mode 100644 index 000000000..c453d310b --- /dev/null +++ b/src/plugin/text.js @@ -0,0 +1,7 @@ +function capitalizeTxt(txt) { + return txt.charAt(0).toUpperCase() + txt.slice(1); //or if you want lowercase the rest txt.slice(1).toLowerCase(); +} + +module.exports = { + capitalizeTxt: capitalizeTxt +} \ No newline at end of file