@ai-matrx/meet 0.7.12 → 0.7.14

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/dist/index.js CHANGED
@@ -1346,7 +1346,18 @@ function withItem(collab, row, fromRoom = false) {
1346
1346
  const poll = pollFromRow(row);
1347
1347
  if (poll === null) return collab;
1348
1348
  const known = collab.polls.find((p) => p.id === poll.id);
1349
- const merged = fromRoom && known !== void 0 ? { ...poll, myVote: known.myVote } : poll;
1349
+ let merged = fromRoom && known !== void 0 ? { ...poll, myVote: known.myVote } : poll;
1350
+ if (fromRoom && known !== void 0 && !poll.options.some((o) => o.votes !== void 0)) {
1351
+ const counted = new Map(known.options.map((o) => [o.id, o]));
1352
+ merged = {
1353
+ ...merged,
1354
+ voterCount: known.voterCount,
1355
+ options: merged.options.map((o) => {
1356
+ const had = counted.get(o.id);
1357
+ return had === void 0 ? o : { ...o, votes: had.votes, voters: had.voters };
1358
+ })
1359
+ };
1360
+ }
1350
1361
  return { ...collab, polls: upsert(collab.polls, merged) };
1351
1362
  }
1352
1363
  if (kind === "question") {
@@ -1379,13 +1390,8 @@ function without(collab, ids) {
1379
1390
  }
1380
1391
  function applyCollabPacket(collab, payload, context) {
1381
1392
  const item = obj(payload["item"]);
1382
- const audience = str(payload["audience"]);
1383
1393
  if (item !== null) {
1384
1394
  const kind = str(item["kind"]);
1385
- const hostOnlyView = kind === "poll" || kind === "question";
1386
- if (hostOnlyView && context.isHost && audience !== "hosts") {
1387
- return { next: null, dropped: "the room copy of an item a host receives in full" };
1388
- }
1389
1395
  let next = withItem(collab, item, true);
1390
1396
  if (kind === "poll" && str(item["state"]) === "live") {
1391
1397
  const before = collab.polls.find((p) => p.id === str(item["id"]));