<commit_before>{{--
    Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
    See the LICENCE file in the repository root for full licence text.
--}}
@php
    $userCanModerate = priv_check('ForumModerate', $topic->forum)->can();

    if (!isset($stateText)) {
        if (method_exists($state, 'stateText')) {
            $stateText = $state->stateText();
        } elseif (is_bool($state)) {
            $stateText = $state ? '1' : '0';
        } else {
            $stateText = (string) $state;
        }
    }
@endphp
Timeout.set(0, function() {
    $('.js-forum-topic-{{ $type }}--extra[data-topic-id={{ $topic->topic_id }}]').remove();
    $('.js-forum-topic-{{ $type }}--state[data-topic-id={{ $topic->topic_id }}]')
        .attr('data-topic-{{ $type }}', '{{ $stateText }}');
    $('.js-forum-topic-{{ $type }}[data-topic-id={{ $topic->topic_id }}]')
        .replaceWith({!! json_encode(view(
            'forum.topics._'.$type,
            compact('topic', 'state', 'userCanModerate')
        )->render()) !!});

    osu.popup({!! json_encode(trans('forum.topics.'.$type.'.to_'.$stateText.'_done')) !!}, 'success');
});<commit_msg>Fix error when replacing forum button<commit_after>{{--
    Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
    See the LICENCE file in the repository root for full licence text.
--}}
@php
    $userCanModerate = priv_check('ForumModerate', $topic->forum)->can();

    if (!isset($stateText)) {
        if (is_object($state) && method_exists($state, 'stateText')) {
            $stateText = $state->stateText();
        } elseif (is_bool($state)) {
            $stateText = $state ? '1' : '0';
        } else {
            $stateText = (string) $state;
        }
    }
@endphp
Timeout.set(0, function() {
    $('.js-forum-topic-{{ $type }}--extra[data-topic-id={{ $topic->topic_id }}]').remove();
    $('.js-forum-topic-{{ $type }}--state[data-topic-id={{ $topic->topic_id }}]')
        .attr('data-topic-{{ $type }}', '{{ $stateText }}');
    $('.js-forum-topic-{{ $type }}[data-topic-id={{ $topic->topic_id }}]')
        .replaceWith({!! json_encode(view(
            'forum.topics._'.$type,
            compact('topic', 'state', 'userCanModerate')
        )->render()) !!});

    osu.popup({!! json_encode(trans('forum.topics.'.$type.'.to_'.$stateText.'_done')) !!}, 'success');
});
{'fraction_non_alphanumeric': 0.22695328648201737, 'fraction_numerical': 0.00413393964448119, 'mean_word_length': 2.865814696485623, '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': '5896076', 'n_tokens_mistral': 821, 'n_tokens_neox': 804, 'n_words': 162}