# When changing username, it should update mentions in the user's own posts

**URL:** https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372
**Category:** Bug
**Created:** [January 20, 2023, 12:53am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372 "2023-01-20T00:53:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)
#### Post date: [January 20, 2023, 12:53am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372/1 "2023-01-20T00:53:15Z")

</div>

## Description

### Context

When you change the username of a user (e.g. userA to userB), it updates all the @mentions of their username to avoid broken mentions.

@userA → @userB

### Problem

However, it doesn’t seem to update the mentions in the user’s own posts. If userA has a post containing @userA, it doesn’t change that to @userB when their username is changed.

It does update the mentions correctly in other users’ posts.

This also applies when they have been anonymised — the @mentions in their own posts display their original username, while mentions in others’ posts have the new anonymised username.

## Steps to Reproduce

1. Have a user make posts mentioning their own username
2. Change their username or anonymise the user

### Expected

@mentions of their username are updated in their own posts, to reflect the new username

### Actual

@mentions of their username are not updated in their own posts, and stay as the old username

## Extra comments

It’s relatively common enough for users in our forum to refer to themselves in third person (e.g. “you can tag @traceymoko if you have questions”)

You can see other examples here:

[https://forum.gethopscotch.com/t/tagging-yourself-it-does-not-update-what-the-goigly/65317](https://forum.gethopscotch.com/t/tagging-yourself-it-does-not-update-what-the-goigly/65317)

I’m not sure if the @mentions are registered only when other people make the mentions, but I suspect that might be the case. Feel free to set the category depending on whether this behaviour is intended or not — either bug or feature request.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [January 20, 2023, 10:18am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372/2 "2023-01-20T10:18:17Z")

</div>

That’s an interesting one. 🙂

I can confirm that I am also seeing this behaviour:

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/c/a/dcac65a35c8677f0af5bdd3aeebbd868b9d234b4.png)

Let me see what I can find out. 👍

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 20, 2023, 10:53am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372/8 "2023-01-20T10:53:28Z")

</div>

Thank you @traceymoko for your excellent bug report 👏

It’s definitely an edge case we hadn’t considered and we’ll get it fixed.

---

<div class="post-metadata">

### Author: ![selase](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/selase/32/270909_2.png) [@selase](https://meta.discourse.org/u/selase)
#### Post date: [February 6, 2023, 10:41am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372/16 "2023-02-06T10:41:32Z")

</div>

@traceymoko Thanks for the detailed report. This has been fixed.

[https://github.com/discourse/discourse/pull/20071](https://github.com/discourse/discourse/pull/20071)

---

<div class="post-metadata">

### Author: ![traceymoko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/traceymoko/32/483235_2.png) [@traceymoko](https://meta.discourse.org/u/traceymoko)
#### Post date: [February 8, 2023, 1:30am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372/17 "2023-02-08T01:30:25Z")

</div>

Thank you so much! Just wanted to say thanks to our users for posting about this too – I just collated the information.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [February 9, 2023, 10:42am UTC](https://meta.discourse.org/t/when-changing-username-it-should-update-mentions-in-the-users-own-posts/252372/18 "2023-02-09T10:42:50Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
