summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/thread_view/thread_viewer.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/static/src/models/thread_view/thread_viewer.js')
-rw-r--r--addons/mail/static/src/models/thread_view/thread_viewer.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/addons/mail/static/src/models/thread_view/thread_viewer.js b/addons/mail/static/src/models/thread_view/thread_viewer.js
index 3c643339eff..1e48e4ad805 100644
--- a/addons/mail/static/src/models/thread_view/thread_viewer.js
+++ b/addons/mail/static/src/models/thread_view/thread_viewer.js
@@ -13,7 +13,27 @@ function factory(dependencies) {
//----------------------------------------------------------------------
/**
- * @param {string} scrollTop
+ * @param {integer} scrollHeight
+ */
+ saveThreadCacheScrollHeightAsInitial(scrollHeight) {
+ if (!this.threadCache) {
+ return;
+ }
+ if (this.chatter) {
+ // Initial scroll height is disabled for chatter because it is
+ // too complex to handle correctly and less important
+ // functionally.
+ return;
+ }
+ this.update({
+ threadCacheInitialScrollHeights: Object.assign({}, this.threadCacheInitialScrollHeights, {
+ [this.threadCache.localId]: scrollHeight,
+ }),
+ });
+ }
+
+ /**
+ * @param {integer} scrollTop
*/
saveThreadCacheScrollPositionsAsInitial(scrollTop) {
if (!this.threadCache) {
@@ -231,6 +251,15 @@ function factory(dependencies) {
],
}),
/**
+ * Determines the initial scroll height of thread caches, which is the
+ * scroll height at the time the last scroll position was saved.
+ * Useful to only restore scroll position when the corresponding height
+ * is available, otherwise the restore makes no sense.
+ */
+ threadCacheInitialScrollHeights: attr({
+ default: {},
+ }),
+ /**
* Determines the initial scroll positions of thread caches.
* Useful to restore scroll position on changing back to this
* thread cache. Note that this is only applied when opening