szurubooru icon indicating copy to clipboard operation
szurubooru copied to clipboard

Bug: [object Object] in Suggested tags

Open joshuaavalon opened this issue 5 years ago • 5 comments

default

Version: cbf67587e29565a4783a49c506f23b2e5cfe49d0

Response of tag-siblings:

{
  "results": [
    {
      "tag": {
        "names": [
          "りゅうおうのおしごと!",
          "ryuuou_no_oshigoto"
        ],
        "category": "parody",
        "version": 3,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.406514Z",
        "lastEditTime": "2018-08-21T17:10:22.082239Z",
        "usages": 39,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 12
    },
    {
      "tag": {
        "names": [
          "しらび"
        ],
        "category": "artist",
        "version": 3,
        "description": "[Pixiv](https://www.pixiv.net/member.php?id=216403)",
        "creationTime": "2018-08-25T02:47:53.197206Z",
        "lastEditTime": "2018-08-25T03:05:13.951180Z",
        "usages": 29,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 9
    },
    {
      "tag": {
        "names": [
          "ロリ"
        ],
        "category": "attribute",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-22T16:32:42.266738Z",
        "lastEditTime": "2018-08-22T16:33:17.373051Z",
        "usages": 35,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 5
    },
    {
      "tag": {
        "names": [
          "清滝桂香"
        ],
        "category": "character",
        "version": 3,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.417333Z",
        "lastEditTime": "2018-08-21T16:07:59.310537Z",
        "usages": 6,
        "suggestions": [],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 4
    },
    {
      "tag": {
        "names": [
          "雛鶴あい"
        ],
        "category": "character",
        "version": 4,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.412083Z",
        "lastEditTime": "2018-08-25T02:54:03.293630Z",
        "usages": 22,
        "suggestions": [
          {
            "names": [
              "ロリ"
            ],
            "category": "attribute",
            "usages": 35
          }
        ],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 4
    },
    {
      "tag": {
        "names": [
          "九頭竜八一"
        ],
        "category": "character",
        "version": 3,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.409427Z",
        "lastEditTime": "2018-08-21T16:07:37.495244Z",
        "usages": 8,
        "suggestions": [],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 2
    },
    {
      "tag": {
        "names": [
          "水着"
        ],
        "category": "attribute",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-24T17:04:18.804387Z",
        "lastEditTime": "2018-08-24T17:05:19.466880Z",
        "usages": 6,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 2
    },
    {
      "tag": {
        "names": [
          "gatari"
        ],
        "category": "artist",
        "version": 2,
        "description": "[Pixiv](https://www.pixiv.net/member.php?id=10703413)",
        "creationTime": "2018-08-25T03:27:16.891623Z",
        "lastEditTime": "2018-08-25T03:29:03.123851Z",
        "usages": 1,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "なにこれかわいい"
        ],
        "category": "default",
        "version": 1,
        "description": null,
        "creationTime": "2018-08-22T16:47:48.993991Z",
        "lastEditTime": null,
        "usages": 4,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "まったく、小学生は最高だぜ!!"
        ],
        "category": "default",
        "version": 1,
        "description": null,
        "creationTime": "2018-08-21T16:46:56.580059Z",
        "lastEditTime": null,
        "usages": 7,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "ろうか"
        ],
        "category": "artist",
        "version": 2,
        "description": "[Pixiv](https://www.pixiv.net/member.php?id=23677722)",
        "creationTime": "2018-08-25T03:24:17.921852Z",
        "lastEditTime": "2018-08-25T03:24:47.823032Z",
        "usages": 1,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "シャルロット・イゾアール"
        ],
        "category": "character",
        "version": 4,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.427922Z",
        "lastEditTime": "2018-08-25T02:56:31.476851Z",
        "usages": 2,
        "suggestions": [
          {
            "names": [
              "ロリ"
            ],
            "category": "attribute",
            "usages": 35
          }
        ],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "セーラー服"
        ],
        "category": "attribute",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-25T03:22:51.690376Z",
        "lastEditTime": "2018-08-25T03:24:53.557759Z",
        "usages": 1,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "タイツ越しのパンツ"
        ],
        "category": "default",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-25T03:28:37.743850Z",
        "lastEditTime": "2018-08-25T03:30:15.536805Z",
        "usages": 1,
        "suggestions": [
          {
            "names": [
              "白タイツ"
            ],
            "category": "attribute",
            "usages": 1
          },
          {
            "names": [
              "黒タイツ"
            ],
            "category": "attribute",
            "usages": 2
          }
        ],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "夜叉神天衣",
          "神戸のシンデレラ"
        ],
        "category": "character",
        "version": 5,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.419873Z",
        "lastEditTime": "2018-08-25T03:11:23.070603Z",
        "usages": 7,
        "suggestions": [
          {
            "names": [
              "ロリ"
            ],
            "category": "attribute",
            "usages": 35
          }
        ],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "水越澪"
        ],
        "category": "character",
        "version": 4,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.422665Z",
        "lastEditTime": "2018-08-25T02:56:34.644788Z",
        "usages": 2,
        "suggestions": [
          {
            "names": [
              "ロリ"
            ],
            "category": "attribute",
            "usages": 35
          }
        ],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "裾上げタイツ脱ぎ"
        ],
        "category": "default",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-25T03:28:37.746907Z",
        "lastEditTime": "2018-08-25T03:30:11.294341Z",
        "usages": 2,
        "suggestions": [
          {
            "names": [
              "白タイツ"
            ],
            "category": "attribute",
            "usages": 1
          },
          {
            "names": [
              "黒タイツ"
            ],
            "category": "attribute",
            "usages": 2
          }
        ],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "貞任綾乃"
        ],
        "category": "character",
        "version": 4,
        "description": null,
        "creationTime": "2018-08-21T16:04:36.425250Z",
        "lastEditTime": "2018-08-25T02:56:37.823994Z",
        "usages": 2,
        "suggestions": [
          {
            "names": [
              "ロリ"
            ],
            "category": "attribute",
            "usages": 35
          }
        ],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "赤面"
        ],
        "category": "attribute",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-21T16:53:05.727805Z",
        "lastEditTime": "2018-08-21T16:53:53.890647Z",
        "usages": 7,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "足指"
        ],
        "category": "attribute",
        "version": 2,
        "description": null,
        "creationTime": "2018-08-25T03:28:37.750168Z",
        "lastEditTime": "2018-08-25T03:29:44.398876Z",
        "usages": 1,
        "suggestions": [],
        "implications": []
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "釈迦堂里奈",
          "永遠の女王“エターナルクイーン”"
        ],
        "category": "character",
        "version": 4,
        "description": null,
        "creationTime": "2018-08-25T03:06:21.712184Z",
        "lastEditTime": "2018-08-25T03:14:38.444133Z",
        "usages": 1,
        "suggestions": [],
        "implications": [
          {
            "names": [
              "りゅうおうのおしごと!",
              "ryuuou_no_oshigoto"
            ],
            "category": "parody",
            "usages": 39
          }
        ]
      },
      "occurrences": 1
    },
    {
      "tag": {
        "names": [
          "黒タイツ"
        ],
        "category": "attribute",
        "version": 4,
        "description": null,
        "creationTime": "2018-08-25T03:27:16.894537Z",
        "lastEditTime": "2018-08-25T03:30:37.305025Z",
        "usages": 2,
        "suggestions": [
          {
            "names": [
              "タイツ越しのパンツ"
            ],
            "category": "default",
            "usages": 1
          },
          {
            "names": [
              "裾上げタイツ脱ぎ"
            ],
            "category": "default",
            "usages": 2
          }
        ],
        "implications": []
      },
      "occurrences": 1
    }
  ]
}

