diff options
author | unarist <m.unarist@gmail.com> | 2017-06-05 22:20:46 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-05 15:20:46 +0200 |
commit | c26cea262b7673b0b239dd1da6754e7788aa08d8 (patch) | |
tree | 5aeaca51ded65d0ce3c2c9a6f12e028fccae214b /app/javascript/mastodon/features/notifications/index.js | |
parent | 1f1d6bf2a07219c9dfd04db5b98e31a0543a7427 (diff) |
Prevent pinned columns from scroll to top on URL changing (#3586)
Diffstat (limited to 'app/javascript/mastodon/features/notifications/index.js')
-rw-r--r-- | app/javascript/mastodon/features/notifications/index.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index 60d8fff95..357c80c66 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/mastodon/features/notifications/index.js @@ -119,6 +119,7 @@ class Notifications extends React.PureComponent { let loadMore = ''; let scrollableArea = ''; let unread = ''; + let scrollContainer = ''; if (!isLoading && notifications.size > 0) { loadMore = <LoadMore onClick={this.handleLoadMore} />; @@ -149,6 +150,16 @@ class Notifications extends React.PureComponent { ); } + if (pinned) { + scrollContainer = scrollableArea; + } else { + scrollContainer = ( + <ScrollContainer scrollKey={`notifications-${columnId}`} shouldUpdateScroll={shouldUpdateScroll}> + {scrollableArea} + </ScrollContainer> + ); + } + this.scrollableArea = scrollableArea; return ( @@ -166,9 +177,7 @@ class Notifications extends React.PureComponent { <ColumnSettingsContainer /> </ColumnHeader> - <ScrollContainer scrollKey={`notifications-${columnId}`} shouldUpdateScroll={shouldUpdateScroll}> - {scrollableArea} - </ScrollContainer> + {scrollContainer} </Column> ); } |