diff --git a/lib/pleroma/constants.ex b/lib/pleroma/constants.ex index c0ee41ee2e..7fbe9de824 100644 --- a/lib/pleroma/constants.ex +++ b/lib/pleroma/constants.ex @@ -20,7 +20,8 @@ defmodule Pleroma.Constants do "deleted_activity_id", "pleroma_internal", "generator", - "assigned_account" + "assigned_account", + "rules" ] ) diff --git a/lib/pleroma/emoji-test.txt b/lib/pleroma/emoji-test.txt index d3c6d12bd5..dd54933661 100644 --- a/lib/pleroma/emoji-test.txt +++ b/lib/pleroma/emoji-test.txt @@ -1,11 +1,11 @@ # emoji-test.txt -# Date: 2020-09-12, 22:19:50 GMT -# ยฉ 2020 Unicodeยฎ, Inc. +# Date: 2021-08-26, 17:22:23 GMT +# ยฉ 2021 Unicodeยฎ, Inc. # Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. # For terms of use, see http://www.unicode.org/terms_of_use.html # # Emoji Keyboard/Display Test Data for UTS #51 -# Version: 13.1 +# Version: 14.0 # # For documentation and usage, see http://www.unicode.org/reports/tr51 # @@ -43,6 +43,7 @@ 1F602 ; fully-qualified # ๐Ÿ˜‚ E0.6 face with tears of joy 1F642 ; fully-qualified # ๐Ÿ™‚ E1.0 slightly smiling face 1F643 ; fully-qualified # ๐Ÿ™ƒ E1.0 upside-down face +1FAE0 ; fully-qualified # ๐Ÿซ  E14.0 melting face 1F609 ; fully-qualified # ๐Ÿ˜‰ E0.6 winking face 1F60A ; fully-qualified # ๐Ÿ˜Š E0.6 smiling face with smiling eyes 1F607 ; fully-qualified # ๐Ÿ˜‡ E1.0 smiling face with halo @@ -68,10 +69,13 @@ 1F911 ; fully-qualified # ๐Ÿค‘ E1.0 money-mouth face # subgroup: face-hand -1F917 ; fully-qualified # ๐Ÿค— E1.0 hugging face +1F917 ; fully-qualified # ๐Ÿค— E1.0 smiling face with open hands 1F92D ; fully-qualified # ๐Ÿคญ E5.0 face with hand over mouth +1FAE2 ; fully-qualified # ๐Ÿซข E14.0 face with open eyes and hand over mouth +1FAE3 ; fully-qualified # ๐Ÿซฃ E14.0 face with peeking eye 1F92B ; fully-qualified # ๐Ÿคซ E5.0 shushing face 1F914 ; fully-qualified # ๐Ÿค” E1.0 thinking face +1FAE1 ; fully-qualified # ๐Ÿซก E14.0 saluting face # subgroup: face-neutral-skeptical 1F910 ; fully-qualified # ๐Ÿค E1.0 zipper-mouth face @@ -79,6 +83,7 @@ 1F610 ; fully-qualified # ๐Ÿ˜ E0.7 neutral face 1F611 ; fully-qualified # ๐Ÿ˜‘ E1.0 expressionless face 1F636 ; fully-qualified # ๐Ÿ˜ถ E1.0 face without mouth +1FAE5 ; fully-qualified # ๐Ÿซฅ E14.0 dotted line face 1F636 200D 1F32B FE0F ; fully-qualified # ๐Ÿ˜ถโ€๐ŸŒซ๏ธ E13.1 face in clouds 1F636 200D 1F32B ; minimally-qualified # ๐Ÿ˜ถโ€๐ŸŒซ E13.1 face in clouds 1F60F ; fully-qualified # ๐Ÿ˜ E0.6 smirking face @@ -105,7 +110,7 @@ 1F975 ; fully-qualified # ๐Ÿฅต E11.0 hot face 1F976 ; fully-qualified # ๐Ÿฅถ E11.0 cold face 1F974 ; fully-qualified # ๐Ÿฅด E11.0 woozy face -1F635 ; fully-qualified # ๐Ÿ˜ต E0.6 knocked-out face +1F635 ; fully-qualified # ๐Ÿ˜ต E0.6 face with crossed-out eyes 1F635 200D 1F4AB ; fully-qualified # ๐Ÿ˜ตโ€๐Ÿ’ซ E13.1 face with spiral eyes 1F92F ; fully-qualified # ๐Ÿคฏ E5.0 exploding head @@ -121,6 +126,7 @@ # subgroup: face-concerned 1F615 ; fully-qualified # ๐Ÿ˜• E1.0 confused face +1FAE4 ; fully-qualified # ๐Ÿซค E14.0 face with diagonal mouth 1F61F ; fully-qualified # ๐Ÿ˜Ÿ E1.0 worried face 1F641 ; fully-qualified # ๐Ÿ™ E1.0 slightly frowning face 2639 FE0F ; fully-qualified # โ˜น๏ธ E0.7 frowning face @@ -130,6 +136,7 @@ 1F632 ; fully-qualified # ๐Ÿ˜ฒ E0.6 astonished face 1F633 ; fully-qualified # ๐Ÿ˜ณ E0.6 flushed face 1F97A ; fully-qualified # ๐Ÿฅบ E11.0 pleading face +1F979 ; fully-qualified # ๐Ÿฅน E14.0 face holding back tears 1F626 ; fully-qualified # ๐Ÿ˜ฆ E1.0 frowning face with open mouth 1F627 ; fully-qualified # ๐Ÿ˜ง E1.0 anguished face 1F628 ; fully-qualified # ๐Ÿ˜จ E0.6 fearful face @@ -232,8 +239,8 @@ 1F4AD ; fully-qualified # ๐Ÿ’ญ E1.0 thought balloon 1F4A4 ; fully-qualified # ๐Ÿ’ค E0.6 zzz -# Smileys & Emotion subtotal: 170 -# Smileys & Emotion subtotal: 170 w/o modifiers +# Smileys & Emotion subtotal: 177 +# Smileys & Emotion subtotal: 177 w/o modifiers # group: People & Body @@ -269,6 +276,30 @@ 1F596 1F3FD ; fully-qualified # ๐Ÿ––๐Ÿฝ E1.0 vulcan salute: medium skin tone 1F596 1F3FE ; fully-qualified # ๐Ÿ––๐Ÿพ E1.0 vulcan salute: medium-dark skin tone 1F596 1F3FF ; fully-qualified # ๐Ÿ––๐Ÿฟ E1.0 vulcan salute: dark skin tone +1FAF1 ; fully-qualified # ๐Ÿซฑ E14.0 rightwards hand +1FAF1 1F3FB ; fully-qualified # ๐Ÿซฑ๐Ÿป E14.0 rightwards hand: light skin tone +1FAF1 1F3FC ; fully-qualified # ๐Ÿซฑ๐Ÿผ E14.0 rightwards hand: medium-light skin tone +1FAF1 1F3FD ; fully-qualified # ๐Ÿซฑ๐Ÿฝ E14.0 rightwards hand: medium skin tone +1FAF1 1F3FE ; fully-qualified # ๐Ÿซฑ๐Ÿพ E14.0 rightwards hand: medium-dark skin tone +1FAF1 1F3FF ; fully-qualified # ๐Ÿซฑ๐Ÿฟ E14.0 rightwards hand: dark skin tone +1FAF2 ; fully-qualified # ๐Ÿซฒ E14.0 leftwards hand +1FAF2 1F3FB ; fully-qualified # ๐Ÿซฒ๐Ÿป E14.0 leftwards hand: light skin tone +1FAF2 1F3FC ; fully-qualified # ๐Ÿซฒ๐Ÿผ E14.0 leftwards hand: medium-light skin tone +1FAF2 1F3FD ; fully-qualified # ๐Ÿซฒ๐Ÿฝ E14.0 leftwards hand: medium skin tone +1FAF2 1F3FE ; fully-qualified # ๐Ÿซฒ๐Ÿพ E14.0 leftwards hand: medium-dark skin tone +1FAF2 1F3FF ; fully-qualified # ๐Ÿซฒ๐Ÿฟ E14.0 leftwards hand: dark skin tone +1FAF3 ; fully-qualified # ๐Ÿซณ E14.0 palm down hand +1FAF3 1F3FB ; fully-qualified # ๐Ÿซณ๐Ÿป E14.0 palm down hand: light skin tone +1FAF3 1F3FC ; fully-qualified # ๐Ÿซณ๐Ÿผ E14.0 palm down hand: medium-light skin tone +1FAF3 1F3FD ; fully-qualified # ๐Ÿซณ๐Ÿฝ E14.0 palm down hand: medium skin tone +1FAF3 1F3FE ; fully-qualified # ๐Ÿซณ๐Ÿพ E14.0 palm down hand: medium-dark skin tone +1FAF3 1F3FF ; fully-qualified # ๐Ÿซณ๐Ÿฟ E14.0 palm down hand: dark skin tone +1FAF4 ; fully-qualified # ๐Ÿซด E14.0 palm up hand +1FAF4 1F3FB ; fully-qualified # ๐Ÿซด๐Ÿป E14.0 palm up hand: light skin tone +1FAF4 1F3FC ; fully-qualified # ๐Ÿซด๐Ÿผ E14.0 palm up hand: medium-light skin tone +1FAF4 1F3FD ; fully-qualified # ๐Ÿซด๐Ÿฝ E14.0 palm up hand: medium skin tone +1FAF4 1F3FE ; fully-qualified # ๐Ÿซด๐Ÿพ E14.0 palm up hand: medium-dark skin tone +1FAF4 1F3FF ; fully-qualified # ๐Ÿซด๐Ÿฟ E14.0 palm up hand: dark skin tone # subgroup: hand-fingers-partial 1F44C ; fully-qualified # ๐Ÿ‘Œ E0.6 OK hand @@ -302,6 +333,12 @@ 1F91E 1F3FD ; fully-qualified # ๐Ÿคž๐Ÿฝ E3.0 crossed fingers: medium skin tone 1F91E 1F3FE ; fully-qualified # ๐Ÿคž๐Ÿพ E3.0 crossed fingers: medium-dark skin tone 1F91E 1F3FF ; fully-qualified # ๐Ÿคž๐Ÿฟ E3.0 crossed fingers: dark skin tone +1FAF0 ; fully-qualified # ๐Ÿซฐ E14.0 hand with index finger and thumb crossed +1FAF0 1F3FB ; fully-qualified # ๐Ÿซฐ๐Ÿป E14.0 hand with index finger and thumb crossed: light skin tone +1FAF0 1F3FC ; fully-qualified # ๐Ÿซฐ๐Ÿผ E14.0 hand with index finger and thumb crossed: medium-light skin tone +1FAF0 1F3FD ; fully-qualified # ๐Ÿซฐ๐Ÿฝ E14.0 hand with index finger and thumb crossed: medium skin tone +1FAF0 1F3FE ; fully-qualified # ๐Ÿซฐ๐Ÿพ E14.0 hand with index finger and thumb crossed: medium-dark skin tone +1FAF0 1F3FF ; fully-qualified # ๐Ÿซฐ๐Ÿฟ E14.0 hand with index finger and thumb crossed: dark skin tone 1F91F ; fully-qualified # ๐ŸคŸ E5.0 love-you gesture 1F91F 1F3FB ; fully-qualified # ๐ŸคŸ๐Ÿป E5.0 love-you gesture: light skin tone 1F91F 1F3FC ; fully-qualified # ๐ŸคŸ๐Ÿผ E5.0 love-you gesture: medium-light skin tone @@ -359,6 +396,12 @@ 261D 1F3FD ; fully-qualified # โ˜๐Ÿฝ E1.0 index pointing up: medium skin tone 261D 1F3FE ; fully-qualified # โ˜๐Ÿพ E1.0 index pointing up: medium-dark skin tone 261D 1F3FF ; fully-qualified # โ˜๐Ÿฟ E1.0 index pointing up: dark skin tone +1FAF5 ; fully-qualified # ๐Ÿซต E14.0 index pointing at the viewer +1FAF5 1F3FB ; fully-qualified # ๐Ÿซต๐Ÿป E14.0 index pointing at the viewer: light skin tone +1FAF5 1F3FC ; fully-qualified # ๐Ÿซต๐Ÿผ E14.0 index pointing at the viewer: medium-light skin tone +1FAF5 1F3FD ; fully-qualified # ๐Ÿซต๐Ÿฝ E14.0 index pointing at the viewer: medium skin tone +1FAF5 1F3FE ; fully-qualified # ๐Ÿซต๐Ÿพ E14.0 index pointing at the viewer: medium-dark skin tone +1FAF5 1F3FF ; fully-qualified # ๐Ÿซต๐Ÿฟ E14.0 index pointing at the viewer: dark skin tone # subgroup: hand-fingers-closed 1F44D ; fully-qualified # ๐Ÿ‘ E0.6 thumbs up @@ -411,6 +454,12 @@ 1F64C 1F3FD ; fully-qualified # ๐Ÿ™Œ๐Ÿฝ E1.0 raising hands: medium skin tone 1F64C 1F3FE ; fully-qualified # ๐Ÿ™Œ๐Ÿพ E1.0 raising hands: medium-dark skin tone 1F64C 1F3FF ; fully-qualified # ๐Ÿ™Œ๐Ÿฟ E1.0 raising hands: dark skin tone +1FAF6 ; fully-qualified # ๐Ÿซถ E14.0 heart hands +1FAF6 1F3FB ; fully-qualified # ๐Ÿซถ๐Ÿป E14.0 heart hands: light skin tone +1FAF6 1F3FC ; fully-qualified # ๐Ÿซถ๐Ÿผ E14.0 heart hands: medium-light skin tone +1FAF6 1F3FD ; fully-qualified # ๐Ÿซถ๐Ÿฝ E14.0 heart hands: medium skin tone +1FAF6 1F3FE ; fully-qualified # ๐Ÿซถ๐Ÿพ E14.0 heart hands: medium-dark skin tone +1FAF6 1F3FF ; fully-qualified # ๐Ÿซถ๐Ÿฟ E14.0 heart hands: dark skin tone 1F450 ; fully-qualified # ๐Ÿ‘ E0.6 open hands 1F450 1F3FB ; fully-qualified # ๐Ÿ‘๐Ÿป E1.0 open hands: light skin tone 1F450 1F3FC ; fully-qualified # ๐Ÿ‘๐Ÿผ E1.0 open hands: medium-light skin tone @@ -424,6 +473,31 @@ 1F932 1F3FE ; fully-qualified # ๐Ÿคฒ๐Ÿพ E5.0 palms up together: medium-dark skin tone 1F932 1F3FF ; fully-qualified # ๐Ÿคฒ๐Ÿฟ E5.0 palms up together: dark skin tone 1F91D ; fully-qualified # ๐Ÿค E3.0 handshake +1F91D 1F3FB ; fully-qualified # ๐Ÿค๐Ÿป E3.0 handshake: light skin tone +1F91D 1F3FC ; fully-qualified # ๐Ÿค๐Ÿผ E3.0 handshake: medium-light skin tone +1F91D 1F3FD ; fully-qualified # ๐Ÿค๐Ÿฝ E3.0 handshake: medium skin tone +1F91D 1F3FE ; fully-qualified # ๐Ÿค๐Ÿพ E3.0 handshake: medium-dark skin tone +1F91D 1F3FF ; fully-qualified # ๐Ÿค๐Ÿฟ E3.0 handshake: dark skin tone +1FAF1 1F3FB 200D 1FAF2 1F3FC ; fully-qualified # ๐Ÿซฑ๐Ÿปโ€๐Ÿซฒ๐Ÿผ E14.0 handshake: light skin tone, medium-light skin tone +1FAF1 1F3FB 200D 1FAF2 1F3FD ; fully-qualified # ๐Ÿซฑ๐Ÿปโ€๐Ÿซฒ๐Ÿฝ E14.0 handshake: light skin tone, medium skin tone +1FAF1 1F3FB 200D 1FAF2 1F3FE ; fully-qualified # ๐Ÿซฑ๐Ÿปโ€๐Ÿซฒ๐Ÿพ E14.0 handshake: light skin tone, medium-dark skin tone +1FAF1 1F3FB 200D 1FAF2 1F3FF ; fully-qualified # ๐Ÿซฑ๐Ÿปโ€๐Ÿซฒ๐Ÿฟ E14.0 handshake: light skin tone, dark skin tone +1FAF1 1F3FC 200D 1FAF2 1F3FB ; fully-qualified # ๐Ÿซฑ๐Ÿผโ€๐Ÿซฒ๐Ÿป E14.0 handshake: medium-light skin tone, light skin tone +1FAF1 1F3FC 200D 1FAF2 1F3FD ; fully-qualified # ๐Ÿซฑ๐Ÿผโ€๐Ÿซฒ๐Ÿฝ E14.0 handshake: medium-light skin tone, medium skin tone +1FAF1 1F3FC 200D 1FAF2 1F3FE ; fully-qualified # ๐Ÿซฑ๐Ÿผโ€๐Ÿซฒ๐Ÿพ E14.0 handshake: medium-light skin tone, medium-dark skin tone +1FAF1 1F3FC 200D 1FAF2 1F3FF ; fully-qualified # ๐Ÿซฑ๐Ÿผโ€๐Ÿซฒ๐Ÿฟ E14.0 handshake: medium-light skin tone, dark skin tone +1FAF1 1F3FD 200D 1FAF2 1F3FB ; fully-qualified # ๐Ÿซฑ๐Ÿฝโ€๐Ÿซฒ๐Ÿป E14.0 handshake: medium skin tone, light skin tone +1FAF1 1F3FD 200D 1FAF2 1F3FC ; fully-qualified # ๐Ÿซฑ๐Ÿฝโ€๐Ÿซฒ๐Ÿผ E14.0 handshake: medium skin tone, medium-light skin tone +1FAF1 1F3FD 200D 1FAF2 1F3FE ; fully-qualified # ๐Ÿซฑ๐Ÿฝโ€๐Ÿซฒ๐Ÿพ E14.0 handshake: medium skin tone, medium-dark skin tone +1FAF1 1F3FD 200D 1FAF2 1F3FF ; fully-qualified # ๐Ÿซฑ๐Ÿฝโ€๐Ÿซฒ๐Ÿฟ E14.0 handshake: medium skin tone, dark skin tone +1FAF1 1F3FE 200D 1FAF2 1F3FB ; fully-qualified # ๐Ÿซฑ๐Ÿพโ€๐Ÿซฒ๐Ÿป E14.0 handshake: medium-dark skin tone, light skin tone +1FAF1 1F3FE 200D 1FAF2 1F3FC ; fully-qualified # ๐Ÿซฑ๐Ÿพโ€๐Ÿซฒ๐Ÿผ E14.0 handshake: medium-dark skin tone, medium-light skin tone +1FAF1 1F3FE 200D 1FAF2 1F3FD ; fully-qualified # ๐Ÿซฑ๐Ÿพโ€๐Ÿซฒ๐Ÿฝ E14.0 handshake: medium-dark skin tone, medium skin tone +1FAF1 1F3FE 200D 1FAF2 1F3FF ; fully-qualified # ๐Ÿซฑ๐Ÿพโ€๐Ÿซฒ๐Ÿฟ E14.0 handshake: medium-dark skin tone, dark skin tone +1FAF1 1F3FF 200D 1FAF2 1F3FB ; fully-qualified # ๐Ÿซฑ๐Ÿฟโ€๐Ÿซฒ๐Ÿป E14.0 handshake: dark skin tone, light skin tone +1FAF1 1F3FF 200D 1FAF2 1F3FC ; fully-qualified # ๐Ÿซฑ๐Ÿฟโ€๐Ÿซฒ๐Ÿผ E14.0 handshake: dark skin tone, medium-light skin tone +1FAF1 1F3FF 200D 1FAF2 1F3FD ; fully-qualified # ๐Ÿซฑ๐Ÿฟโ€๐Ÿซฒ๐Ÿฝ E14.0 handshake: dark skin tone, medium skin tone +1FAF1 1F3FF 200D 1FAF2 1F3FE ; fully-qualified # ๐Ÿซฑ๐Ÿฟโ€๐Ÿซฒ๐Ÿพ E14.0 handshake: dark skin tone, medium-dark skin tone 1F64F ; fully-qualified # ๐Ÿ™ E0.6 folded hands 1F64F 1F3FB ; fully-qualified # ๐Ÿ™๐Ÿป E1.0 folded hands: light skin tone 1F64F 1F3FC ; fully-qualified # ๐Ÿ™๐Ÿผ E1.0 folded hands: medium-light skin tone @@ -501,6 +575,7 @@ 1F441 ; unqualified # ๐Ÿ‘ E0.7 eye 1F445 ; fully-qualified # ๐Ÿ‘… E0.6 tongue 1F444 ; fully-qualified # ๐Ÿ‘„ E0.6 mouth +1FAE6 ; fully-qualified # ๐Ÿซฆ E14.0 biting lip # subgroup: person 1F476 ; fully-qualified # ๐Ÿ‘ถ E0.6 baby @@ -1472,6 +1547,12 @@ 1F477 1F3FE 200D 2640 ; minimally-qualified # ๐Ÿ‘ท๐Ÿพโ€โ™€ E4.0 woman construction worker: medium-dark skin tone 1F477 1F3FF 200D 2640 FE0F ; fully-qualified # ๐Ÿ‘ท๐Ÿฟโ€โ™€๏ธ E4.0 woman construction worker: dark skin tone 1F477 1F3FF 200D 2640 ; minimally-qualified # ๐Ÿ‘ท๐Ÿฟโ€โ™€ E4.0 woman construction worker: dark skin tone +1FAC5 ; fully-qualified # ๐Ÿซ… E14.0 person with crown +1FAC5 1F3FB ; fully-qualified # ๐Ÿซ…๐Ÿป E14.0 person with crown: light skin tone +1FAC5 1F3FC ; fully-qualified # ๐Ÿซ…๐Ÿผ E14.0 person with crown: medium-light skin tone +1FAC5 1F3FD ; fully-qualified # ๐Ÿซ…๐Ÿฝ E14.0 person with crown: medium skin tone +1FAC5 1F3FE ; fully-qualified # ๐Ÿซ…๐Ÿพ E14.0 person with crown: medium-dark skin tone +1FAC5 1F3FF ; fully-qualified # ๐Ÿซ…๐Ÿฟ E14.0 person with crown: dark skin tone 1F934 ; fully-qualified # ๐Ÿคด E3.0 prince 1F934 1F3FB ; fully-qualified # ๐Ÿคด๐Ÿป E3.0 prince: light skin tone 1F934 1F3FC ; fully-qualified # ๐Ÿคด๐Ÿผ E3.0 prince: medium-light skin tone @@ -1592,6 +1673,18 @@ 1F930 1F3FD ; fully-qualified # ๐Ÿคฐ๐Ÿฝ E3.0 pregnant woman: medium skin tone 1F930 1F3FE ; fully-qualified # ๐Ÿคฐ๐Ÿพ E3.0 pregnant woman: medium-dark skin tone 1F930 1F3FF ; fully-qualified # ๐Ÿคฐ๐Ÿฟ E3.0 pregnant woman: dark skin tone +1FAC3 ; fully-qualified # ๐Ÿซƒ E14.0 pregnant man +1FAC3 1F3FB ; fully-qualified # ๐Ÿซƒ๐Ÿป E14.0 pregnant man: light skin tone +1FAC3 1F3FC ; fully-qualified # ๐Ÿซƒ๐Ÿผ E14.0 pregnant man: medium-light skin tone +1FAC3 1F3FD ; fully-qualified # ๐Ÿซƒ๐Ÿฝ E14.0 pregnant man: medium skin tone +1FAC3 1F3FE ; fully-qualified # ๐Ÿซƒ๐Ÿพ E14.0 pregnant man: medium-dark skin tone +1FAC3 1F3FF ; fully-qualified # ๐Ÿซƒ๐Ÿฟ E14.0 pregnant man: dark skin tone +1FAC4 ; fully-qualified # ๐Ÿซ„ E14.0 pregnant person +1FAC4 1F3FB ; fully-qualified # ๐Ÿซ„๐Ÿป E14.0 pregnant person: light skin tone +1FAC4 1F3FC ; fully-qualified # ๐Ÿซ„๐Ÿผ E14.0 pregnant person: medium-light skin tone +1FAC4 1F3FD ; fully-qualified # ๐Ÿซ„๐Ÿฝ E14.0 pregnant person: medium skin tone +1FAC4 1F3FE ; fully-qualified # ๐Ÿซ„๐Ÿพ E14.0 pregnant person: medium-dark skin tone +1FAC4 1F3FF ; fully-qualified # ๐Ÿซ„๐Ÿฟ E14.0 pregnant person: dark skin tone 1F931 ; fully-qualified # ๐Ÿคฑ E5.0 breast-feeding 1F931 1F3FB ; fully-qualified # ๐Ÿคฑ๐Ÿป E5.0 breast-feeding: light skin tone 1F931 1F3FC ; fully-qualified # ๐Ÿคฑ๐Ÿผ E5.0 breast-feeding: medium-light skin tone @@ -1862,6 +1955,7 @@ 1F9DF 200D 2642 ; minimally-qualified # ๐ŸงŸโ€โ™‚ E5.0 man zombie 1F9DF 200D 2640 FE0F ; fully-qualified # ๐ŸงŸโ€โ™€๏ธ E5.0 woman zombie 1F9DF 200D 2640 ; minimally-qualified # ๐ŸงŸโ€โ™€ E5.0 woman zombie +1F9CC ; fully-qualified # ๐ŸงŒ E14.0 troll # subgroup: person-activity 1F486 ; fully-qualified # ๐Ÿ’† E0.6 person getting massage @@ -3168,8 +3262,8 @@ 1FAC2 ; fully-qualified # ๐Ÿซ‚ E13.0 people hugging 1F463 ; fully-qualified # ๐Ÿ‘ฃ E0.6 footprints -# People & Body subtotal: 2899 -# People & Body subtotal: 494 w/o modifiers +# People & Body subtotal: 2986 +# People & Body subtotal: 506 w/o modifiers # group: Component @@ -3304,6 +3398,7 @@ 1F988 ; fully-qualified # ๐Ÿฆˆ E3.0 shark 1F419 ; fully-qualified # ๐Ÿ™ E0.6 octopus 1F41A ; fully-qualified # ๐Ÿš E0.6 spiral shell +1FAB8 ; fully-qualified # ๐Ÿชธ E14.0 coral # subgroup: animal-bug 1F40C ; fully-qualified # ๐ŸŒ E0.6 snail @@ -3329,6 +3424,7 @@ 1F490 ; fully-qualified # ๐Ÿ’ E0.6 bouquet 1F338 ; fully-qualified # ๐ŸŒธ E0.6 cherry blossom 1F4AE ; fully-qualified # ๐Ÿ’ฎ E0.6 white flower +1FAB7 ; fully-qualified # ๐Ÿชท E14.0 lotus 1F3F5 FE0F ; fully-qualified # ๐Ÿต๏ธ E0.7 rosette 1F3F5 ; unqualified # ๐Ÿต E0.7 rosette 1F339 ; fully-qualified # ๐ŸŒน E0.6 rose @@ -3353,9 +3449,11 @@ 1F341 ; fully-qualified # ๐Ÿ E0.6 maple leaf 1F342 ; fully-qualified # ๐Ÿ‚ E0.6 fallen leaf 1F343 ; fully-qualified # ๐Ÿƒ E0.6 leaf fluttering in wind +1FAB9 ; fully-qualified # ๐Ÿชน E14.0 empty nest +1FABA ; fully-qualified # ๐Ÿชบ E14.0 nest with eggs -# Animals & Nature subtotal: 147 -# Animals & Nature subtotal: 147 w/o modifiers +# Animals & Nature subtotal: 151 +# Animals & Nature subtotal: 151 w/o modifiers # group: Food & Drink @@ -3396,6 +3494,7 @@ 1F9C5 ; fully-qualified # ๐Ÿง… E12.0 onion 1F344 ; fully-qualified # ๐Ÿ„ E0.6 mushroom 1F95C ; fully-qualified # ๐Ÿฅœ E3.0 peanuts +1FAD8 ; fully-qualified # ๐Ÿซ˜ E14.0 beans 1F330 ; fully-qualified # ๐ŸŒฐ E0.6 chestnut # subgroup: food-prepared @@ -3491,6 +3590,7 @@ 1F37B ; fully-qualified # ๐Ÿป E0.6 clinking beer mugs 1F942 ; fully-qualified # ๐Ÿฅ‚ E3.0 clinking glasses 1F943 ; fully-qualified # ๐Ÿฅƒ E3.0 tumbler glass +1FAD7 ; fully-qualified # ๐Ÿซ— E14.0 pouring liquid 1F964 ; fully-qualified # ๐Ÿฅค E5.0 cup with straw 1F9CB ; fully-qualified # ๐Ÿง‹ E13.0 bubble tea 1F9C3 ; fully-qualified # ๐Ÿงƒ E12.0 beverage box @@ -3504,10 +3604,11 @@ 1F374 ; fully-qualified # ๐Ÿด E0.6 fork and knife 1F944 ; fully-qualified # ๐Ÿฅ„ E3.0 spoon 1F52A ; fully-qualified # ๐Ÿ”ช E0.6 kitchen knife +1FAD9 ; fully-qualified # ๐Ÿซ™ E14.0 jar 1F3FA ; fully-qualified # ๐Ÿบ E1.0 amphora -# Food & Drink subtotal: 131 -# Food & Drink subtotal: 131 w/o modifiers +# Food & Drink subtotal: 134 +# Food & Drink subtotal: 134 w/o modifiers # group: Travel & Places @@ -3597,6 +3698,7 @@ 2668 FE0F ; fully-qualified # โ™จ๏ธ E0.6 hot springs 2668 ; unqualified # โ™จ E0.6 hot springs 1F3A0 ; fully-qualified # ๐ŸŽ  E0.6 carousel horse +1F6DD ; fully-qualified # ๐Ÿ› E14.0 playground slide 1F3A1 ; fully-qualified # ๐ŸŽก E0.6 ferris wheel 1F3A2 ; fully-qualified # ๐ŸŽข E0.6 roller coaster 1F488 ; fully-qualified # ๐Ÿ’ˆ E0.6 barber pole @@ -3652,6 +3754,7 @@ 1F6E2 FE0F ; fully-qualified # ๐Ÿ›ข๏ธ E0.7 oil drum 1F6E2 ; unqualified # ๐Ÿ›ข E0.7 oil drum 26FD ; fully-qualified # โ›ฝ E0.6 fuel pump +1F6DE ; fully-qualified # ๐Ÿ›ž E14.0 wheel 1F6A8 ; fully-qualified # ๐Ÿšจ E0.6 police car light 1F6A5 ; fully-qualified # ๐Ÿšฅ E0.6 horizontal traffic light 1F6A6 ; fully-qualified # ๐Ÿšฆ E1.0 vertical traffic light @@ -3660,6 +3763,7 @@ # subgroup: transport-water 2693 ; fully-qualified # โš“ E0.6 anchor +1F6DF ; fully-qualified # ๐Ÿ›Ÿ E14.0 ring buoy 26F5 ; fully-qualified # โ›ต E0.6 sailboat 1F6F6 ; fully-qualified # ๐Ÿ›ถ E3.0 canoe 1F6A4 ; fully-qualified # ๐Ÿšค E0.6 speedboat @@ -3797,8 +3901,8 @@ 1F4A7 ; fully-qualified # ๐Ÿ’ง E0.6 droplet 1F30A ; fully-qualified # ๐ŸŒŠ E0.6 water wave -# Travel & Places subtotal: 264 -# Travel & Places subtotal: 264 w/o modifiers +# Travel & Places subtotal: 267 +# Travel & Places subtotal: 267 w/o modifiers # group: Activities @@ -3874,6 +3978,7 @@ 1F52E ; fully-qualified # ๐Ÿ”ฎ E0.6 crystal ball 1FA84 ; fully-qualified # ๐Ÿช„ E13.0 magic wand 1F9FF ; fully-qualified # ๐Ÿงฟ E11.0 nazar amulet +1FAAC ; fully-qualified # ๐Ÿชฌ E14.0 hamsa 1F3AE ; fully-qualified # ๐ŸŽฎ E0.6 video game 1F579 FE0F ; fully-qualified # ๐Ÿ•น๏ธ E0.7 joystick 1F579 ; unqualified # ๐Ÿ•น E0.7 joystick @@ -3882,6 +3987,7 @@ 1F9E9 ; fully-qualified # ๐Ÿงฉ E11.0 puzzle piece 1F9F8 ; fully-qualified # ๐Ÿงธ E11.0 teddy bear 1FA85 ; fully-qualified # ๐Ÿช… E13.0 piรฑata +1FAA9 ; fully-qualified # ๐Ÿชฉ E14.0 mirror ball 1FA86 ; fully-qualified # ๐Ÿช† E13.0 nesting dolls 2660 FE0F ; fully-qualified # โ™ ๏ธ E0.6 spade suit 2660 ; unqualified # โ™  E0.6 spade suit @@ -3907,8 +4013,8 @@ 1F9F6 ; fully-qualified # ๐Ÿงถ E11.0 yarn 1FAA2 ; fully-qualified # ๐Ÿชข E13.0 knot -# Activities subtotal: 95 -# Activities subtotal: 95 w/o modifiers +# Activities subtotal: 97 +# Activities subtotal: 97 w/o modifiers # group: Objects @@ -4009,6 +4115,7 @@ # subgroup: computer 1F50B ; fully-qualified # ๐Ÿ”‹ E0.6 battery +1FAAB ; fully-qualified # ๐Ÿชซ E14.0 low battery 1F50C ; fully-qualified # ๐Ÿ”Œ E0.6 electric plug 1F4BB ; fully-qualified # ๐Ÿ’ป E0.6 laptop 1F5A5 FE0F ; fully-qualified # ๐Ÿ–ฅ๏ธ E0.7 desktop computer @@ -4207,7 +4314,9 @@ 1FA78 ; fully-qualified # ๐Ÿฉธ E12.0 drop of blood 1F48A ; fully-qualified # ๐Ÿ’Š E0.6 pill 1FA79 ; fully-qualified # ๐Ÿฉน E12.0 adhesive bandage +1FA7C ; fully-qualified # ๐Ÿฉผ E14.0 crutch 1FA7A ; fully-qualified # ๐Ÿฉบ E12.0 stethoscope +1FA7B ; fully-qualified # ๐Ÿฉป E14.0 x-ray # subgroup: household 1F6AA ; fully-qualified # ๐Ÿšช E0.6 door @@ -4232,6 +4341,7 @@ 1F9FB ; fully-qualified # ๐Ÿงป E11.0 roll of paper 1FAA3 ; fully-qualified # ๐Ÿชฃ E13.0 bucket 1F9FC ; fully-qualified # ๐Ÿงผ E11.0 soap +1FAE7 ; fully-qualified # ๐Ÿซง E14.0 bubbles 1FAA5 ; fully-qualified # ๐Ÿชฅ E13.0 toothbrush 1F9FD ; fully-qualified # ๐Ÿงฝ E11.0 sponge 1F9EF ; fully-qualified # ๐Ÿงฏ E11.0 fire extinguisher @@ -4246,9 +4356,10 @@ 26B1 ; unqualified # โšฑ E1.0 funeral urn 1F5FF ; fully-qualified # ๐Ÿ—ฟ E0.6 moai 1FAA7 ; fully-qualified # ๐Ÿชง E13.0 placard +1FAAA ; fully-qualified # ๐Ÿชช E14.0 identification card -# Objects subtotal: 299 -# Objects subtotal: 299 w/o modifiers +# Objects subtotal: 304 +# Objects subtotal: 304 w/o modifiers # group: Symbols @@ -4409,6 +4520,7 @@ 2795 ; fully-qualified # โž• E0.6 plus 2796 ; fully-qualified # โž– E0.6 minus 2797 ; fully-qualified # โž— E0.6 divide +1F7F0 ; fully-qualified # ๐ŸŸฐ E14.0 heavy equals sign 267E FE0F ; fully-qualified # โ™พ๏ธ E11.0 infinity 267E ; unqualified # โ™พ E11.0 infinity @@ -4581,8 +4693,8 @@ 1F533 ; fully-qualified # ๐Ÿ”ณ E0.6 white square button 1F532 ; fully-qualified # ๐Ÿ”ฒ E0.6 black square button -# Symbols subtotal: 301 -# Symbols subtotal: 301 w/o modifiers +# Symbols subtotal: 302 +# Symbols subtotal: 302 w/o modifiers # group: Flags @@ -4871,7 +4983,7 @@ # Flags subtotal: 275 w/o modifiers # Status Counts -# fully-qualified : 3512 +# fully-qualified : 3624 # minimally-qualified : 817 # unqualified : 252 # component : 9 diff --git a/lib/pleroma/rule.ex b/lib/pleroma/rule.ex index d772a32bd4..486cff8cc9 100644 --- a/lib/pleroma/rule.ex +++ b/lib/pleroma/rule.ex @@ -29,6 +29,11 @@ def query do |> order_by(asc: :priority) end + def get(ids) when is_list(ids) do + from(r in __MODULE__, where: r.id in ^ids) + |> Repo.all() + end + def get(id), do: Repo.get(__MODULE__, id) def create(params) do diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 39d37fbcb8..c78ed1a5f8 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -226,7 +226,11 @@ def handle(%{data: %{"type" => "Create"}} = activity, meta) do meta |> add_notifications(notifications) - ap_streamer().stream_out(activity) + # ChatMessages are special, as they get streamed in handle_object_creation/3 + # TODO: maybe whitelist allowed object types to stream? + if object.data["type"] != "ChatMessage" do + ap_streamer().stream_out(activity) + end {:ok, activity, meta} else diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index 09343c3348..6d4385d752 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -692,14 +692,18 @@ def make_listen_data(params, additional) do #### Flag-related helpers @spec make_flag_data(map(), map()) :: map() - def make_flag_data(%{actor: actor, context: context, content: content} = params, additional) do + def make_flag_data( + %{actor: actor, context: context, content: content} = params, + additional + ) do %{ "type" => "Flag", "actor" => actor.ap_id, "content" => content, "object" => build_flag_object(params), "context" => context, - "state" => "open" + "state" => "open", + "rules" => Map.get(params, :rules, nil) } |> Map.merge(additional) end diff --git a/lib/pleroma/web/admin_api/views/report_view.ex b/lib/pleroma/web/admin_api/views/report_view.ex index 90482f9ea0..87cd6f389e 100644 --- a/lib/pleroma/web/admin_api/views/report_view.ex +++ b/lib/pleroma/web/admin_api/views/report_view.ex @@ -6,10 +6,12 @@ defmodule Pleroma.Web.AdminAPI.ReportView do use Pleroma.Web, :view alias Pleroma.HTML + alias Pleroma.Rule alias Pleroma.User alias Pleroma.Web.AdminAPI alias Pleroma.Web.AdminAPI.Report alias Pleroma.Web.CommonAPI.Utils + alias Pleroma.Web.MastodonAPI.InstanceView alias Pleroma.Web.MastodonAPI.StatusView defdelegate merge_account_views(user), to: AdminAPI.AccountView @@ -58,7 +60,8 @@ def render("show.json", %{ }), state: report.data["state"], notes: render(__MODULE__, "index_notes.json", %{notes: report.report_notes}), - assigned_account: assigned_account + assigned_account: assigned_account, + rules: rules(Map.get(report.data, "rules", nil)) } end @@ -83,4 +86,14 @@ def render("show_note.json", %{ created_at: Utils.to_masto_date(inserted_at) } end + + defp rules(nil) do + [] + end + + defp rules(rule_ids) do + rule_ids + |> Rule.get() + |> render_many(InstanceView, "rule.json", as: :rule) + end end diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index ae1014b93b..0d6ecb9ff0 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -194,7 +194,17 @@ defp report do }, assigned_account: account_admin() - |> Map.put(:nullable, true) + |> Map.put(:nullable, true), + rules: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + id: %Schema{type: :integer}, + text: %Schema{type: :string} + } + } + } } } end diff --git a/lib/pleroma/web/api_spec/operations/report_operation.ex b/lib/pleroma/web/api_spec/operations/report_operation.ex index b744efa60c..ffcdcbd1a5 100644 --- a/lib/pleroma/web/api_spec/operations/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/report_operation.ex @@ -53,6 +53,12 @@ defp create_request do default: false, description: "If the account is remote, should the report be forwarded to the remote admin?" + }, + rule_ids: %Schema{ + type: :array, + nullable: true, + items: %Schema{type: :number}, + description: "Array of rules" } }, required: [:account_id], @@ -60,7 +66,8 @@ defp create_request do "account_id" => "123", "status_ids" => ["1337"], "comment" => "bad status!", - "forward" => "false" + "forward" => "false", + "rule_ids" => [3] } } end diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 9aa529d0c6..b2b40e36c3 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -7,6 +7,7 @@ defmodule Pleroma.Web.CommonAPI do alias Pleroma.Conversation.Participation alias Pleroma.Formatter alias Pleroma.Object + alias Pleroma.Rule alias Pleroma.ThreadMute alias Pleroma.User alias Pleroma.UserRelationship @@ -505,14 +506,16 @@ def thread_muted?(_, _), do: false def report(user, data) do with {:ok, account} <- get_reported_account(data.account_id), {:ok, {content_html, _, _}} <- make_report_content_html(data[:comment]), - {:ok, statuses} <- get_report_statuses(account, data) do + {:ok, statuses} <- get_report_statuses(account, data), + rules <- get_report_rules(Map.get(data, :rule_ids, nil)) do ActivityPub.flag(%{ context: Utils.generate_context_id(), actor: user, account: account, statuses: statuses, content: content_html, - forward: Map.get(data, :forward, false) + forward: Map.get(data, :forward, false), + rules: rules }) end end @@ -524,6 +527,16 @@ defp get_reported_account(account_id) do end end + defp get_report_rules(nil) do + nil + end + + defp get_report_rules(rule_ids) do + rule_ids + |> Rule.get() + |> Enum.map(& &1.id) + end + def update_report_state(activity_ids, state) when is_list(activity_ids) do case Utils.update_report_state(activity_ids, state) do :ok -> {:ok, activity_ids} diff --git a/lib/pleroma/web/mastodon_api/admin/views/report_view.ex b/lib/pleroma/web/mastodon_api/admin/views/report_view.ex index c0b44ae82f..a0bedef5b0 100644 --- a/lib/pleroma/web/mastodon_api/admin/views/report_view.ex +++ b/lib/pleroma/web/mastodon_api/admin/views/report_view.ex @@ -6,9 +6,11 @@ defmodule Pleroma.Web.MastodonAPI.Admin.ReportView do use Pleroma.Web, :view alias Pleroma.HTML + alias Pleroma.Rule alias Pleroma.Web.AdminAPI.Report alias Pleroma.Web.CommonAPI.Utils alias Pleroma.Web.MastodonAPI.Admin.AccountView + alias Pleroma.Web.MastodonAPI.InstanceView alias Pleroma.Web.MastodonAPI.StatusView def render("index.json", %{reports: reports}) do @@ -56,7 +58,17 @@ def render("show.json", %{ activities: statuses, as: :activity }), - rules: [] + rules: rules(Map.get(report.data, "rules", nil)) } end + + defp rules(nil) do + [] + end + + defp rules(rule_ids) do + rule_ids + |> Rule.get() + |> render_many(InstanceView, "rule.json", as: :rule) + end end diff --git a/mix.exs b/mix.exs index aab4059483..88794748fb 100644 --- a/mix.exs +++ b/mix.exs @@ -185,7 +185,7 @@ defp deps do {:flake_id, "~> 0.1.0"}, {:concurrent_limiter, "~> 0.1.1"}, {:remote_ip, - git: "https://git.pleroma.social/pleroma/remote_ip.git", + git: "https://gitlab.com/soapbox-pub/elixir-libraries/remote_ip.git", ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"}, {:captcha, git: "https://gitlab.com/soapbox-pub/elixir-libraries/elixir-captcha.git", diff --git a/mix.lock b/mix.lock index e947f5533b..eb1e0c726d 100644 --- a/mix.lock +++ b/mix.lock @@ -121,7 +121,7 @@ "quack": {:hex, :quack, "0.1.1", "cca7b4da1a233757fdb44b3334fce80c94785b3ad5a602053b7a002b5a8967bf", [:mix], [{:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: false]}, {:tesla, "~> 1.2.0", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "d736bfa7444112eb840027bb887832a0e403a4a3437f48028c3b29a2dbbd2543"}, "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, "recon": {:hex, :recon, "2.5.1", "430ffa60685ac1efdfb1fe4c97b8767c92d0d92e6e7c3e8621559ba77598678a", [:mix, :rebar3], [], "hexpm", "5721c6b6d50122d8f68cccac712caa1231f97894bab779eff5ff0f886cb44648"}, - "remote_ip": {:git, "https://git.pleroma.social/pleroma/remote_ip.git", "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8", [ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"]}, + "remote_ip": {:git, "https://gitlab.com/soapbox-pub/elixir-libraries/remote_ip.git", "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8", [ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"]}, "sleeplocks": {:hex, :sleeplocks, "1.1.1", "3d462a0639a6ef36cc75d6038b7393ae537ab394641beb59830a1b8271faeed3", [:rebar3], [], "hexpm", "84ee37aeff4d0d92b290fff986d6a95ac5eedf9b383fadfd1d88e9b84a1c02e1"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, "sweet_xml": {:hex, :sweet_xml, "0.6.6", "fc3e91ec5dd7c787b6195757fbcf0abc670cee1e4172687b45183032221b66b8", [:mix], [], "hexpm", "2e1ec458f892ffa81f9f8386e3f35a1af6db7a7a37748a64478f13163a1f3573"}, diff --git a/test/pleroma/emoji_test.exs b/test/pleroma/emoji_test.exs index 027a8132f7..bd217b876f 100644 --- a/test/pleroma/emoji_test.exs +++ b/test/pleroma/emoji_test.exs @@ -20,6 +20,7 @@ test "tells if a string is an unicode emoji" do assert Emoji.is_unicode_emoji?("๐Ÿคฐ") assert Emoji.is_unicode_emoji?("โค๏ธ") assert Emoji.is_unicode_emoji?("๐Ÿณ๏ธโ€โšง๏ธ") + assert Emoji.is_unicode_emoji?("๐Ÿซต") # Additionally, we accept regional indicators. assert Emoji.is_unicode_emoji?("๐Ÿ‡ต") diff --git a/test/pleroma/rule_test.exs b/test/pleroma/rule_test.exs index 012ac902c8..d710a6312d 100644 --- a/test/pleroma/rule_test.exs +++ b/test/pleroma/rule_test.exs @@ -43,4 +43,15 @@ test "deleting rules" do Rule.query() |> Pleroma.Repo.all() end + + test "getting rules by ids" do + %{id: id1} = Rule.create(%{text: "Example rule"}) + %{id: id2} = Rule.create(%{text: "Second rule"}) + %{id: _id3} = Rule.create(%{text: "Third rule"}) + + rules = Rule.get([id1, id2]) + + assert Enum.all?(rules, &(&1.id in [id1, id2])) + assert length(rules) == 2 + end end diff --git a/test/pleroma/web/admin_api/views/report_view_test.exs b/test/pleroma/web/admin_api/views/report_view_test.exs index 29f5c6fc1a..c30b8958b2 100644 --- a/test/pleroma/web/admin_api/views/report_view_test.exs +++ b/test/pleroma/web/admin_api/views/report_view_test.exs @@ -7,6 +7,7 @@ defmodule Pleroma.Web.AdminAPI.ReportViewTest do import Pleroma.Factory + alias Pleroma.Rule alias Pleroma.Web.AdminAPI alias Pleroma.Web.AdminAPI.Report alias Pleroma.Web.AdminAPI.ReportView @@ -39,7 +40,8 @@ test "renders a report" do statuses: [], notes: [], state: "open", - id: activity.id + id: activity.id, + rules: [] } result = @@ -78,7 +80,8 @@ test "includes reported statuses" do statuses: [StatusView.render("show.json", %{activity: activity})], state: "open", notes: [], - id: report_activity.id + id: report_activity.id, + rules: [] } result = @@ -170,4 +173,20 @@ test "reports are ordered newest first" do assert report2.id == rendered |> Enum.at(0) |> Map.get(:id) assert report1.id == rendered |> Enum.at(1) |> Map.get(:id) end + + test "renders included rules" do + user = insert(:user) + other_user = insert(:user) + + %{id: id, text: text} = Rule.create(%{text: "Example rule"}) + + {:ok, activity} = + CommonAPI.report(user, %{ + account_id: other_user.id, + rule_ids: [id] + }) + + assert %{rules: [%{id: ^id, text: ^text}]} = + ReportView.render("show.json", Report.extract_report_info(activity)) + end end diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 3c23129ae4..ec0e21c74e 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -12,6 +12,7 @@ defmodule Pleroma.Web.CommonAPITest do alias Pleroma.Notification alias Pleroma.Object alias Pleroma.Repo + alias Pleroma.Rule alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Transmogrifier @@ -1249,6 +1250,33 @@ test "unassigns report from account" do refute Map.has_key?(activity.data, "assigned_account") end + + test "creates a report with provided rules" do + reporter = insert(:user) + target_user = insert(:user) + + %{id: rule_id} = Rule.create(%{text: "There are no rules"}) + + reporter_ap_id = reporter.ap_id + target_ap_id = target_user.ap_id + + report_data = %{ + account_id: target_user.id, + rule_ids: [rule_id] + } + + assert {:ok, flag_activity} = CommonAPI.report(reporter, report_data) + + assert %Activity{ + actor: ^reporter_ap_id, + data: %{ + "type" => "Flag", + "object" => [^target_ap_id], + "state" => "open", + "rules" => [^rule_id] + } + } = flag_activity + end end describe "reblog muting" do diff --git a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs index fcfc4a48a4..95711cfb77 100644 --- a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs @@ -5,6 +5,8 @@ defmodule Pleroma.Web.MastodonAPI.ReportControllerTest do use Pleroma.Web.ConnCase, async: true + alias Pleroma.Activity + alias Pleroma.Rule alias Pleroma.Web.CommonAPI import Pleroma.Factory @@ -44,6 +46,25 @@ test "submit a report with statuses and comment", %{ |> json_response_and_validate_schema(200) end + test "submit a report with rule_ids", %{ + conn: conn, + target_user: target_user + } do + %{id: rule_id} = Rule.create(%{text: "There are no rules"}) + + assert %{"action_taken" => false, "id" => id} = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/reports", %{ + "account_id" => target_user.id, + "forward" => "false", + "rule_ids" => [rule_id] + }) + |> json_response_and_validate_schema(200) + + assert %Activity{data: %{"rules" => [^rule_id]}} = Activity.get_report(id) + end + test "account_id is required", %{ conn: conn, activity: activity diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index b2941a62c1..8da5d21328 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -298,6 +298,15 @@ test "it sends chat messages to the 'user' stream", %{user: user, token: oauth_t assert_receive {:text, ^text} end + test "it does not send 'update' events for chat messages", %{user: user, token: oauth_token} do + other_user = insert(:user) + + Streamer.get_topic_and_add_socket("user", user, oauth_token) + {:ok, activity} = CommonAPI.post_chat_message(other_user, user, "hey") + + refute_receive {:render_with_user, _, _, ^activity} + end + test "it sends chat message notifications to the 'user:notification' stream", %{ user: user, token: oauth_token