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

fix @username #171

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/services/PostService.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static function contentReplaceAtUser($content, $model)

public static function parseUsername($content)
{
preg_match_all('/@(\S{4,255}) /', $content, $matches);
preg_match_all('/@(\S{4,255})\b/', $content, $matches);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像并不行吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我测试过的,可以的。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当已经替换过的用户名,再次编辑保存时,就会有问题了,我现在想到这种场景会有问题。让我再想想办法

if (empty($matches[1])) {
return [];
}
Expand Down