FIX: correctly check the user id of the original message (#26805)

Followup: write a test for this
This commit is contained in:
Joffrey JAFFEUX 2024-04-29 13:34:49 +02:00 committed by GitHub
parent 143f06f2c6
commit 271ca2c968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import ThreadSettingsModal from "discourse/plugins/chat/discourse/components/cha
import { THREAD_TITLE_PROMPT_THRESHOLD } from "discourse/plugins/chat/discourse/lib/chat-constants";
import UserChatThreadMembership from "discourse/plugins/chat/discourse/models/user-chat-thread-membership";
export default class ShowThreadTitlePrompt extends Component {
export default class ChatThreadTitlePrompt extends Component {
@service chatApi;
@service modal;
@service toasts;
@ -66,7 +66,7 @@ export default class ShowThreadTitlePrompt extends Component {
get canShowToast() {
if (
this.site.desktopView ||
(this.args.thread.user_id !== this.currentUser.id &&
(this.args.thread.originalMessage?.user?.id !== this.currentUser.id &&
!this.currentUser.admin)
) {
return false;

View File

@ -12,7 +12,7 @@ import { resetIdle } from "discourse/lib/desktop-notifications";
import { NotificationLevels } from "discourse/lib/notification-levels";
import discourseDebounce from "discourse-common/lib/debounce";
import { bind } from "discourse-common/utils/decorators";
import ShowThreadTitlePrompt from "discourse/plugins/chat/discourse/components/chat-thread-title-prompt";
import ChatThreadTitlePrompt from "discourse/plugins/chat/discourse/components/chat-thread-title-prompt";
import firstVisibleMessageId from "discourse/plugins/chat/discourse/helpers/first-visible-message-id";
import ChatChannelThreadSubscriptionManager from "discourse/plugins/chat/discourse/lib/chat-channel-thread-subscription-manager";
import {
@ -584,7 +584,7 @@ export default class ChatThread extends Component {
{{/if}}
<ChatUploadDropZone @model={{@thread}} />
<ShowThreadTitlePrompt @thread={{@thread}} />
<ChatThreadTitlePrompt @thread={{@thread}} />
</div>
</template>
}