Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Step 12.30: Add hook for removing unused messages
- Loading branch information
1 parent
74bcd42
commit 8cd2d26
Showing
1 changed file
with
7 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import { MongoObservable } from 'meteor-rxjs'; | ||
import { Chat } from '../models'; | ||
import { Messages } from './messages'; | ||
|
||
export const Chats = new MongoObservable.Collection<Chat>('chats'); | ||
export const Chats = new MongoObservable.Collection<Chat>('chats'); | ||
|
||
// Dispose unused messages | ||
Chats.collection.after.remove(function (userId, doc) { | ||
Messages.collection.remove({ chatId: doc._id }); | ||
}); |