From 9b55833e2fdcd9660c85be087a1f718ea17d02c2 Mon Sep 17 00:00:00 2001 From: chainsawriot Date: Mon, 28 Nov 2022 21:21:22 +0100 Subject: [PATCH] fix #115 --- R/datastructure.R | 6 +++++- .../timeline/timeline_with_poll115.RDS | Bin 0 -> 8811 bytes tests/testthat/test-parse_status.R | 20 ++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/testdata/timeline/timeline_with_poll115.RDS diff --git a/R/datastructure.R b/R/datastructure.R index 15b1fa5..f7310c5 100644 --- a/R/datastructure.R +++ b/R/datastructure.R @@ -112,7 +112,11 @@ parse_poll <- function(poll, parse_date = TRUE) { if (parse_date) { output$expires_at <- format_date(output$expires_at) } - for (field in c("own_votes", "options", "emojis")) { + output[["own_votes"]] <- I(list(list())) + if (has_name_(poll, "own_votes") & length(poll[["own_votes"]] != 0)) { + output[["own_votes"]] <- list(poll[["own_votes"]]) + } + for (field in c("options", "emojis")) { if (has_name_(poll, field) & length(poll[[field]]) != 0) { output[[field]] <- list(dplyr::bind_rows(poll[[field]])) } else { diff --git a/tests/testdata/timeline/timeline_with_poll115.RDS b/tests/testdata/timeline/timeline_with_poll115.RDS new file mode 100644 index 0000000000000000000000000000000000000000..969a6e20ed04315db3e54a41caa763f17ba24780 GIT binary patch literal 8811 zcmV-xB9z@9iwFP!000001MPiFj3mdIUiEbMyeLwnsMm5SC}w0p)T*m0-;Y{q*nEoP z9cpGdO^L8!j3YCnx{{rbQf5}y)W9&f>x1D1j6Lka5HF?x`=C86VEEv}!Vp%{Vu1yG zTAzL4(U;}H2m7M+ACZ|=QIT2IH9g(c-NPi zv)GHHP8z#D4!Wb1Bx(1}D0Yd5yJ?0q2uZtTB~;t8bj6S*MaWQHl;LifS8W#0a`jsD zEY^RO=bW_G$3WV~U%xuMb^EiAKM7GnaNs}kqx~I(_pu-Cpg}xFemIPi3`ZIAQ&MR1EzAAw%S62nS<4Ns%9+(2u+wG>J#Z#Su#JAwd`g zafaePa*}w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