UX: Don't animate timeline when first entering a topic

This commit is contained in:
Robin Ward 2016-05-20 12:13:10 -04:00
parent c046b003db
commit 4963d4d624
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D
2 changed files with 9 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import loadScript from 'discourse/lib/load-script';
import DiscourseURL from 'discourse/lib/url';
// Use the message bus for live reloading of components for faster development.
export default {
@ -30,6 +31,11 @@ export default {
});
});
// Useful to export this for debugging purposes
if (Discourse.Environment === 'development' && !Ember.testing) {
window.DiscourseURL = DiscourseURL;
}
// Observe file changes
messageBus.subscribe("/file-change", function(data) {
if (Handlebars.compile && !Ember.TEMPLATES.empty) {

View file

@ -83,7 +83,7 @@ createWidget('timeline-scrollarea', {
},
defaultState() {
return { percentage: 0, scrolledPost: 1 };
return { percentage: null, scrolledPost: 1 };
},
position() {
@ -124,6 +124,8 @@ createWidget('timeline-scrollarea', {
state.scrolledPost = position.current;
const percentage = state.percentage;
if (percentage === null) { return; }
const before = SCROLLAREA_REMAINING * percentage;
const after = (SCROLLAREA_HEIGHT - before) - SCROLLER_HEIGHT;
@ -133,7 +135,6 @@ createWidget('timeline-scrollarea', {
this.attach('timeline-padding', { height: after })
];
if (position.lastRead && position.lastRead < attrs.topic.posts_count) {
const lastReadTop = Math.round(position.lastReadPercentage * SCROLLAREA_HEIGHT);
if (lastReadTop > (before + SCROLLER_HEIGHT)) {