<commit_before>package musement

import grails.transaction.Transactional
import musement.user.User;


@Transactional
class PostService {

    NotificationService notificationService;

    /**
     * Create a Post
     * @param sender
     * @param content
     * @param toCategory
     */
    Post sendPost(User sender, String content, Category toCategory) {
        Post p = new Post(content: content);
        sender.addToPosts(p);
        toCategory.addToPosts(p);
        toCategory.save flush:true
        if (p.validate()) {
            /* Save */
            p.save flush:true
            notificationService.Notify(p);
        } else {
            p = null;
        }
        return p;
    }<commit_msg>#82 - Manage Post<commit_after>package musement

import grails.transaction.Transactional
import musement.user.User;


@Transactional
class PostService {

    NotificationService notificationService;

    /**
     * Create a Post
     * @param sender
     * @param content
     * @param toCategory
     */
    Post sendPost(User sender, String content, Category toCategory) {
        Post p = new Post(content: content);
        sender.addToPosts(p);
        toCategory.addToPosts(p);
        toCategory.save flush:true
        if (p.validate()) {
            /* Save */
            p.save flush:true
            notificationService.notifyUsers(p);
        } else {
            p = null;
        }
        return p;
    }
{'fraction_non_alphanumeric': 0.0936408106219427, 'fraction_numerical': 0.001397624039133473, 'mean_word_length': 2.014736842105263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3868276', 'n_tokens_mistral': 400, 'n_tokens_neox': 385, 'n_words': 96}