Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

后台回复评论无法触发finishComment #1764

Open
opswill opened this issue Apr 28, 2024 · 2 comments
Open

后台回复评论无法触发finishComment #1764

opswill opened this issue Apr 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@opswill
Copy link

opswill commented Apr 28, 2024

描述这个 Bug

我在用joyqi的Mailer插件来发送评论通知,插件激活部分的代码是:

public static function activate()
    {
        Feedback::pluginHandle()->finishComment = __CLASS__ . '::send';
        Service::pluginHandle()->sendMail = __CLASS__ . '::sendMail';
    }

在前台通过评论框提交评论都可以正常发送邮件,但是登录后台在 管理->评论处进行回复评论,被评论的人就没有触发邮件通知。
查看/var/Widget/Comments/Edit.php 文件 replyComment() 里面有:

/** 评论完成接口 */
            self::pluginHandle()->call('finishComment', $this);

看起来在后台进行回复评论时,似乎没有生效?

复现方式

复现的步骤:

  1. 启用Mailer插件
  2. 登录后台,在管理->评论 处回复其他人的评论
  3. 被回复的人应该收到邮件提醒,但是实际上没有.

期望的结果

后台回复评论和在插件中调用 Widget\Comments\Edit::replyComment() ,可以触发finishComment,从而发送邮件通知.

平台

  • 操作系统版本:linux
  • Apache/Nginx 版本:nginx 1.24
  • 数据库版本:mysql 8
  • PHP 版本:php8.1
  • Typecho 版本:1.2.1
  • 浏览器版本:chrome
@opswill opswill added the bug Something isn't working label Apr 28, 2024
@joyqi
Copy link
Member

joyqi commented May 9, 2024

1.2.1 里确实有可能无法触发,你试一下 1.3.0 的开发版是否可以触发

@opswill
Copy link
Author

opswill commented May 9, 2024

刚刚升级到1.3开发版,测试如下:

  1. 前台从评论框回复: 无论是否登录/是否是管理员,都可以正常发送邮件
  2. 后台评论管理处回复及刷新页面:无法发送邮件
  3. 在插件中调用 Widget\Comments\Edit ,无法发送邮件

我的插件中调用的代码如下:

use Widget\Comments\Edit as CommentsEdit;

Typecho_Widget::widget('Widget_User')->to($user); 
if(!$user->simpleLogin($replyUid)){
    return;
}  
$comment = CommentsEdit::alloc(null, ['coid' => $coid,  'text' =>  $replyText], function (CommentsEdit $comment) use ($action) {
            switch ($action) {
                case 'approved':
                    $comment->approvedComment();
                    break;
                case 'spam':
                    $comment->spamComment();
                    break;
                case 'delete':
                    $comment->deleteComment();
                    break;
                case 'reply':
                    $comment->replyComment();
                    break;
            }

        });

激活部分

 public static function activate()                                                                                                    
{
    Feedback::pluginHandle()->finishComment =  [__CLASS__, 'sendToTelegram']; 
    Service::pluginHandle()->sendComment = [__CLASS__, 'sendComment'];
    Helper::addRoute("telegramCallback", "/telegram/comment", Action::class, "action","index");                                     
}

感觉1.3应该也存在同样的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants