nodebb-plugin-mentions 4.3.7 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +2 -2
- package/LICENSE +7 -7
- package/README.md +13 -13
- package/languages/ar/notifications.json +2 -2
- package/languages/bg/notifications.json +2 -2
- package/languages/bn/notifications.json +2 -2
- package/languages/da/notifications.json +2 -2
- package/languages/de/notifications.json +5 -5
- package/languages/el/notifications.json +2 -2
- package/languages/en@pirate/notifications.json +4 -4
- package/languages/en_GB/mentions.json +3 -3
- package/languages/en_GB/notifications.json +7 -7
- package/languages/en_US/notifications.json +4 -4
- package/languages/es/notifications.json +3 -3
- package/languages/et/notifications.json +2 -2
- package/languages/fa_IR/notifications.json +4 -4
- package/languages/fi/notifications.json +2 -2
- package/languages/fr/notifications.json +5 -5
- package/languages/gl/notifications.json +2 -2
- package/languages/id/notifications.json +2 -2
- package/languages/it/notifications.json +3 -3
- package/languages/ja/notifications.json +4 -4
- package/languages/jbo/notifications.json +4 -4
- package/languages/ko/notifications.json +2 -2
- package/languages/lt/notifications.json +2 -2
- package/languages/ms/notifications.json +2 -2
- package/languages/nl/notifications.json +2 -2
- package/languages/pl/mentions.json +3 -3
- package/languages/pl/notifications.json +6 -6
- package/languages/pt-PT/notifications.json +6 -6
- package/languages/pt_BR/notifications.json +3 -3
- package/languages/ro/notifications.json +2 -2
- package/languages/rw/notifications.json +2 -2
- package/languages/sl/notifications.json +2 -2
- package/languages/sr/notifications.json +2 -2
- package/languages/sv/notifications.json +2 -2
- package/languages/tr/notifications.json +6 -6
- package/languages/vi/notifications.json +2 -2
- package/languages/zh-CN/mentions.json +3 -3
- package/languages/zh-CN/notifications.json +5 -5
- package/languages/zh_TW/notifications.json +2 -2
- package/library.js +101 -50
- package/package.json +5 -6
- package/plugin.json +31 -31
- package/static/.eslintrc +3 -3
- package/test/index.js +16 -0
package/.eslintrc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "nodebb/lib"
|
|
1
|
+
{
|
|
2
|
+
"extends": "nodebb/lib"
|
|
3
3
|
}
|
package/LICENSE
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
Copyright (c) 2013-2014, Julian Lam <julian@designcreateplay.com>
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
1
|
+
Copyright (c) 2013-2014, Julian Lam <julian@designcreateplay.com>
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
8
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# Username/Group Mentions
|
|
2
|
-
|
|
3
|
-
This NodeBB plugin allows posters to reference (or *mention*) other users or groups on a NodeBB by simply
|
|
4
|
-
precluding the `@` symbol before a username.
|
|
5
|
-
|
|
6
|
-
A link is automatically added to the post.
|
|
7
|
-
|
|
8
|
-
## Installation
|
|
9
|
-
|
|
10
|
-
This plugin is bundled with every NodeBB install. If not, you can install it via the Plugins page of the ACP.
|
|
11
|
-
|
|
12
|
-
Alternatively,
|
|
13
|
-
|
|
1
|
+
# Username/Group Mentions
|
|
2
|
+
|
|
3
|
+
This NodeBB plugin allows posters to reference (or *mention*) other users or groups on a NodeBB by simply
|
|
4
|
+
precluding the `@` symbol before a username.
|
|
5
|
+
|
|
6
|
+
A link is automatically added to the post.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
This plugin is bundled with every NodeBB install. If not, you can install it via the Plugins page of the ACP.
|
|
11
|
+
|
|
12
|
+
Alternatively,
|
|
13
|
+
|
|
14
14
|
npm install nodebb-plugin-mentions
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> ذكرَ اسمك في <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> ذكرَ اسمك في <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> Ви спомена в <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> Ви спомена в <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong>, <strong>%2</strong> এ আপনার নাম উল্লেখ করেছেন"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong>, <strong>%2</strong> এ আপনার নাম উল্লেখ করেছেন"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> nævnte dig i <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> nævnte dig i <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Erwähnungen",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> erwähnte dich in <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> erwähnte <strong>%2</strong> in <strong>%3</strong>",
|
|
5
|
-
"notificationType_mention": "Wenn dich jemand erwähnt"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Erwähnungen",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> erwähnte dich in <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> erwähnte <strong>%2</strong> in <strong>%3</strong>",
|
|
5
|
+
"notificationType_mention": "Wenn dich jemand erwähnt"
|
|
6
6
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "Ο/Η <strong>%1</strong> σε ανέφερε στο <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "Ο/Η <strong>%1</strong> σε ανέφερε στο <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> spoke yer name in <strong>%2</strong>",
|
|
3
|
-
"user-mentioned-group-in": "<strong>%1</strong> called fer <strong>%2</strong> in <strong>%3</strong>"
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> spoke yer name in <strong>%2</strong>",
|
|
3
|
+
"user-mentioned-group-in": "<strong>%1</strong> called fer <strong>%2</strong> in <strong>%3</strong>"
|
|
4
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>"
|
|
3
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Mentions",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-you-in-room": "<strong>%1</strong> mentioned you in <strong class=\"text-nowrap\"><i class=\"fa %2\"></i>%3</strong>",
|
|
5
|
-
"user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>",
|
|
6
|
-
"notificationType-mention": "When someone mentions you"
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Mentions",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-you-in-room": "<strong>%1</strong> mentioned you in <strong class=\"text-nowrap\"><i class=\"fa %2\"></i>%3</strong>",
|
|
5
|
+
"user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>",
|
|
6
|
+
"notificationType-mention": "When someone mentions you"
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
|
3
|
-
"user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>"
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
|
3
|
+
"user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>"
|
|
4
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Menciones",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> te mencionó en <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Menciones",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> te mencionó en <strong>%2</strong>"
|
|
4
4
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> mainis sind postituses <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> mainis sind postituses <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> شما رو در <strong>%2</strong> منشن کرده",
|
|
3
|
-
"user-mentioned-group-in": "<strong>%1</strong> گروه <strong>%2</strong> رو در <strong>%3</strong> منشن کرده"
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> شما رو در <strong>%2</strong> منشن کرده",
|
|
3
|
+
"user-mentioned-group-in": "<strong>%1</strong> گروه <strong>%2</strong> رو در <strong>%3</strong> منشن کرده"
|
|
4
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> mainitsi sinut viestissä <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> mainitsi sinut viestissä <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Mentions",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> vous a mentionné dans <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> a mentionné <strong>%2</strong> dans <strong>%3</strong>",
|
|
5
|
-
"notificationType_mention": "Lorsque quelqu'un vous mentionne"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Mentions",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> vous a mentionné dans <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> a mentionné <strong>%2</strong> dans <strong>%3</strong>",
|
|
5
|
+
"notificationType_mention": "Lorsque quelqu'un vous mentionne"
|
|
6
6
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> mencionóute en <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> mencionóute en <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> menyebut mu di <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> menyebut mu di <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Menzioni",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> ti ha menzionato in <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Menzioni",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> ti ha menzionato in <strong>%2</strong>"
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "メンション",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "メンション",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> mentioned you in <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> mentioned <strong>%2</strong> in <strong>%3</strong>"
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "la .<strong>%1</strong>. klacpe do la .<strong>%2</strong>.",
|
|
3
|
-
"user-mentioned-group-in": "la .<strong>%1</strong>. klacpe la .<strong>%2</strong>. la .<strong>%3</strong>."
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "la .<strong>%1</strong>. klacpe do la .<strong>%2</strong>.",
|
|
3
|
+
"user-mentioned-group-in": "la .<strong>%1</strong>. klacpe la .<strong>%2</strong>. la .<strong>%3</strong>."
|
|
4
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong>님이 <strong>%2</strong>에서 나를 언급했습니다."
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong>님이 <strong>%2</strong>에서 나를 언급했습니다."
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> paminėjo Jus <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> paminėjo Jus <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> sebut anda di <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> sebut anda di <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "Onze naam is genoemd door <strong>%1</strong> in <strong>%2</strong>."
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "Onze naam is genoemd door <strong>%1</strong> in <strong>%2</strong>."
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> wspomniał o Tobie w <strong>%2</strong>"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> wspomniał o Tobie w <strong>%2</strong>"
|
|
3
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Wspomnienia",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> wspomniał o Tobie w <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> wspomniał <strong>%2</strong> w <strong>%3</strong>",
|
|
5
|
-
"notificationType_mention": "Kiedy ktoś o Tobie wspomni"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Wspomnienia",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> wspomniał o Tobie w <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> wspomniał <strong>%2</strong> w <strong>%3</strong>",
|
|
5
|
+
"notificationType_mention": "Kiedy ktoś o Tobie wspomni"
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Menções",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> mencionou-te no tópico <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> mencionou o grupo <strong>%2</strong> no tópico <strong>%3</strong>",
|
|
5
|
-
"notificationType_mention": "Quando alguém te menciona"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Menções",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> mencionou-te no tópico <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> mencionou o grupo <strong>%2</strong> no tópico <strong>%3</strong>",
|
|
5
|
+
"notificationType_mention": "Quando alguém te menciona"
|
|
6
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Menções",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> mencionou você em <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Menções",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> mencionou você em <strong>%2</strong>"
|
|
4
4
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> te-a menționat în <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> te-a menționat în <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> yakuvuze muri <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> yakuvuze muri <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> te je omenil v <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> te je omenil v <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> вас помену у <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> вас помену у <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> nämnde dig i <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> nämnde dig i <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "Bahsedilmeler",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> sizden şu konuda bahsetti: <strong>%2</strong>",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> kullanıcısı <strong>%2</strong> grubundan şu konuda bahsetti: <strong>%3</strong>",
|
|
5
|
-
"notificationType_mention": "Biri sizden bahsettiğinde"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"mentions": "Bahsedilmeler",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> sizden şu konuda bahsetti: <strong>%2</strong>",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> kullanıcısı <strong>%2</strong> grubundan şu konuda bahsetti: <strong>%3</strong>",
|
|
5
|
+
"notificationType_mention": "Biri sizden bahsettiğinde"
|
|
6
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> nhắc đến bạn trong <strong>%2</strong>"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> nhắc đến bạn trong <strong>%2</strong>"
|
|
3
3
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong> 中提到了您"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong> 中提到了您"
|
|
3
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"mentions": "提到",
|
|
3
|
-
"user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong> 中提到了你",
|
|
4
|
-
"user-mentioned-group-in": "<strong>%1</strong> 在 <strong>%3</strong> 中提到了 <strong>%2</strong>",
|
|
5
|
-
"notificationType_mention": "当有人提到你时"
|
|
1
|
+
{
|
|
2
|
+
"mentions": "提到",
|
|
3
|
+
"user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong> 中提到了你",
|
|
4
|
+
"user-mentioned-group-in": "<strong>%1</strong> 在 <strong>%3</strong> 中提到了 <strong>%2</strong>",
|
|
5
|
+
"notificationType_mention": "当有人提到你时"
|
|
6
6
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong>提到你"
|
|
1
|
+
{
|
|
2
|
+
"user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong>提到你"
|
|
3
3
|
}
|
package/library.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
const _ = require('lodash');
|
|
6
|
-
const XRegExp = require('xregexp');
|
|
7
6
|
const validator = require('validator');
|
|
8
7
|
const entitiesDecode = require('html-entities').decode;
|
|
9
8
|
|
|
@@ -12,6 +11,7 @@ const winston = require.main.require('winston');
|
|
|
12
11
|
|
|
13
12
|
const db = require.main.require('./src/database');
|
|
14
13
|
const api = require.main.require('./src/api');
|
|
14
|
+
const meta = require.main.require('./src/meta');
|
|
15
15
|
const Topics = require.main.require('./src/topics');
|
|
16
16
|
const posts = require.main.require('./src/posts');
|
|
17
17
|
const User = require.main.require('./src/user');
|
|
@@ -29,12 +29,12 @@ const SocketPlugins = require.main.require('./src/socket.io/plugins');
|
|
|
29
29
|
const utility = require('./lib/utility');
|
|
30
30
|
|
|
31
31
|
const parts = {
|
|
32
|
-
before: '(
|
|
33
|
-
main: '(@[\\p{L}\\d\\-_
|
|
34
|
-
after: '((?=\\b)(?=[^-])|$)', // used to figure out where latin mentions end
|
|
32
|
+
before: '(?<=(^|\\P{L}))', // a single unicode non-letter character or start of line
|
|
33
|
+
main: '(@[\\p{L}\\d\\-_.@]+)', // unicode letters, numbers, dashes, underscores, or periods
|
|
34
|
+
after: '((?=\\b)(?=[^-])|(?=[^\\p{L}\\d\\-_.@])|$)', // used to figure out where latin mentions end
|
|
35
35
|
};
|
|
36
|
-
const regex =
|
|
37
|
-
const isLatinMention = /@[\w\d\-_
|
|
36
|
+
const regex = RegExp(`${parts.before}${parts.main}`, 'gu');
|
|
37
|
+
const isLatinMention = /@[\w\d\-_.@]+$/;
|
|
38
38
|
|
|
39
39
|
const Mentions = module.exports;
|
|
40
40
|
|
|
@@ -79,34 +79,57 @@ function getNoMentionGroups() {
|
|
|
79
79
|
return noMentionGroups;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
Mentions.notify = async function (
|
|
83
|
-
const
|
|
84
|
-
const postOwner = parseInt(postData.uid, 10);
|
|
85
|
-
const cleanedContent = Mentions.clean(postData.content, true, true, true);
|
|
86
|
-
let matches = cleanedContent.match(regex);
|
|
87
|
-
if (!matches) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
82
|
+
Mentions.notify = async function ({ post }) {
|
|
83
|
+
const postOwner = parseInt(post.uid, 10);
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
let uidsToNotify;
|
|
86
|
+
let groupsToNotify;
|
|
87
|
+
if (utils.isNumber(post.pid)) {
|
|
88
|
+
const cleanedContent = Mentions.clean(post.content, true, true, true);
|
|
89
|
+
let matches = cleanedContent.match(regex);
|
|
90
|
+
if (!matches) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
96
93
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
const noMentionGroups = getNoMentionGroups();
|
|
95
|
+
matches = _.uniq(matches.map(match => slugify(match))).filter(match => match && !noMentionGroups.includes(match));
|
|
96
|
+
if (!matches.length) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
([uidsToNotify, groupsToNotify] = await Promise.all([
|
|
101
|
+
getUidsToNotify(matches),
|
|
102
|
+
getGroupsToNotify(matches),
|
|
103
|
+
]));
|
|
104
|
+
} else if (post._activitypub) { // ActivityPub
|
|
105
|
+
const { tag } = post._activitypub;
|
|
106
|
+
groupsToNotify = []; // cannot mention groups for now
|
|
107
|
+
|
|
108
|
+
if (tag.length) {
|
|
109
|
+
const slugs = tag.reduce((slugs, tag) => {
|
|
110
|
+
if (tag.type === 'Mention') {
|
|
111
|
+
const [slug, hostname] = tag.name.slice(1).split('@');
|
|
112
|
+
if (hostname === nconf.get('url_parsed').hostname) {
|
|
113
|
+
slugs.push(slug);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return slugs;
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
uidsToNotify = slugs.length ? await db.sortedSetScores('userslug:uid', slugs) : [];
|
|
120
|
+
} else {
|
|
121
|
+
uidsToNotify = [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
101
124
|
|
|
102
125
|
if (!uidsToNotify.length && !groupsToNotify.length) {
|
|
103
126
|
return;
|
|
104
127
|
}
|
|
105
128
|
|
|
106
129
|
const [topic, userData, topicFollowers] = await Promise.all([
|
|
107
|
-
Topics.getTopicFields(
|
|
108
|
-
User.getUserFields(
|
|
109
|
-
Mentions._settings.disableFollowedTopics === 'on' ? Topics.getFollowers(
|
|
130
|
+
Topics.getTopicFields(post.tid, ['title', 'cid']),
|
|
131
|
+
User.getUserFields(post.uid, ['username']),
|
|
132
|
+
Mentions._settings.disableFollowedTopics === 'on' ? Topics.getFollowers(post.tid) : [],
|
|
110
133
|
]);
|
|
111
134
|
const { displayname } = userData;
|
|
112
135
|
const title = entitiesDecode(topic.title);
|
|
@@ -117,8 +140,8 @@ Mentions.notify = async function (data) {
|
|
|
117
140
|
);
|
|
118
141
|
|
|
119
142
|
if (Mentions._settings.privilegedDirectReplies === 'on') {
|
|
120
|
-
const toPid = await posts.getPostField(
|
|
121
|
-
uids = await filterPrivilegedUids(uids,
|
|
143
|
+
const toPid = await posts.getPostField(post.pid, 'toPid');
|
|
144
|
+
uids = await filterPrivilegedUids(uids, post.cid, toPid);
|
|
122
145
|
}
|
|
123
146
|
|
|
124
147
|
const groupMemberUids = {};
|
|
@@ -134,20 +157,20 @@ Mentions.notify = async function (data) {
|
|
|
134
157
|
});
|
|
135
158
|
});
|
|
136
159
|
|
|
137
|
-
const filteredUids = await filterUidsAlreadyMentioned(uids,
|
|
160
|
+
const filteredUids = await filterUidsAlreadyMentioned(uids, post.pid);
|
|
138
161
|
if (filteredUids.length) {
|
|
139
|
-
await sendNotificationToUids(
|
|
140
|
-
await db.setAdd(`mentions:pid:${
|
|
162
|
+
await sendNotificationToUids(post, filteredUids, 'user', `[[notifications:user-mentioned-you-in, ${displayname}, ${titleEscaped}]]`);
|
|
163
|
+
await db.setAdd(`mentions:pid:${post.pid}:uids`, filteredUids);
|
|
141
164
|
}
|
|
142
165
|
|
|
143
166
|
for (let i = 0; i < groupsToNotify.length; ++i) {
|
|
144
167
|
if (groupsToNotify[i] && groupsToNotify[i].name && groupsToNotify[i].members) {
|
|
145
168
|
const memberUids = groupsToNotify[i].members;
|
|
146
169
|
const groupName = groupsToNotify[i].name;
|
|
147
|
-
const groupMentionSent = await db.isSetMember(`mentions:pid:${
|
|
170
|
+
const groupMentionSent = await db.isSetMember(`mentions:pid:${post.pid}:groups`, groupName);
|
|
148
171
|
if (!groupMentionSent && memberUids.length) {
|
|
149
|
-
await sendNotificationToUids(
|
|
150
|
-
await db.setAdd(`mentions:pid:${
|
|
172
|
+
await sendNotificationToUids(post, memberUids, groupName, `[[notifications:user-mentioned-group-in, ${displayname} , ${groupName}, ${titleEscaped}]]`);
|
|
173
|
+
await db.setAdd(`mentions:pid:${post.pid}:groups`, groupName);
|
|
151
174
|
}
|
|
152
175
|
}
|
|
153
176
|
}
|
|
@@ -296,7 +319,7 @@ async function createNotification(postData, nidType, notificationText) {
|
|
|
296
319
|
pid: postData.pid,
|
|
297
320
|
tid: postData.tid,
|
|
298
321
|
from: postData.uid,
|
|
299
|
-
path: `/post/${postData.pid}`,
|
|
322
|
+
path: `/post/${encodeURIComponent(postData.pid)}`,
|
|
300
323
|
topicTitle: title ? utils.decodeHTMLEntities(title) : title,
|
|
301
324
|
importance: 6,
|
|
302
325
|
});
|
|
@@ -316,8 +339,8 @@ function removePunctuationSuffix(string) {
|
|
|
316
339
|
return string.replace(/[!?.]*$/, '');
|
|
317
340
|
}
|
|
318
341
|
|
|
319
|
-
|
|
320
|
-
|
|
342
|
+
function getMatches(content, isMarkdown = false) {
|
|
343
|
+
const splitContent = utility.split(content, isMarkdown, false, true);
|
|
321
344
|
let matches = [];
|
|
322
345
|
splitContent.forEach((cleanedContent, i) => {
|
|
323
346
|
if ((i % 2) === 0) {
|
|
@@ -325,6 +348,33 @@ Mentions.parseRaw = async (content) => {
|
|
|
325
348
|
}
|
|
326
349
|
});
|
|
327
350
|
|
|
351
|
+
return { splitContent, matches };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Mentions.getMatches = async (content) => {
|
|
355
|
+
// Exported method only accepts markdown, also filters out dupes and matches to ensure slugs exist
|
|
356
|
+
let { matches } = getMatches(content, true);
|
|
357
|
+
matches = await filterMatches(matches);
|
|
358
|
+
const ids = await Promise.all(matches.map(async m => User.getUidByUserslug(m.slice(1).toLowerCase())));
|
|
359
|
+
matches = matches.map((slug, idx) => (ids[idx] ? {
|
|
360
|
+
id: ids[idx],
|
|
361
|
+
slug,
|
|
362
|
+
} : null)).filter(Boolean);
|
|
363
|
+
|
|
364
|
+
return new Set(matches);
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
async function filterMatches(matches) {
|
|
368
|
+
matches = Array.from(new Set(matches));
|
|
369
|
+
const exists = await Promise.all(matches.map(match => meta.userOrGroupExists(match.slice(1))));
|
|
370
|
+
|
|
371
|
+
return matches.filter((m, i) => exists[[i]]);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
Mentions.parseRaw = async (content) => {
|
|
375
|
+
// Note: Mentions.clean explicitly can't be called here because I need the content unstripped
|
|
376
|
+
let { splitContent, matches } = getMatches(content);
|
|
377
|
+
|
|
328
378
|
if (!matches.length) {
|
|
329
379
|
return content;
|
|
330
380
|
}
|
|
@@ -342,20 +392,23 @@ Mentions.parseRaw = async (content) => {
|
|
|
342
392
|
await Promise.all(matches.map(async (match) => {
|
|
343
393
|
const slug = slugify(match.slice(1));
|
|
344
394
|
match = removePunctuationSuffix(match);
|
|
345
|
-
|
|
346
395
|
const uid = await User.getUidByUserslug(slug);
|
|
347
|
-
const
|
|
396
|
+
const { groupExists, user } = await utils.promiseParallel({
|
|
348
397
|
groupExists: Groups.existsBySlug(slug),
|
|
349
398
|
user: User.getUserFields(uid, ['uid', 'username', 'fullname']),
|
|
350
399
|
});
|
|
351
400
|
|
|
352
|
-
if (
|
|
401
|
+
if (user.uid || groupExists) {
|
|
402
|
+
let url;
|
|
403
|
+
if (user.uid) {
|
|
404
|
+
url = utils.isNumber(user.uid) ? `${nconf.get('url')}/uid/${user.uid}` : user.uid;
|
|
405
|
+
} else {
|
|
406
|
+
url = `${nconf.get('url')}/groups/${slug}`;
|
|
407
|
+
}
|
|
353
408
|
const regex = isLatinMention.test(match) ?
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
409
|
+
RegExp(`${parts.before}${match}${parts.after}`, 'gu') :
|
|
410
|
+
RegExp(`${parts.before}${match}`, 'gu');
|
|
357
411
|
let skip = false;
|
|
358
|
-
|
|
359
412
|
splitContent = splitContent.map((c, i) => {
|
|
360
413
|
// *Might* not be needed anymore? Check pls...
|
|
361
414
|
if (skip || (i % 2) === 1) {
|
|
@@ -368,20 +421,18 @@ Mentions.parseRaw = async (content) => {
|
|
|
368
421
|
const atIndex = match.indexOf('@');
|
|
369
422
|
const plain = match.slice(0, atIndex);
|
|
370
423
|
match = match.slice(atIndex);
|
|
371
|
-
if (
|
|
424
|
+
if (user.uid) {
|
|
372
425
|
switch (Mentions._settings.display) {
|
|
373
426
|
case 'fullname':
|
|
374
|
-
match =
|
|
427
|
+
match = user.fullname || match;
|
|
375
428
|
break;
|
|
376
429
|
case 'username':
|
|
377
|
-
match =
|
|
430
|
+
match = user.username;
|
|
378
431
|
break;
|
|
379
432
|
}
|
|
380
433
|
}
|
|
381
434
|
|
|
382
|
-
const str =
|
|
383
|
-
`<a class="plugin-mentions-user plugin-mentions-a" href="${nconf.get('url')}/uid/${results.user.uid}">${match}</a>` :
|
|
384
|
-
`<a class="plugin-mentions-group plugin-mentions-a" href="${nconf.get('url')}/groups/${slug}">${match}</a>`;
|
|
435
|
+
const str = `<a class="plugin-mentions-${user.uid ? 'user' : 'group'} plugin-mentions-a" href="${url}">${match}</a>`;
|
|
385
436
|
|
|
386
437
|
return plain + str;
|
|
387
438
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-mentions",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,13 +27,12 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"html-entities": "^2.3.2",
|
|
29
29
|
"lodash": "4.17.21",
|
|
30
|
-
"validator": "^13.0.0"
|
|
31
|
-
"xregexp": "^5.1.0"
|
|
30
|
+
"validator": "^13.0.0"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"mocha": "10.
|
|
35
|
-
"eslint": "8.
|
|
33
|
+
"mocha": "10.3.0",
|
|
34
|
+
"eslint": "8.57.0",
|
|
36
35
|
"eslint-config-nodebb": "0.2.1",
|
|
37
|
-
"eslint-plugin-import": "2.29.
|
|
36
|
+
"eslint-plugin-import": "2.29.1"
|
|
38
37
|
}
|
|
39
38
|
}
|
package/plugin.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "nodebb-plugin-mentions",
|
|
3
|
-
"name": "Username Mentions",
|
|
4
|
-
"description": "NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username",
|
|
5
|
-
"url": "https://github.com/julianlam/nodebb-plugin-mentions",
|
|
6
|
-
"library": "./library.js",
|
|
7
|
-
"upgrades": [
|
|
8
|
-
"upgrades/mentions_delete_mentions_set_zset.js"
|
|
9
|
-
],
|
|
10
|
-
"hooks": [
|
|
11
|
-
{ "hook": "static:app.load", "method": "init" },
|
|
12
|
-
{ "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
|
|
13
|
-
{ "hook": "filter:parse.post", "method": "parsePost" },
|
|
14
|
-
{ "hook": "filter:parse.raw", "method": "parseRaw" },
|
|
15
|
-
{ "hook": "action:post.save", "method": "notify" },
|
|
16
|
-
{ "hook": "action:post.edit", "method": "notify" },
|
|
17
|
-
{ "hook": "action:posts.purge", "method": "actionPostsPurge" },
|
|
18
|
-
{ "hook": "action:messaging.save", "method": "notifyMessage" },
|
|
19
|
-
{ "hook": "filter:notifications.addFilters", "method": "addFilters" },
|
|
20
|
-
{ "hook": "filter:user.notificationTypes", "method": "notificationTypes" },
|
|
21
|
-
{ "hook": "filter:users.addFields", "method": "addFields" }
|
|
22
|
-
],
|
|
23
|
-
"scripts": [
|
|
24
|
-
"static/autofill.js"
|
|
25
|
-
],
|
|
26
|
-
"modules": {
|
|
27
|
-
"../admin/plugins/mentions.js": "./static/admin.js"
|
|
28
|
-
},
|
|
29
|
-
"languages": "languages",
|
|
30
|
-
"defaultLang": "en_GB",
|
|
31
|
-
"templates": "templates"
|
|
1
|
+
{
|
|
2
|
+
"id": "nodebb-plugin-mentions",
|
|
3
|
+
"name": "Username Mentions",
|
|
4
|
+
"description": "NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username",
|
|
5
|
+
"url": "https://github.com/julianlam/nodebb-plugin-mentions",
|
|
6
|
+
"library": "./library.js",
|
|
7
|
+
"upgrades": [
|
|
8
|
+
"upgrades/mentions_delete_mentions_set_zset.js"
|
|
9
|
+
],
|
|
10
|
+
"hooks": [
|
|
11
|
+
{ "hook": "static:app.load", "method": "init" },
|
|
12
|
+
{ "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
|
|
13
|
+
{ "hook": "filter:parse.post", "method": "parsePost" },
|
|
14
|
+
{ "hook": "filter:parse.raw", "method": "parseRaw" },
|
|
15
|
+
{ "hook": "action:post.save", "method": "notify" },
|
|
16
|
+
{ "hook": "action:post.edit", "method": "notify" },
|
|
17
|
+
{ "hook": "action:posts.purge", "method": "actionPostsPurge" },
|
|
18
|
+
{ "hook": "action:messaging.save", "method": "notifyMessage" },
|
|
19
|
+
{ "hook": "filter:notifications.addFilters", "method": "addFilters" },
|
|
20
|
+
{ "hook": "filter:user.notificationTypes", "method": "notificationTypes" },
|
|
21
|
+
{ "hook": "filter:users.addFields", "method": "addFields" }
|
|
22
|
+
],
|
|
23
|
+
"scripts": [
|
|
24
|
+
"static/autofill.js"
|
|
25
|
+
],
|
|
26
|
+
"modules": {
|
|
27
|
+
"../admin/plugins/mentions.js": "./static/admin.js"
|
|
28
|
+
},
|
|
29
|
+
"languages": "languages",
|
|
30
|
+
"defaultLang": "en_GB",
|
|
31
|
+
"templates": "templates"
|
|
32
32
|
}
|
package/static/.eslintrc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "nodebb/public"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "nodebb/public"
|
|
3
|
+
}
|
package/test/index.js
CHANGED
|
@@ -158,10 +158,12 @@ describe('splitter', () => {
|
|
|
158
158
|
describe('parser', () => {
|
|
159
159
|
let slug;
|
|
160
160
|
let uid;
|
|
161
|
+
let emailUid;
|
|
161
162
|
|
|
162
163
|
beforeEach(async () => {
|
|
163
164
|
slug = utils.generateUUID().slice(0, 10);
|
|
164
165
|
uid = await user.create({ username: slug });
|
|
166
|
+
emailUid = await user.create({ username: `${slug}@test.nodebb.org` });
|
|
165
167
|
});
|
|
166
168
|
|
|
167
169
|
it('should properly parse both users even if one user\'s username is a subset of the other', async () => {
|
|
@@ -185,6 +187,20 @@ describe('parser', () => {
|
|
|
185
187
|
|
|
186
188
|
assert(html);
|
|
187
189
|
|
|
190
|
+
assert.strictEqual(html, check);
|
|
191
|
+
});
|
|
192
|
+
// re-enable this when NodeBB slugify doesn't strip out `@` from usernames
|
|
193
|
+
it.skip('should match correctly email-like mentions in all test strings', async () => {
|
|
194
|
+
const index = string.indexOf('@testUser');
|
|
195
|
+
let check = string;
|
|
196
|
+
if (!index || string[index - 1] !== '>') {
|
|
197
|
+
check = string.replace(/@testUser/g, `<a class="plugin-mentions-user plugin-mentions-a" href="http://127.0.0.1:4567/uid/${emailUid}">@${slug}@test.nodebb.org</a>`);
|
|
198
|
+
string = string.replace(/testUser/g, `${slug}@test.nodebb.org`);
|
|
199
|
+
}
|
|
200
|
+
const html = await main.parseRaw(string);
|
|
201
|
+
|
|
202
|
+
assert(html);
|
|
203
|
+
|
|
188
204
|
assert.strictEqual(html, check);
|
|
189
205
|
});
|
|
190
206
|
});
|