Skip to content

Commit

Permalink
Remove false neg on the labels that ozone emits (#2310)
Browse files Browse the repository at this point in the history
* remove `neg` on the labels that ozone emits

* no negs in appview either

* no negs on self-labels

* no neg on self labels in ozone either

* fix query labels test
  • Loading branch information
dholms authored Mar 13, 2024
1 parent 16ac2ef commit 069d143
Show file tree
Hide file tree
Showing 24 changed files with 8 additions and 468 deletions.
6 changes: 4 additions & 2 deletions packages/bsky/src/data-plane/server/routes/labels.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as ui8 from 'uint8arrays'
import { noUndefinedVals } from '@atproto/common'
import { ServiceImpl } from '@connectrpc/connect'
import { Service } from '../../../proto/bsky_connect'
import { Database } from '../db'
Expand All @@ -17,10 +18,11 @@ export default (db: Database): Partial<ServiceImpl<typeof Service>> => ({
.execute()

const labels = res.map((l) => {
const formatted = {
const formatted = noUndefinedVals({
...l,
cid: l.cid === '' ? undefined : l.cid,
}
neg: l.neg === true ? true : undefined,
})
return ui8.fromString(JSON.stringify(formatted), 'utf8')
})
return { labels }
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/src/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export class Views {
? normalizeDatetimeAlways(record.createdAt)
: new Date(0).toISOString()
return record.labels.values.map(({ val }) => {
return { src, uri, cid, val, cts, neg: false }
return { src, uri, cid, val, cts }
})
}

Expand Down
45 changes: 0 additions & 45 deletions packages/bsky/tests/__snapshots__/feed-generation.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ Object {
Object {
"cid": "cids(3)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(3)",
"uri": "record(4)",
"val": "self-label-a",
},
Object {
"cid": "cids(3)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(3)",
"uri": "record(4)",
"val": "self-label-b",
Expand Down Expand Up @@ -144,15 +142,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -187,15 +183,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -230,15 +224,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -273,15 +265,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -316,15 +306,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -364,15 +352,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand All @@ -389,7 +375,6 @@ Array [
Object {
"cid": "cids(0)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(0)",
"val": "self-label",
Expand Down Expand Up @@ -614,15 +599,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand Down Expand Up @@ -658,15 +641,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand Down Expand Up @@ -885,15 +866,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand All @@ -906,7 +885,6 @@ Array [
Object {
"cid": "cids(0)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(0)",
"val": "self-label",
Expand Down Expand Up @@ -1074,15 +1052,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand Down Expand Up @@ -1113,15 +1089,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand Down Expand Up @@ -1159,15 +1133,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand All @@ -1184,7 +1156,6 @@ Array [
Object {
"cid": "cids(0)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(0)",
"val": "self-label",
Expand Down Expand Up @@ -1375,15 +1346,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand Down Expand Up @@ -1419,15 +1388,13 @@ Array [
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(0)",
"uri": "record(1)",
"val": "self-label-b",
Expand Down Expand Up @@ -1474,15 +1441,13 @@ Object {
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -1525,15 +1490,13 @@ Object {
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -1568,15 +1531,13 @@ Object {
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -1621,15 +1582,13 @@ Object {
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -1666,15 +1625,13 @@ Object {
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down Expand Up @@ -1709,15 +1666,13 @@ Object {
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-a",
},
Object {
"cid": "cids(2)",
"cts": "1970-01-01T00:00:00.000Z",
"neg": false,
"src": "user(1)",
"uri": "record(3)",
"val": "self-label-b",
Expand Down
Loading

0 comments on commit 069d143

Please sign in to comment.