From b53fbf53776fd36cd67ad54b31d9d54258714b5b Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Thu, 4 Apr 2019 15:14:08 -0700 Subject: [PATCH 1/4] Date format functions are no longer bound to message-thread scope --- .../message-thread/message-thread.html | 6 +++--- .../message-thread/message-thread.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Frontend/src/pages/messaging-components/message-thread/message-thread.html b/Frontend/src/pages/messaging-components/message-thread/message-thread.html index d0a6d1d35..43dc3360c 100644 --- a/Frontend/src/pages/messaging-components/message-thread/message-thread.html +++ b/Frontend/src/pages/messaging-components/message-thread/message-thread.html @@ -24,8 +24,8 @@ class="message" [ngClass]="{'me': message.toUser.id === message.otherUser.id, 'blue': message.fromUser.id === message.otherUser.id }" *ngFor="let message of messages; let i = index; trackBy: trackByFn"> -
- {{ formatMessageDividerDate(message.createdAt) }} +
+ {{ message.dateDiff }}
@@ -63,7 +63,7 @@

Recipe deleted

- {{ formatMessageDate(message.createdAt) }} + {{ message.formattedDate }}
diff --git a/Frontend/src/pages/messaging-components/message-thread/message-thread.ts b/Frontend/src/pages/messaging-components/message-thread/message-thread.ts index 40ab2d362..313ba2e18 100644 --- a/Frontend/src/pages/messaging-components/message-thread/message-thread.ts +++ b/Frontend/src/pages/messaging-components/message-thread/message-thread.ts @@ -132,6 +132,7 @@ export class MessageThreadPage { return new Promise((resolve, reject) => { this.messagingService.fetch(this.otherUserId).subscribe(response => { this.messages = response.map(message => { + // Reuse messages that have already been parsed for performance. Otherwise, send it through linkify if (this.messagesById[message.id]) { message.body = this.messagesById[message.id].body; } else { @@ -143,6 +144,8 @@ export class MessageThreadPage { return message; }); + this.processMessages(); + this.scrollToBottom.call(this, !isInitialLoad, true, () => { resolve(); }); @@ -159,6 +162,15 @@ export class MessageThreadPage { }); } + processMessages() { + for (var i = 0; i < this.messages.length; i++) { + let message = this.messages[i]; + message.deservesDateDiff = !!this.deservesDateDiff(this.messages[i-1], message); + if (message.deservesDateDiff) message.dateDiff = this.formatMessageDividerDate(message.createdAt); + message.formattedDate = this.formatMessageDate(message.createdAt); + } + } + sendMessage() { if (!this.pendingMessage) return; @@ -178,6 +190,8 @@ export class MessageThreadPage { this.messages.push(response); + this.processMessages(); + this.scrollToBottom(true, true); }, err => { this.messagePlaceholder = 'Message...'; From 84cbd15ffa9f4dd5db9907ecec60607b6b143191 Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Thu, 4 Apr 2019 15:14:45 -0700 Subject: [PATCH 2/4] Opaque loading for message-thread now applied only to internal body Fixes ugly transparent screen coming up when loading message thread --- .../message-thread/message-thread.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Frontend/src/pages/messaging-components/message-thread/message-thread.ts b/Frontend/src/pages/messaging-components/message-thread/message-thread.ts index 313ba2e18..e54f2af17 100644 --- a/Frontend/src/pages/messaging-components/message-thread/message-thread.ts +++ b/Frontend/src/pages/messaging-components/message-thread/message-thread.ts @@ -70,10 +70,15 @@ export class MessageThreadPage { } else { var loading = this.loadingService.start(); - this.content.getNativeElement().style.opacity = 0; + let messageArea; + try { + this.content.getNativeElement().children[1].children[0]; + } catch(e){}; + + if (messageArea) messageArea.style.opacity = 0; this.loadMessages(true).then(() => { loading.dismiss(); - this.content.getNativeElement().style.opacity = 1; + if (messageArea) messageArea.style.opacity = 1; }, () => { loading.dismiss(); }); From 4498584a3d0d50a1b8abbe8d24b7c03092f6e102 Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Thu, 4 Apr 2019 15:16:06 -0700 Subject: [PATCH 3/4] Update release notes --- .../src/pages/info-components/release-notes/release-notes.html | 1 + 1 file changed, 1 insertion(+) diff --git a/Frontend/src/pages/info-components/release-notes/release-notes.html b/Frontend/src/pages/info-components/release-notes/release-notes.html index b8a83edb9..213318324 100644 --- a/Frontend/src/pages/info-components/release-notes/release-notes.html +++ b/Frontend/src/pages/info-components/release-notes/release-notes.html @@ -34,6 +34,7 @@ - Recipe authoring page (edit, create) now shows preview of recipe image
- Added a tips, tricks and tutorials page to the about and support page
- Open recipes in new tab from recipe list: control + click or command + click on a recipe
+ - Fixed a bug where message thread text input would be slow on longer threads

From d0762183f7b0485dbbf226992a37b9fd25a2a4fa Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Thu, 4 Apr 2019 15:18:14 -0700 Subject: [PATCH 4/4] Fix typo --- .../src/pages/info-components/release-notes/release-notes.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/src/pages/info-components/release-notes/release-notes.html b/Frontend/src/pages/info-components/release-notes/release-notes.html index 213318324..de5ed7dac 100644 --- a/Frontend/src/pages/info-components/release-notes/release-notes.html +++ b/Frontend/src/pages/info-components/release-notes/release-notes.html @@ -27,7 +27,7 @@ - Added a better error message for when a user uploads an invalid file format for LCB import.
- Improved search: Added fuzzy matching - mistyped words will now show results, but at a lower ranking in the results with exact matches
- Improved search: Re-added support for searching in source, description, instructions, ingredients, and notes.
- - Improved search: A match in the title will be heavily booested, and a match in the source or description will be slightly boosted
+ - Improved search: A match in the title will be heavily boosted, and a match in the source or description will be slightly boosted
- Added a warning for unsupported browsers
- Added the contribute page to the sidemenu!
- Added an action button to add recipe to meal plan from the recipe details page