botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
83 stars 91 forks source link

[BUG] some updated_at columns are never updated #1590

Open laurentlp opened 2 years ago

laurentlp commented 2 years ago

Describe the bug Some tables contain created_at and updated_at columns. Values for those columns are set during insertion but updated_at is never changed upon updates.

There are probably some tables that only contain those two columns in order to be able to sort on the created_at column. In this case, we could probably ignore updating updated_at.

Here are some tables that we should update properly:

Table Names
srv_channel_users
strategy_

To Reproduce Steps to reproduce the behavior:

<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>

<body>
  <script src="http://localhost:3000/assets/modules/channel-web/inject.js"></script>
  <script>
    window.botpressWebChat.init({
      host: "http://localhost:3000",
      botId: "test"
    });

    window.addEventListener("message", (event) => {
      if (event.data && event.data.name === "webchatLoaded") {
        window.botpressWebChat.mergeConfig({
          layoutWidth: "100%",
          userId: 'abcdeffd'
        });

        window.botpressWebChat.sendEvent({ type: "show" });
      }
    });
  </script>
</body>
</html>
  1. Copy the HTML code above into an index.html file
  2. Start Botpress 12.26.7+
  3. Make sure that the botId exists
  4. Open the file in any browser
  5. Check the newly added column in srv_channel_users
  6. Edit the userId and then refresh the page
  7. The attributes in srv_channel_users will be updated but not the updated_at column

Expected behavior This column should be updated.

Environment (please complete the following information):

On pretty much any version of Botpress

allardy commented 2 years ago

Ah... attribute methods just don't update the field.. it should. image