<commit_before>import * as mongo from 'mongodb';
import Notification from '../models/notification';
import event from '../event';
import serialize from '../serializers/notification';

export default (
	notifiee: mongo.ObjectID,
	notifier: mongo.ObjectID,
	type: string,
	content: any
) => new Promise<any>(async (resolve, reject) => {
	if (notifiee.equals(notifier)) {
		resolve();
	}

	// Create notification
	const res = await Notification.insert(Object.assign({
		created_at: new Date(),
		notifiee_id: notifiee,
		notifier_id: notifier,
		type: type,
		is_read: false
	}, content));

	const notification = res.ops[0];

	resolve(notification);

	// Publish notification event
	event(notifiee, 'notification',
		await serialize(notification));
});
<commit_msg>Fix bug<commit_after>import * as mongo from 'mongodb';
import Notification from '../models/notification';
import event from '../event';
import serialize from '../serializers/notification';

export default (
	notifiee: mongo.ObjectID,
	notifier: mongo.ObjectID,
	type: string,
	content: any
) => new Promise<any>(async (resolve, reject) => {
	if (notifiee.equals(notifier)) {
		return resolve();
	}

	// Create notification
	const res = await Notification.insert(Object.assign({
		created_at: new Date(),
		notifiee_id: notifiee,
		notifier_id: notifier,
		type: type,
		is_read: false
	}, content));

	const notification = res.ops[0];

	resolve(notification);

	// Publish notification event
	event(notifiee, 'notification',
		await serialize(notification));
});

{'fraction_non_alphanumeric': 0.1377049180327869, 'fraction_numerical': 0.0013114754098360656, 'mean_word_length': 4.802281368821292, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2726383', 'n_tokens_mistral': 509, 'n_tokens_neox': 484, 'n_words': 128}