User:Leszek Manicki (WMDE)/Echo/vi
Extension:Echo provides another notification system for MediaWiki.
Mentions
Echo can send notifications to users mentioned in discussions; this feature is often referred to as "pinging". Linking to a user's page in a signed message, either directly or through a template, will trigger a mention notification for them. The technical details of this are laid out below.
Chi tiết về kỹ thuật
When generating mention events, Echo processes revision diffs chunk by chunk, to check when a user has added a new comment which should be searched for mentioned users to ping. As of this writing, for user mention notifications to work:
- The diff chunk must be recognised as an addition of new lines of text, not a change to existing lines.[1]
- The user must sign his or her message; the message cannot contain any other signatures.[2]
- The signature must contain a plain wiki link (
[[ ]]
) to the user's page, user talk page, or contributions page, on the local wiki; it cannot be embedded in a template.[3]
- The signature must contain a plain wiki link (
- In order for the signature to be recognised, the post must contain the exact same markup that writing
~~~
(and~~~~
) generates.[4]
- In order for the signature to be recognised, the post must contain the exact same markup that writing
- Links to mentioned users' pages may be embedded in templates or not, since the diff is template-expanded[10]
- The
{{REVISIONID}}
and{{REVISIONUSER}}
variables expand to the empty string when Echo parses the diff.
- The
- If the number of detected to-be-pinged users exceeds 50, no notifications will be delivered.[11]
Also, all markup is parsed with regular expressions; sufficiently tricky markup can trigger bogus results.
References
- ↑ DiscussionParser.php,
EchoDiscussionParser::interpretDiff
, line 315 - ↑ DiscussionParser.php,
EchoDiscussionParser::interpretDiff
, lines 324–327 - ↑ DiscussionParser.php,
EchoDiscussionParser::extractUsersFromLine
, lines 620–663 - ↑ DiscussionParser.php,
EchoDiscussionParser::getUserFromLine
, lines 691–697 - ↑ DiscussionParser.php,
EchoDiscussionParser::interpretDiff
, lines 328–334 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateEventsForRevision
, lines 38–41 - ↑ DiscussionParser.php,
EchoDiscussionParser::interpretDiff
, lines 335–339 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateEventsForRevision
, lines 42–45 - ↑ DiscussionParser.php,
EchoDiscussionParser::HEADER_REGEX
, line 4 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateMentionEvents
, line 146 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateMentionEvents
, lines 185–187 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateMentionEvents
, lines 166–168 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateMentionEvents
, lines 171–173 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateMentionEvents
, lines 161–163 - ↑ DiscussionParser.php,
EchoDiscussionParser::generateMentionEvents
, lines 176–178