Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-71205

Watchers Mapped Incorrectly for Renamed Users

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • Issue - View
    • None

      Problem Description

      When viewing the list of watchers which includes a renamed user in an issue, the renamed user was seen to be either not showing information or mapped to the wrong user.

      • Not showing information -> Avatar is grey icon with username, not display name
      • Mapped to the wrong user -> Avatar is shown as different user, together with the display name

      And when running the rest api to return watchers, eg:

      It returned the below for cases where user not showing information:

      {"self":"https://example.atlassian.net/rest/api/2/issue/TEST-1/watchers","isWatching":false,"watchCount":1,"watchers":[{"self":"https://example.atlassian.net/rest/api/2/user?accountId=","name":"username","key":"username","emailAddress":"?","avatarUrls":{"48x48":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue","24x24":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue","16x16":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue","32x32":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"},"displayName":"TEST User","active":false,"timeZone":"Asia/Shanghai"}]}
      

      Take note that:

      Where the actual result should be something like the one below:

      {"self":"https://example.atlassian.net/rest/api/2/issue/TEST-1/watchers","isWatching":false,"watchCount":1,"watchers":[{"self":"https://example.atlassian.net/rest/api/2/user?accountId=aaaaaaa-bbbb-cccc","name":"username","key":"username","accountId":"aaaaaaa-bbbb-cccc","emailAddress":"abc@example.com","avatarUrls":{"48x48":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue","24x24":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue","16x16":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue","32x32":"https://avatar-cdn.atlassian.com/d1457b72c3fb323a2671125aef3eab5d?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2Fd1457b72c3fb323a2671125aef3eab5d%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"},"displayName":"TEST User","active":false,"timeZone":"Asia/Shanghai"}]}
      

      For the wrongly mapped user, it returns the result similar to the one above, but for a different user.

      Steps to Replicate

      There isn't a direct way to replicate this issue. Due to, Atlassian Cloud is deprecating username, hence there is no possibility to change username. However, it affects the users that has username changed prior to that.

      Steps to Diagnose

      Support engineer only
      Run a check on the app_user table, the user_key and lower_user_name should have different value:

      id user_key lower_user_name
      10189 abc123 123abc

      In the case of wrongly mapped user:

      id user_key lower_user_name
      10189 abc123 123abc
      10190 123abc 123cde

      Note: the lower_user_name has a similar column value of user_key for another row

      Then check what issue user is watcher:

      select (ji.pkey||'-'||ji.issuenum) as key, ua.association_type, ua.source_name, ua.sink_node_id
      from jiraissue ji, userassociation ua
      where ua.sink_node_id = ji.id
      and ua.association_type = 'WatchIssue'
      and ua.source_name = '<extract from the user_key column from app_user>'
      

      Then run a rest call on the issue retrieving the watcher:
      https://example.atlassian.net/rest/api/2/issue/TEST-1/watchers

      Expected Result

      All values returned correctly

      Actual Result

      Discrepancy viewing the user information and rest api call

      More information

      Based on the example given above, the logic for the mapping should be:

      • Watcher (abc123) mapped to user_key (abc123) which returns (123abc) that should points to the user with username (123abc)

      However, it seems to be having double mapping, hence:

      • Case 1: Watcher (abc123) mapped to user_key (abc123) which returns (123abc), and mapped again for user_key (123abc), returning no result
      • Case 2: Watcher (abc123) mapped to user_key (abc123) which returns (123abc), and mapped again for user_key (123abc), returning (123cde) which mapped to wrong user (if exist)

      Workaround

      None found so far

              shari3 Sree Hari
              rgee Richie Gee (Inactive)
              Votes:
              9 Vote for this issue
              Watchers:
              22 Start watching this issue

                Created:
                Updated:
                Resolved: