mirror of
https://github.com/discourse/discourse.git
synced 2025-05-04 00:14:41 +08:00
UX: allow users to click thread title to open it (#24816)
This commit is contained in:
parent
549513e25d
commit
54724f7c09
@ -27,6 +27,10 @@ export default class ChatMessageThreadIndicator extends Component {
|
|||||||
return this.args.interactiveUser ?? true;
|
return this.args.interactiveUser ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get interactiveThread() {
|
||||||
|
return this.args.interactiveThread ?? true;
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
setup(element) {
|
setup(element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
@ -42,13 +46,15 @@ export default class ChatMessageThreadIndicator extends Component {
|
|||||||
this.element.addEventListener("touchCancel", this.cancelTouch);
|
this.element.addEventListener("touchCancel", this.cancelTouch);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element.addEventListener("mousedown", this.openThread, {
|
if (this.interactiveThread) {
|
||||||
passive: true,
|
this.element.addEventListener("mousedown", this.openThread, {
|
||||||
});
|
passive: true,
|
||||||
|
});
|
||||||
|
|
||||||
this.element.addEventListener("keydown", this.openThread, {
|
this.element.addEventListener("keydown", this.openThread, {
|
||||||
passive: true,
|
passive: true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
@ -64,13 +70,15 @@ export default class ChatMessageThreadIndicator extends Component {
|
|||||||
this.element.removeEventListener("touchCancel", this.cancelTouch);
|
this.element.removeEventListener("touchCancel", this.cancelTouch);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.element.removeEventListener("mousedown", this.openThread, {
|
if (this.interactiveThread) {
|
||||||
passive: true,
|
this.element.removeEventListener("mousedown", this.openThread, {
|
||||||
});
|
passive: true,
|
||||||
|
});
|
||||||
|
|
||||||
this.element.removeEventListener("keydown", this.openThread, {
|
this.element.removeEventListener("keydown", this.openThread, {
|
||||||
passive: true,
|
passive: true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
@ -134,7 +142,7 @@ export default class ChatMessageThreadIndicator extends Component {
|
|||||||
{{willDestroy this.teardown}}
|
{{willDestroy this.teardown}}
|
||||||
role="button"
|
role="button"
|
||||||
title={{i18n "chat.threads.open"}}
|
title={{i18n "chat.threads.open"}}
|
||||||
tabindex="0"
|
tabindex={{if this.interactiveThread "0" "-1"}}
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="chat-message-thread-indicator__last-reply-avatar">
|
<div class="chat-message-thread-indicator__last-reply-avatar">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Component from "@glimmer/component";
|
import Component from "@glimmer/component";
|
||||||
|
import { LinkTo } from "@ember/routing";
|
||||||
import { htmlSafe } from "@ember/template";
|
import { htmlSafe } from "@ember/template";
|
||||||
import replaceEmoji from "discourse/helpers/replace-emoji";
|
import replaceEmoji from "discourse/helpers/replace-emoji";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
@ -16,9 +17,13 @@ export default class ChatThreadTitle extends Component {
|
|||||||
<template>
|
<template>
|
||||||
<div class="chat__thread-title-container">
|
<div class="chat__thread-title-container">
|
||||||
<div class="chat__thread-title">
|
<div class="chat__thread-title">
|
||||||
<span class="chat__thread-title__name">
|
<LinkTo
|
||||||
|
class="chat__thread-title__name"
|
||||||
|
@route="chat.channel.thread"
|
||||||
|
@models={{@thread.routeModels}}
|
||||||
|
>
|
||||||
{{this.title}}
|
{{this.title}}
|
||||||
</span>
|
</LinkTo>
|
||||||
|
|
||||||
<ThreadUnreadIndicator @thread={{@thread}} />
|
<ThreadUnreadIndicator @thread={{@thread}} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -88,6 +88,7 @@ export default class UserThreads extends Component {
|
|||||||
<ThreadIndicator
|
<ThreadIndicator
|
||||||
@message={{thread.originalMessage}}
|
@message={{thread.originalMessage}}
|
||||||
@interactiveUser={{false}}
|
@interactiveUser={{false}}
|
||||||
|
@interactiveThread={{false}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
.chat__thread-title {
|
.chat__thread-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
&__name,
|
||||||
|
&__name:visited {
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
.chat-thread-list-item-unread-indicator {
|
.chat-thread-list-item-unread-indicator {
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,9 @@ module PageObjects
|
|||||||
end
|
end
|
||||||
|
|
||||||
def open_thread(thread)
|
def open_thread(thread)
|
||||||
find(".chat__user-threads__thread-container[data-id='#{thread.id}']").click
|
find(
|
||||||
|
".chat__user-threads__thread-container[data-id='#{thread.id}'] .chat__thread-title__name",
|
||||||
|
).click
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user