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

padUpdate missing padId #5814

Open
danielpetri1 opened this issue Jul 6, 2023 · 6 comments
Open

padUpdate missing padId #5814

danielpetri1 opened this issue Jul 6, 2023 · 6 comments
Labels
Needs confirmation Stale No recent activity

Comments

@danielpetri1
Copy link

danielpetri1 commented Jul 6, 2023

Describe the bug
The padUpdate hook does not appear to include the pad.id attribute as it did in 1.8.17.

Sample:

{
    "body": {
        "pad": {
            "atext": {
                "text": "​s\n",
                "attribs": "+1*0+1|1+1"
            },
            "pool": {
                "numToAttrib": {
                    "0": [
                        "author",
                        "a.i2WSCwOkL5ZS19pD"
                    ]
                },
                "nextNum": 1
            },
            "head": 1,
            "chatHead": -1,
            "publicStatus": false,
            "savedRevisions": []
        },
        "authorId": "a.i2WSCwOkL5ZS19pD",
        "author": "a.i2WSCwOkL5ZS19pD",
        "revs": 1,
        "changeset": "Z:2>1=1*0+1$s"
    }
}

Expected behavior
The hook should provide the padId in the pad object so that it is possible to know which pad was modified.

Server (please complete the following information):

  • Etherpad version: 1.9.1
  • OS: Ubuntu 20.04
  • Node.js version (node --version): v16.20.0
  • npm version (npm --version): 8.19.4

Additional context
Pad was created via the HTTP API. It may be related to the open issues/PR surrounding the appendRevision method. I tried the suggested fix but it did not resolve this issue.

@webzwo0i
Copy link
Member

webzwo0i commented Jul 6, 2023

Cannot reproduce. In your example the "db" key is missing and also the "id" field.
This is how it looks like on my side. Because you have a "body" field I assume you're doing some serialization.

{
  pad: Pad {
    db: {
      db: [Database],
      init: [AsyncFunction (anonymous)],
      shutdown: [AsyncFunction (anonymous)],
      get: [AsyncFunction: get] Function,
      set: [AsyncFunction: set] Function,
      findKeys: [AsyncFunction: findKeys] Function,
      getSub: [AsyncFunction: getSub] Function,
      setSub: [AsyncFunction: setSub] Function,
      remove: [AsyncFunction: remove] Function
    },
    atext: {
      text: 'vnbWelcome to Etherpadf!c\n' +
        '\n' +
        'This pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n' +
        '\n' +
        'Get involved with Etherpad at https://etherpad.org\n' +
        '\n' +
        'Warning: DirtyDB is used. This is not recommended for production. -- To suppress these warning messages change suppressErrorsInPadText to true in your settings.json\n' +
        '\n',
      attribs: '*0+3+j*0+1+1*0+1|8+af'
    },
    pool: AttributePool {
      numToAttrib: [Object],
      attribToNum: [Object],
      nextNum: 1
    },
    head: 5,
    chatHead: -1,
    publicStatus: false,
    id: '-GylVTuDq6n445f4jnMN',
    savedRevisions: []
  },
  authorId: 'a.79CsRs7RLFAsPPxx',
  author: [Getter/Setter],
  revs: 5,
  changeset: 'Z:b3>1*0+1$v'
}

@webzwo0i
Copy link
Member

webzwo0i commented Jul 6, 2023

Do you use padUpdate hook in a public plugin so we can take a look at the code? As seen above it should be context.pad.id

@danielpetri1
Copy link
Author

danielpetri1 commented Jul 6, 2023

Hi, thank you for the swift response. Thanks for the info that the db key was missing too, as this pointed me in the right direction. I am indeed using a public plugin, namely ep_redis_publisher, which explains why "db" is missing.

The events are then read in by BigBlueButton's pads manager with context.pad.id already missing at that point. As you couldn't reproduce it, it's most likely not an Etherpad issue. Sorry for the spam and appreciate your time.

@danielpetri1
Copy link
Author

danielpetri1 commented Jul 10, 2023

I believe the issue is that the Pad class has its own toJSON implementation which removes the id. So when calling e.g. JSON.stringify(), the padId is removed despite being present in the object. Was this an intentional change?

toJSON() {

@danielpetri1
Copy link
Author

Introduced in 79e7697

@SamTV12345
Copy link
Member

True. Id and db are deleted. But it seems like that was also dropped before with a blacklist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs confirmation Stale No recent activity
Projects
None yet
Development

No branches or pull requests

3 participants