# Опыт: когда имперсонация автоматически завершается через некоторое время

**URL:** https://meta.discourse.org/t/experience-when-impersonation-is-terminated-automatically-after-some-time/402252
**Category:** UX
**Tags:** impersonate
**Created:** [05.Май.2026 22:32:17 UTC](https://meta.discourse.org/t/experience-when-impersonation-is-terminated-automatically-after-some-time/402252 "2026-05-05T22:32:17Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![ted](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ted/32/283882_2.png) [@ted](https://meta.discourse.org/u/ted)
#### Post date: [11.Май.2026 03:38:57 UTC](https://meta.discourse.org/t/experience-when-impersonation-is-terminated-automatically-after-some-time/402252/7 "2026-05-11T03:38:57Z")

</div>

@martin Вот первый вариант:

> <https://github.com/discourse/discourse/pull/39871>
>
> \### What is this change?
> 
> This PR adds a countdown to the impersonation banner…, corresponding to the time left out of the allotted time in the site setting. When the countdown reaches 0 impersonation ends.
> 
> As part of this change, I made the \`impersonate#destroy\` endpoint idempotent and visible to all admins, whether they are impersonating or not. This prevents any "unexpected errors" from happening if there's a race to end impersonation.
> 
> \*\*Screenshot:\*\*
> 
> \<img width="537" height="79" alt="Screenshot 2026-05-11 at 11 26 08 AM" src="https://github.com/user-attachments/assets/e44f6ef0-30ec-4050-ad08-e555c0e9f80a" /\>

Я решил сначала реализовать это на фронтенде. У нас там уже есть все необходимые данные. Лучше не начинать возиться с MessageBus.

---

_[View the full topic](https://meta.discourse.org/t/experience-when-impersonation-is-terminated-automatically-after-some-time/402252)._
