<commit_before><?php

declare(strict_types=1);

namespace App\Observers;

use App\Jobs\PushToJedi;
use App\User;
use DateTime;

class UserObserver
{
    public function saved(User $user): void
    {
        PushToJedi::dispatch($user, User::class, $user->id, 'saved')->onQueue('jedi');
    }

    public function updated(User $user): void
    {
        if (null === $user->access_override_until || $user->access_override_until <= new DateTime()) {
            return;
        }

        PushToJedi::dispatch($user, User::class, $user->id, 'updated/access override expiration')
            ->delay($user->access_override_until)->onQueue('jedi');
    }
}<commit_msg>Update majors when user is created<commit_after><?php

declare(strict_types=1);

namespace App\Observers;

use App\Jobs\PushToJedi;
use App\User;
use DateTime;

class UserObserver
{
    public function created(User $user): void
    {
        if ('cas_login' === $user->create_reason) {
            return;
        }

        UpdateMajorsForUser::dispatch($user)->onQueue('buzzapi');
    }

    public function saved(User $user): void
    {
        PushToJedi::dispatch($user, User::class, $user->id, 'saved')->onQueue('jedi');
    }

    public function updated(User $user): void
    {
        if (null === $user->access_override_until || $user->access_override_until <= new DateTime()) {
            return;
        }

        PushToJedi::dispatch($user, User::class, $user->id, 'updated/access override expiration')
            ->delay($user->access_override_until)->onQueue('jedi');
    }
}
{'fraction_non_alphanumeric': 0.15221579961464354, 'fraction_numerical': 0.0012845215157353885, 'mean_word_length': 3.1994609164420487, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '7532438', 'n_tokens_mistral': 488, 'n_tokens_neox': 475, 'n_words': 95}