Add new 'jumpToPostId' plugin API method

This commit is contained in:
Régis Hanol 2018-03-24 02:43:39 +01:00
parent f56a746d71
commit 3a58dc0858
2 changed files with 6 additions and 2 deletions

View File

@ -205,7 +205,7 @@ export default Ember.Controller.extend(BufferedContent, {
}); });
}, },
// Called the the topmost visible post on the page changes. // Called when the topmost visible post on the page changes.
topVisibleChanged(event) { topVisibleChanged(event) {
const { post, refresh } = event; const { post, refresh } = event;
if (!post) { return; } if (!post) { return; }
@ -477,6 +477,10 @@ export default Ember.Controller.extend(BufferedContent, {
this._jumpToPostId(this.get('model.last_read_post_id')); this._jumpToPostId(this.get('model.last_read_post_id'));
}, },
jumpToPostId(postId) {
this._jumpToPostId(postId);
},
toggleMultiSelect() { toggleMultiSelect() {
this.toggleProperty('multiSelect'); this.toggleProperty('multiSelect');
this.appEvents.trigger('post-stream:refresh', { force: true }); this.appEvents.trigger('post-stream:refresh', { force: true });

View File

@ -26,7 +26,7 @@ import { addGTMPageChangedCallback } from 'discourse/lib/page-tracker';
import { registerCustomAvatarHelper } from 'discourse/helpers/user-avatar'; import { registerCustomAvatarHelper } from 'discourse/helpers/user-avatar';
// If you add any methods to the API ensure you bump up this number // If you add any methods to the API ensure you bump up this number
const PLUGIN_API_VERSION = '0.8.18'; const PLUGIN_API_VERSION = '0.8.19';
class PluginApi { class PluginApi {
constructor(version, container) { constructor(version, container) {