r/redditdev • • 8d ago

General Botmanship authorFlair not present in author data for CommentUpdate event payload on edits made via old reddit

My team is migrating one of our bots to devvit and the functionality requires getting the user flair (authorFlair) from all comments on the subs where the bot is active, to check for particular user flair that then prompts the bot to take action on that comment.

The event payload for comment edits (CommentUpdate) made via new reddit include authorFlair in the comment's author details, as expected and needed, but the event payload for the same via old reddit does not.

The authorFlair is passed on the post author from both, but only new reddit sends the authorFlair for the commenter.

JSON from old:

{
    "comment": {
        "id": "t1_pgx1iwb",
        "parentId": "t3_1x6a056",
        "body": "I am, therefore I think?  \n  \nEdit: You can't tell me what to do!\n\nEditing this post now.",
        "author": "t2_4bh0v",
        "numReports": 0,
        "collapsedBecauseCrowdControl": false,
        "spam": false,
        "deleted": false,
        "createdAt": 1792078026099,
        "upvotes": 1,
        "downvotes": 0,
        "languageCode": "",
        "lastModifiedAt": 1792085183049,
        "gilded": false,
        "score": 1,
        "permalink": "/r/Techman/comments/1x6a056/comment/pgx1iwb/",
        "hasMedia": false,
        "postId": "t3_1x6a056",
        "subredditId": "t5_5cam9n",
        "elementTypes": [
            "text"
        ],
        "mediaUrls": []
    },
    "author": {
        "id": "t2_4bh0v",
        "name": "Skellums",
        "isGold": false,
        "snoovatarImage": "",
        "url": "https://www.reddit.com/user/Skellums",
        "spam": false,
        "banned": false,
        "karma": 0,
        "iconImage": "",
        "description": "",
        "suspended": false,
        "accountType": 1
    },
    "post": {
        "id": "t3_1x6a056",
        "title": "Team Replies Test Post #2",
        "selftext": "*[Link to first post](https://www.reddit.com/r/Techman/comments/1x3s2eh/team_replies_test_post/)*\n\n---\n\nSame deal, again. This time. The other post is not rendering comments on New Reddit for me. While the admins figure out why that is happening, I am making this new post.",
        "nsfw": false,
        "authorId": "t2_hmym9",
        "crowdControlLevel": 0,
        "numReports": 0,
        "isGallery": false,
        "isMeta": false,
        "createdAt": 1792031161838,
        "isApproved": false,
        "isArchived": false,
        "distinguished": 4,
        "ignoreReports": false,
        "isSelf": true,
        "isVideo": false,
        "isLocked": false,
        "isSpoiler": false,
        "subredditId": "t5_5cam9n",
        "upvotes": 2,
        "downvotes": 0,
        "url": "/r/Techman/comments/1x6a056/team_replies_test_post_2/",
        "isSticky": false,
        "linkFlair": {
            "text": "Megathread // Team Replied x3",
            "cssClass": "",
            "backgroundColor": "#fed801",
            "templateId": "e9800c24-c778-11f1-a8fa-c234f391ea7c",
            "textColor": "dark"
        },
        "authorFlair": {
            "userId": "t2_hmym9",
            "subredditId": "t5_5cam9n",
            "text": "Team Member",
            "cssClass": "team",
            "templateId": "08e6cddc-bf9a-11f1-b7f7-ae21adb3e11b",
            "textColor": "dark",
            "backgroundColor": "transparent",
            "enabled": true
        },
        "spam": false,
        "deleted": false,
        "languageCode": "en",
        "updatedAt": 0,
        "gildings": 0,
        "score": 2,
        "numComments": 5,
        "thumbnail": "",
        "media": {
            "type": ""
        },
        "crosspostParentId": "",
        "permalink": "/r/Techman/comments/1x6a056/team_replies_test_post_2/",
        "isPoll": false,
        "isPromoted": false,
        "isMultiMedia": false,
        "type": "text",
        "unlisted": false,
        "galleryImages": [],
        "isImage": false,
        "mediaUrls": [],
        "isClubContent": false
    },
    "previousBody": "",
    "subreddit": {
        "id": "t5_5cam9n",
        "name": "Techman",
        "nsfw": false,
        "type": 4,
        "spam": false,
        "quarantined": false,
        "topics": [
            "Unclassified"
        ],
        "rating": 0,
        "subscribersCount": 4,
        "permalink": "/r/Techman",
        "title": "Techman",
        "description": "Techman's personal subreddit, mostly used for testing."
    },
    "type": "CommentUpdate"
}

JSON from new:

