I’ve noticed the backup model defines a model then reopens it a few lines below in the same file, adding functions like find, start, cancel etc. I’m wondering what is the reasoning behind that? Why does the class need to be re-opened? I’m sure this is a valid reason… I just don’t know it
const Backup = Discourse.Model.extend({
destroy() {},
restore() {}
});
Backup.reopenClass({
find() {
...
}
// etc
});
See: https://github.com/discourse/discourse/blob/master/app/assets/javascripts/admin/models/backup.js.es6