mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-25 09:30:13 +08:00
17 lines
558 B
JavaScript
17 lines
558 B
JavaScript
import {Rx, Message, DatabaseStore} from 'nylas-exports';
|
|
|
|
export default class ActivityDataSource {
|
|
buildObservable({openTrackingId, linkTrackingId, messageLimit}) {
|
|
const query = DatabaseStore
|
|
.findAll(Message)
|
|
.order(Message.attributes.date.descending())
|
|
.where(Message.attributes.pluginMetadata.contains(openTrackingId, linkTrackingId))
|
|
.limit(messageLimit);
|
|
this.observable = Rx.Observable.fromQuery(query);
|
|
return this.observable;
|
|
}
|
|
|
|
subscribe(callback) {
|
|
return this.observable.subscribe(callback);
|
|
}
|
|
}
|