UX: When summarizing/filtering by participant jump to second post
This commit is contained in:
parent
b9add46c92
commit
fb03c13bc6
|
@ -16,6 +16,7 @@ function calcDayDiff(p1, p2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PostStream = RestModel.extend({
|
const PostStream = RestModel.extend({
|
||||||
loading: Em.computed.or('loadingAbove', 'loadingBelow', 'loadingFilter', 'stagingPost'),
|
loading: Em.computed.or('loadingAbove', 'loadingBelow', 'loadingFilter', 'stagingPost'),
|
||||||
notLoading: Em.computed.not('loading'),
|
notLoading: Em.computed.not('loading'),
|
||||||
|
@ -137,7 +138,13 @@ const PostStream = RestModel.extend({
|
||||||
toggleSummary() {
|
toggleSummary() {
|
||||||
this.get('userFilters').clear();
|
this.get('userFilters').clear();
|
||||||
this.toggleProperty('summary');
|
this.toggleProperty('summary');
|
||||||
return this.refresh();
|
|
||||||
|
const self = this;
|
||||||
|
return this.refresh().then(function() {
|
||||||
|
if (self.get('summary')) {
|
||||||
|
self.jumpToSecondVisible();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleDeleted() {
|
toggleDeleted() {
|
||||||
|
@ -145,17 +152,33 @@ const PostStream = RestModel.extend({
|
||||||
return this.refresh();
|
return this.refresh();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
jumpToSecondVisible() {
|
||||||
|
const posts = this.get('posts');
|
||||||
|
if (posts.length > 1) {
|
||||||
|
const secondPostNum = posts[1].get('post_number');
|
||||||
|
Discourse.URL.jumpToPost(secondPostNum);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Filter the stream to a particular user.
|
// Filter the stream to a particular user.
|
||||||
toggleParticipant(username) {
|
toggleParticipant(username) {
|
||||||
const userFilters = this.get('userFilters');
|
const userFilters = this.get('userFilters');
|
||||||
this.set('summary', false);
|
this.set('summary', false);
|
||||||
this.set('show_deleted', true);
|
this.set('show_deleted', true);
|
||||||
|
|
||||||
|
let jump = false;
|
||||||
if (userFilters.contains(username)) {
|
if (userFilters.contains(username)) {
|
||||||
userFilters.removeObject(username);
|
userFilters.removeObject(username);
|
||||||
} else {
|
} else {
|
||||||
userFilters.addObject(username);
|
userFilters.addObject(username);
|
||||||
|
jump = true;
|
||||||
}
|
}
|
||||||
return this.refresh();
|
const self = this;
|
||||||
|
return this.refresh().then(function() {
|
||||||
|
if (jump) {
|
||||||
|
self.jumpToSecondVisible();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue