@@ -197,7 +197,9 @@ private function processMail(): bool
197197 $ toMe = (in_array ('to_me ' , $ this ->_cfg ->other ) && $ this ->_comment ->ownerId == $ this ->_comment ->authorId ) ? true : false ;
198198
199199 //向博主发信
200- if ($ this ->_comment ->parent == 0 && in_array ($ this ->_comment ->status , $ this ->_cfg ->status ) && in_array ('to_owner ' , $ this ->_cfg ->other ) && ($ toMe || $ this ->_comment ->ownerId != $ this ->_comment ->authorId )) {
200+ // TODO $this->_comment->parent === '0' // parent === ‘0’ 时 为根评论
201+ // 如果在此处判断 会导致 别人评论别人的评论时 不会发送邮件给博主 后续fix
202+ if (in_array ($ this ->_comment ->status , $ this ->_cfg ->status ) && in_array ('to_owner ' , $ this ->_cfg ->other ) && ($ toMe || $ this ->_comment ->ownerId != $ this ->_comment ->authorId )) {
201203 if (!$ this ->_cfg ->mail ) {
202204 self ::widget ('\Widget\Users\Author@temp ' . $ this ->_comment ->cid , ['uid ' => $ this ->_comment ->ownerId ])->to ($ user );
203205 $ this ->_email ->reciver = $ user ->mail ;
@@ -218,7 +220,7 @@ private function processMail(): bool
218220 }
219221
220222 /** 向访客发信 */
221- if ($ this ->_comment ->parent !== 0 && $ this ->_comment ->status == 'approved ' && in_array ('to_guest ' , $ this ->_cfg ->other )) {
223+ if ($ this ->_comment ->parent !== ' 0 ' && $ this ->_comment ->status == 'approved ' && in_array ('to_guest ' , $ this ->_cfg ->other )) {
222224 /** 如果联系我的邮件地址为空,则使用文章作者的邮件地址 */
223225 if (!$ this ->_cfg ->contactme ) {
224226 if (!isset ($ user ) || !$ user ) {
@@ -229,9 +231,8 @@ private function processMail(): bool
229231 $ this ->_comment ->contactme = $ this ->_cfg ->contactme ;
230232 }
231233
232- $ original = $ this ->_db ->fetchRow ($ this ->_db ->select ('author ' , 'mail ' , 'text ' )
233- ->from ('table.comments ' )
234- ->where ('coid = ? ' , $ this ->_comment ->parent ));
234+ $ original = $ this ->_db ->fetchRow ($ this ->_db ->select ('author ' , 'mail ' , 'text ' )->from ('table.comments ' )->where ('coid = ? ' , $ this ->_comment ->parent ));
235+ // 被评论者
235236 if (in_array ('to_me ' , $ this ->_cfg ->other ) || $ this ->_comment ->mail != $ original ['mail ' ]) {
236237 $ this ->_comment ->originalText = $ original ['text ' ];
237238 $ this ->_comment ->originalAuthor = $ original ['author ' ];
@@ -244,6 +245,8 @@ private function processMail(): bool
244245 }
245246 }
246247
248+ unset($ this ->_comment ); //销毁评论对象
249+ unset($ this ->_email ); //销毁对象
247250 return true ;
248251 }
249252
@@ -379,8 +382,6 @@ public function sendMail(): bool|string|NULL
379382 $ mailer ->ClearAddresses ();
380383 $ mailer ->ClearReplyTos ();
381384
382- unset($ this ->_email ); //销毁对象
383- unset($ this ->_comment ); //销毁评论对象
384385 return $ result ;
385386 }
386387
0 commit comments