@atproto/api
Advanced tools
Comparing version 0.10.1 to 0.10.2
# @atproto/api | ||
## 0.10.2 | ||
### Patch Changes | ||
- [#2245](https://github.com/bluesky-social/atproto/pull/2245) [`61b3d2525`](https://github.com/bluesky-social/atproto/commit/61b3d25253353db2da1336004f94e7dc5adb0410) Thanks [@mary-ext](https://github.com/mary-ext)! - Prevent hashtag emoji from being parsed as a tag | ||
- [#2218](https://github.com/bluesky-social/atproto/pull/2218) [`43531905c`](https://github.com/bluesky-social/atproto/commit/43531905ce1aec6d36d9be5943782811ecca6e6d) Thanks [@estrattonbailey](https://github.com/estrattonbailey)! - Fix mute word upsert logic by ensuring we're comparing sanitized word values | ||
- [#2245](https://github.com/bluesky-social/atproto/pull/2245) [`61b3d2525`](https://github.com/bluesky-social/atproto/commit/61b3d25253353db2da1336004f94e7dc5adb0410) Thanks [@mary-ext](https://github.com/mary-ext)! - Properly calculate length of tag | ||
- Updated dependencies [[`0c815b964`](https://github.com/bluesky-social/atproto/commit/0c815b964c030aa0f277c40bf9786f130dc320f4)]: | ||
- @atproto/syntax@0.2.0 | ||
- @atproto/lexicon@0.3.2 | ||
- @atproto/xrpc@0.4.2 | ||
## 0.10.1 | ||
@@ -4,0 +19,0 @@ |
{ | ||
"name": "@atproto/api", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"license": "MIT", | ||
@@ -24,10 +24,10 @@ "description": "Client library for atproto and Bluesky", | ||
"@atproto/common-web": "^0.2.3", | ||
"@atproto/lexicon": "^0.3.1", | ||
"@atproto/syntax": "^0.1.5", | ||
"@atproto/xrpc": "^0.4.1" | ||
"@atproto/lexicon": "^0.3.2", | ||
"@atproto/syntax": "^0.2.0", | ||
"@atproto/xrpc": "^0.4.2" | ||
}, | ||
"devDependencies": { | ||
"common-tags": "^1.8.2", | ||
"@atproto/lex-cli": "^0.3.0", | ||
"@atproto/dev-env": "^0.2.33" | ||
"@atproto/lex-cli": "^0.3.1", | ||
"@atproto/dev-env": "^0.2.34" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
@@ -671,13 +671,13 @@ import { AtUri } from '@atproto/syntax' | ||
if (action === 'upsert' || action === 'update') { | ||
for (const newItem of mutedWords) { | ||
for (const word of mutedWords) { | ||
let foundMatch = false | ||
for (const existingItem of mutedWordsPref.items) { | ||
if (existingItem.value === newItem.value) { | ||
if (existingItem.value === sanitizeMutedWord(word).value) { | ||
existingItem.targets = | ||
action === 'upsert' | ||
? Array.from( | ||
new Set([...existingItem.targets, ...newItem.targets]), | ||
new Set([...existingItem.targets, ...word.targets]), | ||
) | ||
: newItem.targets | ||
: word.targets | ||
foundMatch = true | ||
@@ -689,3 +689,3 @@ break | ||
if (action === 'upsert' && !foundMatch) { | ||
mutedWordsPref.items.push(sanitizeMutedWord(newItem)) | ||
mutedWordsPref.items.push(sanitizeMutedWord(word)) | ||
} | ||
@@ -692,0 +692,0 @@ } |
@@ -73,13 +73,11 @@ import TLDs from 'tlds' | ||
{ | ||
const re = /(?:^|\s)(#[^\d\s]\S*)(?=\s)?/g | ||
const re = /(^|\s)#((?!\ufe0f)[^\d\s]\S*)(?=\s)?/g | ||
while ((match = re.exec(text.utf16))) { | ||
let [tag] = match | ||
const hasLeadingSpace = /^\s/.test(tag) | ||
let [, leading, tag] = match | ||
tag = tag.trim().replace(/\p{P}+$/gu, '') // strip ending punctuation | ||
// inclusive of #, max of 64 chars | ||
if (tag.length > 66) continue | ||
if (tag.length === 0 || tag.length > 64) continue | ||
const index = match.index + (hasLeadingSpace ? 1 : 0) | ||
const index = match.index + leading.length | ||
@@ -89,3 +87,3 @@ facets.push({ | ||
byteStart: text.utf16IndexToUtf8Index(index), | ||
byteEnd: text.utf16IndexToUtf8Index(index + tag.length), // inclusive of last char | ||
byteEnd: text.utf16IndexToUtf8Index(index + 1 + tag.length), | ||
}, | ||
@@ -95,3 +93,3 @@ features: [ | ||
$type: 'app.bsky.richtext.facet#tag', | ||
tag: tag.replace(/^#/, ''), | ||
tag: tag, | ||
}, | ||
@@ -98,0 +96,0 @@ ], |
@@ -1202,6 +1202,13 @@ import { TestNetworkNoAppView } from '@atproto/dev-env' | ||
it('upsertMutedWords with #', async () => { | ||
await agent.upsertMutedWords([ | ||
{ value: 'hashtag', targets: ['content'] }, | ||
]) | ||
await agent.upsertMutedWords([{ value: '#hashtag', targets: ['tag'] }]) | ||
const { mutedWords } = await agent.getPreferences() | ||
expect(mutedWords.find((m) => m.value === '#hashtag')).toBeFalsy() | ||
expect(mutedWords.find((m) => m.value === 'hashtag')).toBeTruthy() | ||
expect(mutedWords.find((m) => m.value === 'hashtag')).toStrictEqual({ | ||
value: 'hashtag', | ||
targets: ['content', 'tag'], | ||
}) | ||
expect(mutedWords.filter((m) => m.value === 'hashtag').length).toBe(1) | ||
}) | ||
@@ -1208,0 +1215,0 @@ |
@@ -244,11 +244,12 @@ import { AtpAgent, RichText, RichTextSegment } from '../src' | ||
['#', [], []], | ||
['#?', [], []], | ||
['text #', [], []], | ||
['text # text', [], []], | ||
[ | ||
'body #thisisa64characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', | ||
['thisisa64characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], | ||
[{ byteStart: 5, byteEnd: 71 }], | ||
'body #thisisa64characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', | ||
['thisisa64characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'], | ||
[{ byteStart: 5, byteEnd: 70 }], | ||
], | ||
[ | ||
'body #thisisa65characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', | ||
'body #thisisa65characterstring_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', | ||
[], | ||
@@ -301,2 +302,13 @@ [], | ||
], | ||
['this #οΈβ£tag should not be a tag', [], []], | ||
[ | ||
'this ##οΈβ£tag should be a tag', | ||
['#οΈβ£tag'], | ||
[ | ||
{ | ||
byteStart: 5, | ||
byteEnd: 16, | ||
}, | ||
], | ||
], | ||
] | ||
@@ -303,0 +315,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4811381
75678
- Removed@atproto/syntax@0.1.5(transitive)
Updated@atproto/lexicon@^0.3.2
Updated@atproto/syntax@^0.2.0
Updated@atproto/xrpc@^0.4.2