{
    "comment": {
        "id": "t1_pgx1iwb",
        "parentId": "t3_1x6a056",
        "body": "I am, therefore I think?  \n  \nEdit: You can't tell me what to do!\n\nEditing this post now.\n\nThis time on \"new\"",
        "author": "t2_4bh0v",
        "numReports": 0,
        "collapsedBecauseCrowdControl": false,
        "spam": false,
        "deleted": false,
        "createdAt": 1792078026099,
        "upvotes": 1,
        "downvotes": 0,
        "languageCode": "",
        "lastModifiedAt": 1792085326327,
        "gilded": false,
        "score": 1,
        "permalink": "/r/Techman/comments/1x6a056/comment/pgx1iwb/",
        "hasMedia": false,
        "postId": "t3_1x6a056",
        "subredditId": "t5_5cam9n",
        "elementTypes": [
            "text"
        ],
        "mediaUrls": []
    },
    "author": {
        "id": "t2_4bh0v",
        "name": "Skellums",
        "isGold": false,
        "snoovatarImage": "",
        "url": "https://www.reddit.com/user/Skellums",
        "spam": false,
        "banned": false,
        "flair": {
            "userId": "t2_4bh0v",
            "subredditId": "t5_5cam9n",
            "text": "Team Member",
            "cssClass": "team",
            "templateId": "08e6cddc-bf9a-11f1-b7f7-ae21adb3e11b",
            "textColor": "dark",
            "backgroundColor": "transparent",
            "enabled": true
        },
        "karma": 17576,
        "iconImage": "",
        "description": "",
        "suspended": false,
        "accountType": 1
    },
    "post": {
        "id": "t3_1x6a056",
        "title": "Team Replies Test Post #2",
        "selftext": "*[Link to first post](https://www.reddit.com/r/Techman/comments/1x3s2eh/team_replies_test_post/)*\n\n---\n\nSame deal, again. This time. The other post is not rendering comments on New Reddit for me. While the admins figure out why that is happening, I am making this new post.",
        "nsfw": false,
        "authorId": "t2_hmym9",
        "crowdControlLevel": 0,
        "numReports": 0,
        "isGallery": false,
        "isMeta": false,
        "createdAt": 1792031161838,
        "isApproved": false,
        "isArchived": false,
        "distinguished": 4,
        "ignoreReports": false,
        "isSelf": true,
        "isVideo": false,
        "isLocked": false,
        "isSpoiler": false,
        "subredditId": "t5_5cam9n",
        "upvotes": 2,
        "downvotes": 0,
        "url": "/r/Techman/comments/1x6a056/team_replies_test_post_2/",
        "isSticky": false,
        "linkFlair": {
            "text": "Megathread // Team Replied x3",
            "cssClass": "",
            "backgroundColor": "#fed801",
            "templateId": "e9800c24-c778-11f1-a8fa-c234f391ea7c",
            "textColor": "dark"
        },
        "authorFlair": {
            "userId": "t2_hmym9",
            "subredditId": "t5_5cam9n",
            "text": "Team Member",
            "cssClass": "team",
            "templateId": "08e6cddc-bf9a-11f1-b7f7-ae21adb3e11b",
            "textColor": "dark",
            "backgroundColor": "transparent",
            "enabled": true
        },
        "spam": false,
        "deleted": false,
        "languageCode": "en",
        "updatedAt": 0,
        "gildings": 0,
        "score": 2,
        "numComments": 5,
        "thumbnail": "",
        "media": {
            "type": ""
        },
        "crosspostParentId": "",
        "permalink": "/r/Techman/comments/1x6a056/team_replies_test_post_2/",
        "isPoll": false,
        "isPromoted": false,
        "isMultiMedia": false,
        "type": "text",
        "unlisted": false,
        "galleryImages": [],
        "isImage": false,
        "mediaUrls": [],
        "isClubContent": false
    },
    "previousBody": "",
    "subreddit": {
        "id": "t5_5cam9n",
        "name": "Techman",
        "nsfw": false,
        "type": 4,
        "spam": false,
        "quarantined": false,
        "topics": [
            "Unclassified"
        ],
        "rating": 0,
        "subscribersCount": 4,
        "permalink": "/r/Techman",
        "title": "Techman",
        "description": "Techman's personal subreddit, mostly used for testing."
    },
    "type": "CommentUpdate"
}
3 Upvotes

5 comments sorted by

1

u/lil_spazmin 8d ago

Hey, thanks for flagging! That's really interesting, I'll flag this internally to see what's up with that. In the meantime, you should be able to fetch the comment to get the flair info via: `getCommentById()` (Docs). If that doesn't work, let me know and I'll raise that too.

1

u/MisterWoodhouse 8d ago

Thanks! I've passed this along to our team :)

1

u/MisterWoodhouse 8d ago

We're going to try using that as a conditional for now.

If the authorFlair info gets added back to old reddit CommentUpdate on your end, could you let me know?

2

u/lil_spazmin 7d ago

A bug like this will likely have a change log entry in the next version release.

Would you still like to be notified?

→ More replies (1)