FIX: Rewind: replace currentUser with user (#36742)

We had a few places where we were referring to `currentUser` instead of
the user being viewed. This was resulting in some wrong info being shown
when viewing someone else's rewind.
This commit is contained in:
Kris
2025-12-16 19:59:33 -05:00
committed by GitHub
parent e39d4027d9
commit 705f47f5d6
4 changed files with 8 additions and 17 deletions
@@ -3,13 +3,10 @@ import { get } from "@ember/helper";
import { action } from "@ember/object";
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
import { service } from "@ember/service";
import number from "discourse/helpers/number";
import { i18n } from "discourse-i18n";
export default class AiUsage extends Component {
@service currentUser;
matrixInterval = null;
get totalRequests() {
@@ -114,7 +111,7 @@ export default class AiUsage extends Component {
<div class="matrix-subhead">
{{i18n
"discourse_rewind.reports.ai_usage.wake_up"
username=this.currentUser.username
username=@user.username
}}
</div>
{{i18n "discourse_rewind.reports.ai_usage.system_title"}}
@@ -1,6 +1,5 @@
import Component from "@glimmer/component";
import { concat } from "@ember/helper";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import avatar from "discourse/helpers/avatar";
import number from "discourse/helpers/number";
@@ -40,8 +39,6 @@ const UserMessage = <template>
</template>;
export default class ChatUsage extends Component {
@service currentUser;
get favoriteChannels() {
return this.args.report.data.favorite_channels ?? [];
}
@@ -82,7 +79,7 @@ export default class ChatUsage extends Component {
</div>
<div class="chat-message --right">
<UserMessage @user={{this.currentUser}} @replyKey="reply_1" />
<UserMessage @user={{@user}} @replyKey="reply_1" />
</div>
<div class="chat-message --left">
@@ -98,7 +95,7 @@ export default class ChatUsage extends Component {
</div>
<div class="chat-message --right">
<UserMessage @user={{this.currentUser}} @replyKey="reply_2" />
<UserMessage @user={{@user}} @replyKey="reply_2" />
</div>
<div class="chat-message --left">
@@ -113,7 +110,7 @@ export default class ChatUsage extends Component {
</div>
<div class="chat-message --right">
<UserMessage @user={{this.currentUser}} @replyKey="reply_3" />
<UserMessage @user={{@user}} @replyKey="reply_3" />
</div>
<div class="chat-message --left">
@@ -154,7 +151,7 @@ export default class ChatUsage extends Component {
{{/if}}
<div class="chat-message --right">
<UserMessage @user={{this.currentUser}}>
<UserMessage @user={{@user}}>
<img
src={{getURL
"/plugins/discourse-rewind/images/dancing_baby.gif"
@@ -1,14 +1,11 @@
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import DButton from "discourse/components/d-button";
import { i18n } from "discourse-i18n";
export default class TimeOfDayActivity extends Component {
@service currentUser;
@tracked isPlaying = false;
@tracked playbackProgress = 0;
@tracked isGlitching = false;
@@ -57,7 +54,7 @@ export default class TimeOfDayActivity extends Component {
}
get personalizedAudioParams() {
const username = this.currentUser?.username || "default";
const username = this.args.user?.username || "default";
// convert username to seed
const hash = (str) => {
@@ -164,7 +164,7 @@ export default class Rewind extends Component {
@action
async copyRewindLink() {
await clipboardCopy(
getAbsoluteURL(`/u/${this.currentUser.username}/activity/rewind`)
getAbsoluteURL(`/u/${this.args.user.username}/activity/rewind`)
);
this.toasts.success({
duration: "short",
@@ -376,7 +376,7 @@ export default class Rewind extends Component {
}}
{{#if ReportComponent}}
<div class={{concatClass "rewind-report" report.identifier}}>
<ReportComponent @report={{report}} />
<ReportComponent @report={{report}} @user={{@user}} />
</div>
{{/if}}
{{/let}}