🧵 Enable threads by default (#9736)
* Delabs threads * remove threads reload when labs is toggled * Fix ts strict * fix rebase mistake * remove .only * fix pr comments * re-introduce backwards compat * Fix export test * Fix SearchREsultTile test * strict ts
This commit is contained in:
parent
9668a24ca7
commit
2d2755d145
32 changed files with 88 additions and 170 deletions
|
@ -71,11 +71,7 @@ const ReplyInThreadButton = ({ mxEvent, closeMenu }: IReplyInThreadButton) => {
|
|||
if (Boolean(relationType) && relationType !== RelationType.Thread) return null;
|
||||
|
||||
const onClick = (): void => {
|
||||
if (!localStorage.getItem("mx_seen_feature_thread")) {
|
||||
localStorage.setItem("mx_seen_feature_thread", "true");
|
||||
}
|
||||
|
||||
if (!SettingsStore.getValue("feature_thread")) {
|
||||
if (!SettingsStore.getValue("feature_threadstable")) {
|
||||
dis.dispatch({
|
||||
action: Action.ViewUserSettings,
|
||||
initialTabId: UserTab.Labs,
|
||||
|
@ -644,7 +640,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
|
|||
rightClick &&
|
||||
contentActionable &&
|
||||
canSendMessages &&
|
||||
SettingsStore.getValue("feature_thread") &&
|
||||
SettingsStore.getValue("feature_threadstable") &&
|
||||
Thread.hasServerSideSupport &&
|
||||
timelineRenderingType !== TimelineRenderingType.Thread
|
||||
) {
|
||||
|
|
|
@ -56,7 +56,6 @@ import { Key } from "../../../Keyboard";
|
|||
import { ALTERNATE_KEY_NAME } from "../../../accessibility/KeyboardShortcuts";
|
||||
import { UserTab } from "../dialogs/UserTab";
|
||||
import { Action } from "../../../dispatcher/actions";
|
||||
import SdkConfig from "../../../SdkConfig";
|
||||
import { ShowThreadPayload } from "../../../dispatcher/payloads/ShowThreadPayload";
|
||||
import useFavouriteMessages from "../../../hooks/useFavouriteMessages";
|
||||
import { GetRelationsForEvent } from "../rooms/EventTile";
|
||||
|
@ -204,8 +203,7 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
|
|||
|
||||
const relationType = mxEvent?.getRelation()?.rel_type;
|
||||
const hasARelation = !!relationType && relationType !== RelationType.Thread;
|
||||
const firstTimeSeeingThreads = !localStorage.getItem("mx_seen_feature_thread");
|
||||
const threadsEnabled = SettingsStore.getValue("feature_thread");
|
||||
const threadsEnabled = SettingsStore.getValue("feature_threadstable");
|
||||
|
||||
if (!threadsEnabled && !Thread.hasServerSideSupport) {
|
||||
// hide the prompt if the user would only have degraded mode
|
||||
|
@ -217,11 +215,7 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
|
|||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (firstTimeSeeingThreads) {
|
||||
localStorage.setItem("mx_seen_feature_thread", "true");
|
||||
}
|
||||
|
||||
if (!SettingsStore.getValue("feature_thread")) {
|
||||
if (!SettingsStore.getValue("feature_threadstable")) {
|
||||
dis.dispatch({
|
||||
action: Action.ViewUserSettings,
|
||||
initialTabId: UserTab.Labs,
|
||||
|
@ -257,7 +251,7 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
|
|||
</div>
|
||||
{!hasARelation && (
|
||||
<div className="mx_Tooltip_sub">
|
||||
{SettingsStore.getValue("feature_thread")
|
||||
{SettingsStore.getValue("feature_threadstable")
|
||||
? _t("Beta feature")
|
||||
: _t("Beta feature. Click to learn more.")}
|
||||
</div>
|
||||
|
@ -273,7 +267,6 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
|
|||
onContextMenu={onClick}
|
||||
>
|
||||
<ThreadIcon />
|
||||
{firstTimeSeeingThreads && !threadsEnabled && <div className="mx_Indicator" />}
|
||||
</RovingAccessibleTooltipButton>
|
||||
);
|
||||
};
|
||||
|
@ -393,21 +386,6 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
|
|||
private readonly forbiddenThreadHeadMsgType = [MsgType.KeyVerificationRequest];
|
||||
|
||||
private get showReplyInThreadAction(): boolean {
|
||||
if (!SettingsStore.getValue("feature_thread") && !Thread.hasServerSideSupport) {
|
||||
// hide the prompt if the user would only have degraded mode
|
||||
return null;
|
||||
}
|
||||
|
||||
if (
|
||||
!SettingsStore.getBetaInfo("feature_thread") &&
|
||||
!SettingsStore.getValue("feature_thread") &&
|
||||
!SdkConfig.get("show_labs_settings")
|
||||
) {
|
||||
// Hide the beta prompt if there is no UI to enable it,
|
||||
// e.g if config.json disables it and doesn't enable show labs flags
|
||||
return false;
|
||||
}
|
||||
|
||||
const inNotThreadTimeline = this.context.timelineRenderingType !== TimelineRenderingType.Thread;
|
||||
|
||||
const isAllowedMessageType =
|
||||
|
@ -568,7 +546,7 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
|
|||
);
|
||||
}
|
||||
} else if (
|
||||
SettingsStore.getValue("feature_thread") &&
|
||||
SettingsStore.getValue("feature_threadstable") &&
|
||||
// Show thread icon even for deleted messages, but only within main timeline
|
||||
this.context.timelineRenderingType === TimelineRenderingType.Room &&
|
||||
this.props.mxEvent.getThread()
|
||||
|
|
|
@ -297,7 +297,7 @@ export default class RoomHeaderButtons extends HeaderButtons<IProps> {
|
|||
);
|
||||
rightPanelPhaseButtons.set(
|
||||
RightPanelPhases.ThreadPanel,
|
||||
SettingsStore.getValue("feature_thread") ? (
|
||||
SettingsStore.getValue("feature_threadstable") ? (
|
||||
<HeaderButton
|
||||
key={RightPanelPhases.ThreadPanel}
|
||||
name="threadsButton"
|
||||
|
|
|
@ -387,7 +387,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||
}
|
||||
}
|
||||
|
||||
if (SettingsStore.getValue("feature_thread")) {
|
||||
if (SettingsStore.getValue("feature_threadstable")) {
|
||||
this.props.mxEvent.on(ThreadEvent.Update, this.updateThread);
|
||||
|
||||
if (this.thread && !this.supportsThreadNotifications) {
|
||||
|
@ -469,7 +469,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||
if (this.props.showReactions) {
|
||||
this.props.mxEvent.removeListener(MatrixEventEvent.RelationsCreated, this.onReactionsCreated);
|
||||
}
|
||||
if (SettingsStore.getValue("feature_thread")) {
|
||||
if (SettingsStore.getValue("feature_threadstable")) {
|
||||
this.props.mxEvent.off(ThreadEvent.Update, this.updateThread);
|
||||
}
|
||||
this.threadState?.off(NotificationStateEvents.Update, this.onThreadStateUpdate);
|
||||
|
@ -496,7 +496,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
|
|||
};
|
||||
|
||||
private get thread(): Thread | null {
|
||||
if (!SettingsStore.getValue("feature_thread")) {
|
||||
if (!SettingsStore.getValue("feature_threadstable")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ export default class SearchResultTile extends React.Component<IProps> {
|
|||
const layout = SettingsStore.getValue("layout");
|
||||
const isTwelveHour = SettingsStore.getValue("showTwelveHourTimestamps");
|
||||
const alwaysShowTimestamps = SettingsStore.getValue("alwaysShowTimestamps");
|
||||
const threadsEnabled = SettingsStore.getValue("feature_thread");
|
||||
const threadsEnabled = SettingsStore.getValue("feature_threadstable");
|
||||
|
||||
const timeline = result.context.getTimeline();
|
||||
for (let j = 0; j < timeline.length; j++) {
|
||||
|
|
|
@ -436,7 +436,7 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
|
|||
// For initial threads launch, chat effects are disabled
|
||||
// see #19731
|
||||
const isNotThread = this.props.relation?.rel_type !== THREAD_RELATION_TYPE.name;
|
||||
if (!SettingsStore.getValue("feature_thread") || isNotThread) {
|
||||
if (!SettingsStore.getValue("feature_threadstable") || isNotThread) {
|
||||
dis.dispatch({ action: `effects.${effect.command}` });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ export function sendMessage(message: string, isHTML: boolean, { roomContext, mxC
|
|||
// For initial threads launch, chat effects are disabled
|
||||
// see #19731
|
||||
const isNotThread = relation?.rel_type !== THREAD_RELATION_TYPE.name;
|
||||
if (!SettingsStore.getValue("feature_thread") || isNotThread) {
|
||||
if (!SettingsStore.getValue("feature_threadstable") || isNotThread) {
|
||||
dis.dispatch({ action: `effects.${effect.command}` });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue