Editing a topic link does not change its featured_link

Steps to reproduce:

  1. Create topic with a link (e.g. https://www.youtube.com/watch?v=f4zyjLyBp64).

    Resultant /t/{topic_id}.json:

    {
        "post_stream": {
            "posts": [{
                "id": 3755,
                "name": "",
                "username": "ggg",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png",
                "created_at": "2019-07-15T17:36:47.424Z",
                "cooked": "\u003cdiv class=\"lazyYT\" data-youtube-id=\"f4zyjLyBp64\" data-youtube-title=\"Bueller Bueller Bueller\" data-width=\"480\" data-height=\"270\" data-parameters=\"feature=oembed\u0026amp;wmode=opaque\"\u003e\u003c/div\u003e",
                "post_number": 1,
                "post_type": 1,
                "updated_at": "2019-07-15T17:36:47.424Z",
                "reply_count": 0,
                "reply_to_post_number": null,
                "quote_count": 0,
                "incoming_link_count": 0,
                "reads": 1,
                "score": 0,
                "yours": true,
                "topic_id": 1386,
                "topic_slug": "bug-test-changing-featured-link",
                "display_username": "",
                "primary_group_name": null,
                "primary_group_flair_url": null,
                "primary_group_flair_bg_color": null,
                "primary_group_flair_color": null,
                "version": 1,
                "can_edit": true,
                "can_delete": false,
                "can_recover": false,
                "can_wiki": false,
                "link_counts": [{
                    "url": "https://www.youtube.com/watch?v=f4zyjLyBp64",
                    "internal": false,
                    "reflection": false,
                    "title": "YouTube",
                    "clicks": 0
                }],
                "read": true,
                "user_title": null,
                "actions_summary": [{
                    "id": 3,
                    "can_act": true
                }, {
                    "id": 4,
                    "can_act": true
                }, {
                    "id": 8,
                    "can_act": true
                }, {
                    "id": 7,
                    "can_act": true
                }],
                "moderator": false,
                "admin": false,
                "staff": false,
                "user_id": 128,
                "hidden": false,
                "trust_level": 1,
                "deleted_at": null,
                "user_deleted": false,
                "edit_reason": null,
                "can_view_edit_history": true,
                "wiki": false,
                "user_created_at": "2019-07-15T17:28:10.782Z",
                "user_date_of_birth": null,
                "can_accept_answer": false,
                "can_unaccept_answer": false,
                "accepted_answer": false
            }],
            "stream": [3755]
        },
        "timeline_lookup": [
            [1, 0]
        ],
        "suggested_topics": [{
            "id": 1367,
            "title": "A káromkodásról és csúnya beszédről",
            "fancy_title": "A káromkodásról és csúnya beszédről",
            "slug": "a-karomkodasrol-es-csunya-beszedrol",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:14.863Z",
            "last_posted_at": "2019-07-15T10:21:14.914Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:14.914Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 6,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1368,
            "title": "Diós, csokis masala kávé",
            "fancy_title": "Diós, csokis masala kávé",
            "slug": "dios-csokis-masala-kave",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:23.947Z",
            "last_posted_at": "2019-07-15T10:21:23.995Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:23.995Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 4,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1369,
            "title": "Káposztás pizza",
            "fancy_title": "Káposztás pizza",
            "slug": "kaposztas-pizza",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:32.935Z",
            "last_posted_at": "2019-07-15T10:21:32.994Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:32.994Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 5,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1370,
            "title": "Kávékoncentrátum házilag",
            "fancy_title": "Kávékoncentrátum házilag",
            "slug": "kavekoncentratum-hazilag",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:42.923Z",
            "last_posted_at": "2019-07-15T10:21:42.966Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:42.966Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 6,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1374,
            "title": "Hopper Express Shuttle",
            "fancy_title": "Hopper Express Shuttle",
            "slug": "hopper-express-shuttle",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T11:58:40.198Z",
            "last_posted_at": "2019-07-15T11:58:40.256Z",
            "bumped": true,
            "bumped_at": "2019-07-15T11:58:40.256Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": ["hopper-express"],
            "archetype": "regular",
            "like_count": 0,
            "views": 8,
            "category_id": 1,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 121,
                    "username": "anmoses",
                    "name": "Ashley Moses",
                    "avatar_template": "https://avatars.discourse.org/v4/letter/a/958977/{size}.png"
                }
            }]
        }],
        "tags": [],
        "id": 1386,
        "title": "Bug Test: Changing featured_link",
        "fancy_title": "Bug Test: Changing featured_link",
        "posts_count": 1,
        "created_at": "2019-07-15T17:36:47.370Z",
        "views": 1,
        "reply_count": 0,
        "like_count": 0,
        "last_posted_at": "2019-07-15T17:36:47.424Z",
        "visible": true,
        "closed": false,
        "archived": false,
        "has_summary": false,
        "archetype": "regular",
        "slug": "bug-test-changing-featured-link",
        "category_id": 4,
        "word_count": 7,
        "deleted_at": null,
        "user_id": 128,
        "featured_link": "https://www.youtube.com/watch?v=f4zyjLyBp64",
        "featured_link_root_domain": "youtube.com",
        "pinned_globally": false,
        "pinned_at": null,
        "pinned_until": null,
        "draft": null,
        "draft_key": "topic_1386",
        "draft_sequence": 1,
        "posted": true,
        "unpinned": null,
        "pinned": false,
        "current_post_number": 1,
        "highest_post_number": 1,
        "last_read_post_number": 1,
        "last_read_post_id": 3755,
        "deleted_by": null,
        "actions_summary": [{
            "id": 4,
            "count": 0,
            "hidden": false,
            "can_act": true
        }, {
            "id": 8,
            "count": 0,
            "hidden": false,
            "can_act": true
        }, {
            "id": 7,
            "count": 0,
            "hidden": false,
            "can_act": true
        }],
        "chunk_size": 20,
        "bookmarked": false,
        "topic_timer": null,
        "private_topic_timer": null,
        "message_bus_last_id": 11,
        "participant_count": 1,
        "can_vote": false,
        "vote_count": null,
        "user_voted": false,
        "details": {
            "notification_level": 3,
            "notifications_reason_id": 1,
            "can_edit": true,
            "can_delete": true,
            "can_create_post": true,
            "can_reply_as_new_topic": true,
            "can_flag_topic": true,
            "participants": [{
                "id": 128,
                "username": "ggg",
                "name": "",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png",
                "post_count": 1,
                "primary_group_name": null,
                "primary_group_flair_url": null,
                "primary_group_flair_color": null,
                "primary_group_flair_bg_color": null
            }],
            "created_by": {
                "id": 128,
                "username": "ggg",
                "name": "",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png"
            },
            "last_poster": {
                "id": 128,
                "username": "ggg",
                "name": "",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png"
            }
        }
    }
    
  2. Edit the topic and change its link (e.g. https://www.youtube.com/watch?v=GhIBZzxPB1c).

    Resultant /t/{topic_id}.json:

    {
        "post_stream": {
            "posts": [{
                "id": 3755,
                "name": "",
                "username": "ggg",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png",
                "created_at": "2019-07-15T17:36:47.424Z",
                "cooked": "\u003cdiv class=\"lazyYT\" data-youtube-id=\"GhIBZzxPB1c\" data-youtube-title=\"Okily Dokily\" data-width=\"480\" data-height=\"270\" data-parameters=\"feature=oembed\u0026amp;wmode=opaque\"\u003e\u003c/div\u003e",
                "post_number": 1,
                "post_type": 1,
                "updated_at": "2019-07-15T17:38:43.302Z",
                "reply_count": 0,
                "reply_to_post_number": null,
                "quote_count": 0,
                "incoming_link_count": 0,
                "reads": 1,
                "score": 0,
                "yours": true,
                "topic_id": 1386,
                "topic_slug": "bug-test-changing-featured-link",
                "display_username": "",
                "primary_group_name": null,
                "primary_group_flair_url": null,
                "primary_group_flair_bg_color": null,
                "primary_group_flair_color": null,
                "version": 1,
                "can_edit": true,
                "can_delete": false,
                "can_recover": false,
                "can_wiki": false,
                "link_counts": [{
                    "url": "https://www.youtube.com/watch?v=GhIBZzxPB1c",
                    "internal": false,
                    "reflection": false,
                    "title": "YouTube",
                    "clicks": 0
                }],
                "read": true,
                "user_title": null,
                "actions_summary": [{
                    "id": 3,
                    "can_act": true
                }, {
                    "id": 4,
                    "can_act": true
                }, {
                    "id": 8,
                    "can_act": true
                }, {
                    "id": 7,
                    "can_act": true
                }],
                "moderator": false,
                "admin": false,
                "staff": false,
                "user_id": 128,
                "hidden": false,
                "trust_level": 1,
                "deleted_at": null,
                "user_deleted": false,
                "edit_reason": null,
                "can_view_edit_history": true,
                "wiki": false,
                "user_created_at": "2019-07-15T17:28:10.782Z",
                "user_date_of_birth": null,
                "can_accept_answer": false,
                "can_unaccept_answer": false,
                "accepted_answer": false
            }],
            "stream": [3755]
        },
        "timeline_lookup": [
            [1, 0]
        ],
        "suggested_topics": [{
            "id": 1365,
            "title": "Szezámos káposzta",
            "fancy_title": "Szezámos káposzta",
            "slug": "szezamos-kaposzta",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:20:51.167Z",
            "last_posted_at": "2019-07-15T10:20:51.260Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:20:51.260Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 6,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1367,
            "title": "A káromkodásról és csúnya beszédről",
            "fancy_title": "A káromkodásról és csúnya beszédről",
            "slug": "a-karomkodasrol-es-csunya-beszedrol",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:14.863Z",
            "last_posted_at": "2019-07-15T10:21:14.914Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:14.914Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 6,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1368,
            "title": "Diós, csokis masala kávé",
            "fancy_title": "Diós, csokis masala kávé",
            "slug": "dios-csokis-masala-kave",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:23.947Z",
            "last_posted_at": "2019-07-15T10:21:23.995Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:23.995Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 4,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1369,
            "title": "Káposztás pizza",
            "fancy_title": "Káposztás pizza",
            "slug": "kaposztas-pizza",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T10:21:32.935Z",
            "last_posted_at": "2019-07-15T10:21:32.994Z",
            "bumped": true,
            "bumped_at": "2019-07-15T10:21:32.994Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": [],
            "archetype": "regular",
            "like_count": 0,
            "views": 5,
            "category_id": 13,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 58,
                    "username": "zogstrip",
                    "name": "Régis Hanol",
                    "avatar_template": "/user_avatar/try.discourse.org/zogstrip/{size}/220_2.png"
                }
            }]
        }, {
            "id": 1372,
            "title": "Bethesda Shuttle",
            "fancy_title": "Bethesda Shuttle",
            "slug": "bethesda-shuttle",
            "posts_count": 1,
            "reply_count": 0,
            "highest_post_number": 1,
            "image_url": null,
            "created_at": "2019-07-15T11:53:22.215Z",
            "last_posted_at": "2019-07-15T11:53:22.276Z",
            "bumped": true,
            "bumped_at": "2019-07-15T12:12:09.804Z",
            "unseen": false,
            "pinned": false,
            "unpinned": null,
            "visible": true,
            "closed": false,
            "archived": false,
            "bookmarked": null,
            "liked": null,
            "tags": ["after-school-carpool"],
            "archetype": "regular",
            "like_count": 0,
            "views": 9,
            "category_id": 1,
            "featured_link": null,
            "has_accepted_answer": false,
            "posters": [{
                "extras": "latest single",
                "description": "Original Poster, Most Recent Poster",
                "user": {
                    "id": 121,
                    "username": "anmoses",
                    "name": "Ashley Moses",
                    "avatar_template": "https://avatars.discourse.org/v4/letter/a/958977/{size}.png"
                }
            }]
        }],
        "tags": [],
        "id": 1386,
        "title": "Bug Test: Changing featured_link",
        "fancy_title": "Bug Test: Changing featured_link",
        "posts_count": 1,
        "created_at": "2019-07-15T17:36:47.370Z",
        "views": 1,
        "reply_count": 0,
        "like_count": 0,
        "last_posted_at": "2019-07-15T17:36:47.424Z",
        "visible": true,
        "closed": false,
        "archived": false,
        "has_summary": false,
        "archetype": "regular",
        "slug": "bug-test-changing-featured-link",
        "category_id": 4,
        "word_count": 7,
        "deleted_at": null,
        "user_id": 128,
        "featured_link": "https://www.youtube.com/watch?v=f4zyjLyBp64",
        "featured_link_root_domain": "youtube.com",
        "pinned_globally": false,
        "pinned_at": null,
        "pinned_until": null,
        "draft": null,
        "draft_key": "topic_1386",
        "draft_sequence": 4,
        "posted": true,
        "unpinned": null,
        "pinned": false,
        "current_post_number": 1,
        "highest_post_number": 1,
        "last_read_post_number": 1,
        "last_read_post_id": 3755,
        "deleted_by": null,
        "actions_summary": [{
            "id": 4,
            "count": 0,
            "hidden": false,
            "can_act": true
        }, {
            "id": 8,
            "count": 0,
            "hidden": false,
            "can_act": true
        }, {
            "id": 7,
            "count": 0,
            "hidden": false,
            "can_act": true
        }],
        "chunk_size": 20,
        "bookmarked": false,
        "topic_timer": null,
        "private_topic_timer": null,
        "message_bus_last_id": 13,
        "participant_count": 1,
        "can_vote": false,
        "vote_count": null,
        "user_voted": false,
        "details": {
            "notification_level": 3,
            "notifications_reason_id": 1,
            "can_edit": true,
            "can_delete": true,
            "can_create_post": true,
            "can_reply_as_new_topic": true,
            "can_flag_topic": true,
            "participants": [{
                "id": 128,
                "username": "ggg",
                "name": "",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png",
                "post_count": 1,
                "primary_group_name": null,
                "primary_group_flair_url": null,
                "primary_group_flair_color": null,
                "primary_group_flair_bg_color": null
            }],
            "created_by": {
                "id": 128,
                "username": "ggg",
                "name": "",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png"
            },
            "last_poster": {
                "id": 128,
                "username": "ggg",
                "name": "",
                "avatar_template": "/user_avatar/try.discourse.org/ggg/{size}/642_2.png"
            }
        }
    }
    
  3. Notice that link_counts correctly includes the new URL (https://www.youtube.com/watch?v=GhIBZzxPB1c), but the featured_link is still set to the original URL (https://www.youtube.com/watch?v=f4zyjLyBp64).

4 Likes

I have created pull request to fix this issue:
https://github.com/discourse/discourse/pull/7915

3 Likes

PR has been merged. This topic can be closed I think. :smile:

2 Likes