Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg editor breaks private answer saving #26

Closed
AprilSylph opened this issue Apr 2, 2022 · 0 comments
Closed

Gutenberg editor breaks private answer saving #26

AprilSylph opened this issue Apr 2, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@AprilSylph
Copy link
Owner

For some reason, the layout is calculated by the Gutenberg beta editor weirdly, causing the ask layout to be in position 1 instead of 0, breaking the isPrivateAnswer logic:

const isPrivateAnswer = state === undefined && isPrivate === true && layout[0].type === 'ask';

This could probably be fixed by replacing that condition with layout.some(({ type }) => type === 'ask').

Sample private answer request
{
  "placement_id": "HhUV/NRnbN8MiBRbfshMYVFpL4dRRhJws72lOlXQGae/E0QKqdmMQwBYhitUYIoJllHSboJyoURxYztdlse+hjzSFj33NFNYBLgBJHZGmwLWMh1wl3BjAWkuiEgYQNvI3MpXdF/kghdCt5gwl9iO3M3ALTByMgxoRH25MeDVwvxJixTWF1aPa2LIss1r9K0trePILqMLZsFBfNXBskwoz0bVEiQjbkPhaa/Tc46y9y6/Yn35etnr8if4SpjjKrULfPfChjgcTM6wnQZYfG/dVf/XFrqTm0xy7yusSunNBzv3FhbqqDFtnTFhS+qkTf9GOfBinn9QQJmp33TFHxqp4S7gSd+V+Ua8hwZZ0D9ytKy4TK/bA2unVdg0dHwOPmiTd8jAYmbT6ZpupeI6dmy0cQpsSrJ3ZSbepBDuEyc/4wBNdKgQL8QxFW9SEJKAMDK1fhR/vRETgoOlTsxx9sVG8hQEGTBamaPeJohQ7x0HxaS/ls07p7k4hnkeHmWynglSBZZ7QL5bNY7XHYM1mgTERBOnzxLeHK+oS6CJjVkYYbYAI35qlRHnwtlJUsMIe9lmqCp3UyB2nPWbUxzU9F9gMUd6NHTKuUavh9/b/6AtM6UZoqkdxP4PUWooysiO1cyj+Vzwh2t23rHXOCmHF/2N+eVK2eKNoKNSrA6bShVgeayH8NNWId518M5BCOgAybKd",
  "layout": [
    {
      "type": "rows",
      "display": [
        {
          "blocks": [
            0
          ]
        },
        {
          "blocks": [
            1
          ]
        }
      ]
    },
    {
      "type": "ask",
      "blocks": [
        0
      ],
      "attribution": {
        "type": "blog",
        "url": "https://april.tumblr.com/",
        "blog": {
          "name": "april",
          "avatar": [
            {
              "width": 512,
              "height": 512,
              "url": "https://64.media.tumblr.com/386f8620cbde14c4be5cd80a18e6f121/ff97fe57b15119eb-31/s512x512u_c1/2658db2e460a080b1988433c13c72c5d026bae87.pnj"
            },
            {
              "width": 128,
              "height": 128,
              "url": "https://64.media.tumblr.com/386f8620cbde14c4be5cd80a18e6f121/ff97fe57b15119eb-31/s128x128u_c1/bebcf584fdeaa86a88f10896bb85b7e07e6d2b71.pnj"
            },
            {
              "width": 96,
              "height": 96,
              "url": "https://64.media.tumblr.com/386f8620cbde14c4be5cd80a18e6f121/ff97fe57b15119eb-31/s96x96u_c1/663f501d3c955141b55d4b01f36ed62720062ebb.pnj"
            },
            {
              "width": 64,
              "height": 64,
              "url": "https://64.media.tumblr.com/386f8620cbde14c4be5cd80a18e6f121/ff97fe57b15119eb-31/s64x64u_c1/c19d3dbde332b5c74876851a4bfec158e1780557.pnj"
            }
          ],
          "title": "April Sylph",
          "url": "https://april.tumblr.com/",
          "is_adult": false,
          "is_member": true,
          "description_npf": [
            {
              "type": "text",
              "text": "22 | she/her | ⚧ ⚢"
            }
          ],
          "uuid": "t:Fft_7iTGnBlHdl-UtlllwQ",
          "can_be_followed": false,
          "followed": true,
          "theme": {
            "header_full_width": 1920,
            "header_full_height": 1080,
            "avatar_shape": "square",
            "background_color": "#0d1117",
            "body_font": "Helvetica Neue",
            "header_bounds": "",
            "header_image": "https://64.media.tumblr.com/677686b9355319d4c13ec287ad62422b/ff97fe57b15119eb-22/s1920x1080/04df1d18ff0c2b6990f5a1fafa1b06fa58e3395e.jpg",
            "header_image_focused": "https://64.media.tumblr.com/677686b9355319d4c13ec287ad62422b/ff97fe57b15119eb-22/s2048x3072/00eab0a895849169fb3c950fe025bbe469203308.jpg",
            "header_image_poster": "",
            "header_image_scaled": "https://64.media.tumblr.com/677686b9355319d4c13ec287ad62422b/ff97fe57b15119eb-22/s2048x3072/00eab0a895849169fb3c950fe025bbe469203308.jpg",
            "header_stretch": true,
            "link_color": "#a371f7",
            "show_avatar": false,
            "show_description": true,
            "show_header_image": false,
            "show_title": true,
            "title_color": "#c9d1d9",
            "title_font": "Favorit",
            "title_font_weight": "regular"
          },
          "primary": true,
          "is_paywall_on": false,
          "paywall_access": "creator",
          "subscription_plan": null,
          "share_likes": false,
          "share_following": false,
          "can_subscribe": false,
          "subscribed": false,
          "ask": true,
          "is_blocked_from_primary": false,
          "tweet": "Y",
          "is_password_protected": false,
          "timezone_offset": "GMT+0100",
          "is_tipping_on": false,
          "is_private_channel": false
        }
      }
    }
  ],
  "hide_trail": true,
  "content": [
    {
      "type": "text",
      "text": "ask"
    },
    {
      "type": "text",
      "text": "answer"
    }
  ],
  "slug": "ask",
  "date": "2022-04-02 08:25:40 GMT",
  "is_private": true,
  "can_be_tipped": true,
  "tags": ""
}
@AprilSylph AprilSylph added the bug Something isn't working label Apr 2, 2022
@AprilSylph AprilSylph self-assigned this Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant