@atproto/api 0.5.2 → 0.5.3

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.
@@ -676,7 +676,7 @@
676
676
  "author": "self",
677
677
  "labels": {"post": ["!hide"]},
678
678
  "behaviors": {
679
- "content": {"cause": "label:!hide", "alert": true}
679
+ "content": {"cause": "label:!hide", "blur": true}
680
680
  }
681
681
  },
682
682
  "Self-post: Imperative label ('!hide') on author profile": {
@@ -700,7 +700,7 @@
700
700
  "quoteAuthor": "self",
701
701
  "labels": {"quotedPost": ["!hide"]},
702
702
  "behaviors": {
703
- "embed": {"cause": "label:!hide", "alert": true}
703
+ "embed": {"cause": "label:!hide", "blur": true}
704
704
  }
705
705
  },
706
706
  "Self-post: Imperative label ('!hide') on quoted author account": {
@@ -712,6 +712,138 @@
712
712
  "behaviors": {}
713
713
  },
714
714
 
715
+ "Self-post: Imperative label ('!warn') on post": {
716
+ "cfg": "none",
717
+ "subject": "post",
718
+ "author": "self",
719
+ "labels": {"post": ["!warn"]},
720
+ "behaviors": {
721
+ "content": {"cause": "label:!warn", "blur": true}
722
+ }
723
+ },
724
+ "Self-post: Imperative label ('!warn') on author profile": {
725
+ "cfg": "none",
726
+ "subject": "post",
727
+ "author": "self",
728
+ "labels": {"profile": ["!warn"]},
729
+ "behaviors": {}
730
+ },
731
+ "Self-post: Imperative label ('!warn') on author account": {
732
+ "cfg": "none",
733
+ "subject": "post",
734
+ "author": "self",
735
+ "labels": {"account": ["!warn"]},
736
+ "behaviors": {}
737
+ },
738
+ "Self-post: Imperative label ('!warn') on quoted post": {
739
+ "cfg": "none",
740
+ "subject": "post",
741
+ "author": "self",
742
+ "quoteAuthor": "self",
743
+ "labels": {"quotedPost": ["!warn"]},
744
+ "behaviors": {
745
+ "embed": {"cause": "label:!warn", "blur": true}
746
+ }
747
+ },
748
+ "Self-post: Imperative label ('!warn') on quoted author account": {
749
+ "cfg": "none",
750
+ "subject": "post",
751
+ "author": "self",
752
+ "quoteAuthor": "self",
753
+ "labels": {"quotedAccount": ["!warn"]},
754
+ "behaviors": {}
755
+ },
756
+
757
+ "Self-post: Blur-media label ('porn') on post (hide)": {
758
+ "cfg": "porn-hide",
759
+ "subject": "post",
760
+ "author": "self",
761
+ "labels": {"post": ["porn"]},
762
+ "behaviors": {
763
+ "embed": {"cause": "label:porn", "blur": true}
764
+ }
765
+ },
766
+ "Self-post: Blur-media label ('porn') on author profile (hide)": {
767
+ "cfg": "porn-hide",
768
+ "subject": "post",
769
+ "author": "self",
770
+ "labels": {"profile": ["porn"]},
771
+ "behaviors": {
772
+ }
773
+ },
774
+ "Self-post: Blur-media label ('porn') on author account (hide)": {
775
+ "cfg": "porn-hide",
776
+ "subject": "post",
777
+ "author": "self",
778
+ "labels": {"account": ["porn"]},
779
+ "behaviors": {
780
+ }
781
+ },
782
+ "Self-post: Blur-media label ('porn') on quoted post (hide)": {
783
+ "cfg": "porn-hide",
784
+ "subject": "post",
785
+ "author": "self",
786
+ "quoteAuthor": "self",
787
+ "labels": {"quotedPost": ["porn"]},
788
+ "behaviors": {
789
+ "embed": {"cause": "label:porn", "blur": true}
790
+ }
791
+ },
792
+ "Self-post: Blur-media label ('porn') on quoted author account (hide)": {
793
+ "cfg": "porn-hide",
794
+ "subject": "post",
795
+ "author": "self",
796
+ "quoteAuthor": "self",
797
+ "labels": {"quotedAccount": ["porn"]},
798
+ "behaviors": {
799
+ }
800
+ },
801
+
802
+ "Self-post: Blur-media label ('porn') on post (warn)": {
803
+ "cfg": "porn-warn",
804
+ "subject": "post",
805
+ "author": "self",
806
+ "labels": {"post": ["porn"]},
807
+ "behaviors": {
808
+ "embed": {"cause": "label:porn", "blur": true}
809
+ }
810
+ },
811
+ "Self-post: Blur-media label ('porn') on author profile (warn)": {
812
+ "cfg": "porn-warn",
813
+ "subject": "post",
814
+ "author": "self",
815
+ "labels": {"profile": ["porn"]},
816
+ "behaviors": {
817
+ }
818
+ },
819
+ "Self-post: Blur-media label ('porn') on author account (warn)": {
820
+ "cfg": "porn-warn",
821
+ "subject": "post",
822
+ "author": "self",
823
+ "labels": {"account": ["porn"]},
824
+ "behaviors": {
825
+ }
826
+ },
827
+ "Self-post: Blur-media label ('porn') on quoted post (warn)": {
828
+ "cfg": "porn-warn",
829
+ "subject": "post",
830
+ "author": "self",
831
+ "quoteAuthor": "self",
832
+ "labels": {"quotedPost": ["porn"]},
833
+ "behaviors": {
834
+ "embed": {"cause": "label:porn", "blur": true}
835
+ }
836
+ },
837
+ "Self-post: Blur-media label ('porn') on quoted author account (warn)": {
838
+ "cfg": "porn-warn",
839
+ "subject": "post",
840
+ "author": "self",
841
+ "quoteAuthor": "self",
842
+ "labels": {"quotedAccount": ["porn"]},
843
+ "behaviors": {
844
+ }
845
+ },
846
+
715
847
  "Post with blocked author": {
716
848
  "cfg": "none",
717
849
  "subject": "post",
@@ -1463,8 +1463,8 @@ Key:
1463
1463
 
1464
1464
  </td>
1465
1465
  <td>
1466
+
1466
1467
 
1467
- 🪧
1468
1468
  </td>
1469
1469
  <td>
1470
1470
 
@@ -1537,8 +1537,8 @@ Key:
1537
1537
 
1538
1538
  </td>
1539
1539
  <td>
1540
+
1540
1541
 
1541
- 🪧
1542
1542
  </td>
1543
1543
  </tr>
1544
1544
 
@@ -1566,6 +1566,336 @@ Key:
1566
1566
 
1567
1567
 
1568
1568
 
1569
+
1570
+ <tr>
1571
+ <td><strong>Self-post: Imperative label ('!warn') on post</strong></td>
1572
+ <td>
1573
+
1574
+ </td>
1575
+ <td>
1576
+
1577
+
1578
+ </td>
1579
+ <td>
1580
+
1581
+
1582
+ </td>
1583
+ <td>
1584
+
1585
+
1586
+ </td>
1587
+ </tr>
1588
+
1589
+
1590
+
1591
+
1592
+ <tr>
1593
+ <td><strong>Self-post: Imperative label ('!warn') on author profile</strong></td>
1594
+ <td>
1595
+
1596
+ </td>
1597
+ <td>
1598
+
1599
+
1600
+ </td>
1601
+ <td>
1602
+
1603
+
1604
+ </td>
1605
+ <td>
1606
+
1607
+
1608
+ </td>
1609
+ </tr>
1610
+
1611
+
1612
+
1613
+
1614
+ <tr>
1615
+ <td><strong>Self-post: Imperative label ('!warn') on author account</strong></td>
1616
+ <td>
1617
+
1618
+ </td>
1619
+ <td>
1620
+
1621
+
1622
+ </td>
1623
+ <td>
1624
+
1625
+
1626
+ </td>
1627
+ <td>
1628
+
1629
+
1630
+ </td>
1631
+ </tr>
1632
+
1633
+
1634
+
1635
+
1636
+ <tr>
1637
+ <td><strong>Self-post: Imperative label ('!warn') on quoted post</strong></td>
1638
+ <td>
1639
+
1640
+ </td>
1641
+ <td>
1642
+
1643
+
1644
+ </td>
1645
+ <td>
1646
+
1647
+
1648
+ </td>
1649
+ <td>
1650
+
1651
+
1652
+ </td>
1653
+ </tr>
1654
+
1655
+
1656
+
1657
+
1658
+ <tr>
1659
+ <td><strong>Self-post: Imperative label ('!warn') on quoted author account</strong></td>
1660
+ <td>
1661
+
1662
+ </td>
1663
+ <td>
1664
+
1665
+
1666
+ </td>
1667
+ <td>
1668
+
1669
+
1670
+ </td>
1671
+ <td>
1672
+
1673
+
1674
+ </td>
1675
+ </tr>
1676
+
1677
+
1678
+
1679
+
1680
+ <tr>
1681
+ <td><strong>Self-post: Blur-media label ('porn') on post (hide)</strong></td>
1682
+ <td>
1683
+
1684
+ </td>
1685
+ <td>
1686
+
1687
+
1688
+ </td>
1689
+ <td>
1690
+
1691
+
1692
+ </td>
1693
+ <td>
1694
+
1695
+
1696
+ </td>
1697
+ </tr>
1698
+
1699
+
1700
+
1701
+
1702
+ <tr>
1703
+ <td><strong>Self-post: Blur-media label ('porn') on author profile (hide)</strong></td>
1704
+ <td>
1705
+
1706
+ </td>
1707
+ <td>
1708
+
1709
+
1710
+ </td>
1711
+ <td>
1712
+
1713
+
1714
+ </td>
1715
+ <td>
1716
+
1717
+
1718
+ </td>
1719
+ </tr>
1720
+
1721
+
1722
+
1723
+
1724
+ <tr>
1725
+ <td><strong>Self-post: Blur-media label ('porn') on author account (hide)</strong></td>
1726
+ <td>
1727
+
1728
+ </td>
1729
+ <td>
1730
+
1731
+
1732
+ </td>
1733
+ <td>
1734
+
1735
+
1736
+ </td>
1737
+ <td>
1738
+
1739
+
1740
+ </td>
1741
+ </tr>
1742
+
1743
+
1744
+
1745
+
1746
+ <tr>
1747
+ <td><strong>Self-post: Blur-media label ('porn') on quoted post (hide)</strong></td>
1748
+ <td>
1749
+
1750
+ </td>
1751
+ <td>
1752
+
1753
+
1754
+ </td>
1755
+ <td>
1756
+
1757
+
1758
+ </td>
1759
+ <td>
1760
+
1761
+
1762
+ </td>
1763
+ </tr>
1764
+
1765
+
1766
+
1767
+
1768
+ <tr>
1769
+ <td><strong>Self-post: Blur-media label ('porn') on quoted author account (hide)</strong></td>
1770
+ <td>
1771
+
1772
+ </td>
1773
+ <td>
1774
+
1775
+
1776
+ </td>
1777
+ <td>
1778
+
1779
+
1780
+ </td>
1781
+ <td>
1782
+
1783
+
1784
+ </td>
1785
+ </tr>
1786
+
1787
+
1788
+
1789
+
1790
+ <tr>
1791
+ <td><strong>Self-post: Blur-media label ('porn') on post (warn)</strong></td>
1792
+ <td>
1793
+
1794
+ </td>
1795
+ <td>
1796
+
1797
+
1798
+ </td>
1799
+ <td>
1800
+
1801
+
1802
+ </td>
1803
+ <td>
1804
+
1805
+
1806
+ </td>
1807
+ </tr>
1808
+
1809
+
1810
+
1811
+
1812
+ <tr>
1813
+ <td><strong>Self-post: Blur-media label ('porn') on author profile (warn)</strong></td>
1814
+ <td>
1815
+
1816
+ </td>
1817
+ <td>
1818
+
1819
+
1820
+ </td>
1821
+ <td>
1822
+
1823
+
1824
+ </td>
1825
+ <td>
1826
+
1827
+
1828
+ </td>
1829
+ </tr>
1830
+
1831
+
1832
+
1833
+
1834
+ <tr>
1835
+ <td><strong>Self-post: Blur-media label ('porn') on author account (warn)</strong></td>
1836
+ <td>
1837
+
1838
+ </td>
1839
+ <td>
1840
+
1841
+
1842
+ </td>
1843
+ <td>
1844
+
1845
+
1846
+ </td>
1847
+ <td>
1848
+
1849
+
1850
+ </td>
1851
+ </tr>
1852
+
1853
+
1854
+
1855
+
1856
+ <tr>
1857
+ <td><strong>Self-post: Blur-media label ('porn') on quoted post (warn)</strong></td>
1858
+ <td>
1859
+
1860
+ </td>
1861
+ <td>
1862
+
1863
+
1864
+ </td>
1865
+ <td>
1866
+
1867
+
1868
+ </td>
1869
+ <td>
1870
+
1871
+
1872
+ </td>
1873
+ </tr>
1874
+
1875
+
1876
+
1877
+
1878
+ <tr>
1879
+ <td><strong>Self-post: Blur-media label ('porn') on quoted author account (warn)</strong></td>
1880
+ <td>
1881
+
1882
+ </td>
1883
+ <td>
1884
+
1885
+
1886
+ </td>
1887
+ <td>
1888
+
1889
+
1890
+ </td>
1891
+ <td>
1892
+
1893
+
1894
+ </td>
1895
+ </tr>
1896
+
1897
+
1898
+
1569
1899
  <tr><th>Scenario</th><th>Filter</th><th>Content</th><th>Avatar</th><th>Embed</th></tr>
1570
1900
  <tr>
1571
1901
  <td><strong>Post with blocked author</strong></td>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/api",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "codegen": "yarn docgen && node ./scripts/generate-code.mjs && lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
@@ -61,10 +61,10 @@ export function moderateProfile(
61
61
 
62
62
  // downgrade based on authorship
63
63
  if (!isModerationDecisionNoop(account) && account.did === opts.userDid) {
64
- downgradeDecision(account, { alert: true })
64
+ downgradeDecision(account, 'alert')
65
65
  }
66
66
  if (!isModerationDecisionNoop(profile) && profile.did === opts.userDid) {
67
- downgradeDecision(profile, { alert: true })
67
+ downgradeDecision(profile, 'alert')
68
68
  }
69
69
 
70
70
  // derive avatar blurring from account & profile, but override for mutes because that shouldnt blur
@@ -154,23 +154,23 @@ export function moderatePost(
154
154
 
155
155
  // downgrade based on authorship
156
156
  if (!isModerationDecisionNoop(post) && post.did === opts.userDid) {
157
- downgradeDecision(post, { alert: true })
157
+ downgradeDecision(post, 'blur')
158
158
  }
159
- if (!isModerationDecisionNoop(account) && account.did === opts.userDid) {
160
- downgradeDecision(account, { alert: false })
159
+ if (account.cause && account.did === opts.userDid) {
160
+ downgradeDecision(account, 'noop')
161
161
  }
162
- if (!isModerationDecisionNoop(profile) && profile.did === opts.userDid) {
163
- downgradeDecision(profile, { alert: false })
162
+ if (profile.cause && profile.did === opts.userDid) {
163
+ downgradeDecision(profile, 'noop')
164
164
  }
165
165
  if (quote && !isModerationDecisionNoop(quote) && quote.did === opts.userDid) {
166
- downgradeDecision(quote, { alert: true })
166
+ downgradeDecision(quote, 'blur')
167
167
  }
168
168
  if (
169
169
  quotedAccount &&
170
170
  !isModerationDecisionNoop(quotedAccount) &&
171
171
  quotedAccount.did === opts.userDid
172
172
  ) {
173
- downgradeDecision(quotedAccount, { alert: false })
173
+ downgradeDecision(quotedAccount, 'noop')
174
174
  }
175
175
 
176
176
  // derive filtering from feeds from the post, post author's account,
@@ -34,15 +34,19 @@ export function takeHighestPriorityDecision(
34
34
 
35
35
  export function downgradeDecision(
36
36
  decision: ModerationDecision,
37
- { alert }: { alert: boolean },
37
+ to: 'blur' | 'alert' | 'noop',
38
38
  ) {
39
- decision.blur = false
40
- decision.blurMedia = false
41
39
  decision.filter = false
42
40
  decision.noOverride = false
43
- decision.alert = alert
44
- if (!alert) {
41
+ if (to === 'noop') {
42
+ decision.blur = false
43
+ decision.blurMedia = false
44
+ decision.alert = false
45
45
  delete decision.cause
46
+ } else if (to === 'alert') {
47
+ decision.blur = false
48
+ decision.blurMedia = false
49
+ decision.alert = true
46
50
  }
47
51
  }
48
52