Edit: But inspecting the tag in Chrome, the value of the [object Object] is

{
  "value": "りゅうおうのおしごと!",
  "done": false
}

The tag I click has a implications on りゅうおうのおしごと!

Edit2: It seems that it only show when I first adding tags to the images. It does not seem to show up when the tag is added.

joshuaavalon avatar Aug 25 '18 03:08 joshuaavalon

@rr- I have just investigate more about this problem.

I am able to reproduce it consistently with the following steps:

  1. Create a new post
  2. Edit the post
  3. Add a existing tag
  4. Click on the tag for suggestion

After some debugging, I believe the following lines are causing the problem.

https://github.com/rr-/szurubooru/blob/6510d0750c504ffc728966cce334db9544b35bcb/client/js/controls/tag_input_control.js#L344-L346

These lines add a [object Object] with score 5.0. There may be some other root causes to this but I don't understand the purpose of these lines. The for-loop above already added all the suggested tags.

joshuaavalon avatar Feb 05 '19 05:02 joshuaavalon

Siblings != suggestions. As far as I recall, a tag sibling for a given tag X is any tag that is used in the same posts with X. So let's say you have three posts:

  • Post 1 (tag A, B)
  • Post 2 (tag A, C)
  • Post 3 (tag B, C, D)

Tag A siblings should be B, C. Tag B siblings should be A, C, D. Tag C siblings should be A, B, D. Tag D siblings should be B, C.

Each of these tags can have its own manual suggestions specified in the tag edit form which take priority over the autosuggestions computed basing on tag siblings.

I'm guessing the root of the problem is that at some point the tag suggestions array started to hold tag instances rather than just tag names, possibly when I've added support for tag aliases.

rr- avatar Feb 05 '19 08:02 rr-

Hi, even tho this issue is pretty old by now, but did anyone find a solution for this issue?

Anbosuki avatar Jan 07 '23 13:01 Anbosuki

hiya, i just encountered this one myself!

vernilla avatar Aug 14 '23 00:08 vernilla

Hello, I investigated this a bit more today and found out the following.

As @joshuaavalon already investigated the following lines do cause the problem:

https://github.com/rr-/szurubooru/blob/7c92ceaf6ae1ec3a6cebb094f179055708fe1d55/client/js/controls/tag_input_control.js#L388-L390

The content of the suggestion variable is something like the following:

{
    "eventTarget":{
        
    },
    "_orig":{
        "_suggestions":{
            "eventTarget":{
                
            },
            "_list":[
                
            ]
        },
        "_implications":{
            "eventTarget":{
                
            },
            "_list":[
                
            ]
        },
        "_origName":"<Suggestion tag>",
        "_names":[
            "<Suggestion tag>"
        ],
        "_category":"<Suggestion category>",
        "_postCount":123
    },
    "_suggestions":{
        "eventTarget":{
            
        },
        "_list":[
            
        ]
    },
    "_implications":{
        "eventTarget":{
            
        },
        "_list":[
            
        ]
    },
    "_origName":"<Suggestion tag>",
    "_names":[
        "<Suggestion tag>"
    ],
    "_category":"<Suggestion category>",
    "_postCount":123
}

To fix this replace the line 389 with the following content:

this._suggestions.set(suggestion._origName, 5);

@rr- I don't know if this is the best/permanent solution, I only investigated it using JSON.stringify() to get an overview of the object. However I tested it successfully on my instance.

I hope I could help :)

Anbosuki avatar Nov 14 '23 18:11 Anbosuki