Improve Threads beta around degraded mode (#8318)
* Hide MAB Threads prompt if user would have degraded mode * Confirm user wants to enable Threads beta if in degraded mode * fix * Fix copy
This commit is contained in:
parent
b8013fc52a
commit
7a1a2c41d2
6 changed files with 85 additions and 11 deletions
|
@ -20,6 +20,7 @@ import React, { ReactElement, useContext, useEffect } from 'react';
|
|||
import { EventStatus, MatrixEvent, MatrixEventEvent } from 'matrix-js-sdk/src/models/event';
|
||||
import classNames from 'classnames';
|
||||
import { MsgType, RelationType } from 'matrix-js-sdk/src/@types/event';
|
||||
import { Thread } from 'matrix-js-sdk/src/models/thread';
|
||||
|
||||
import type { Relations } from 'matrix-js-sdk/src/models/relations';
|
||||
import { _t } from '../../../languageHandler';
|
||||
|
@ -164,11 +165,16 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
|
|||
|
||||
const relationType = mxEvent?.getRelation()?.rel_type;
|
||||
const hasARelation = !!relationType && relationType !== RelationType.Thread;
|
||||
const firstTimeSeeingThreads = localStorage.getItem("mx_seen_feature_thread") === null &&
|
||||
!SettingsStore.getValue("feature_thread");
|
||||
const firstTimeSeeingThreads = !localStorage.getItem("mx_seen_feature_thread");
|
||||
const threadsEnabled = SettingsStore.getValue("feature_thread");
|
||||
|
||||
if (!threadsEnabled && !Thread.hasServerSideSupport) {
|
||||
// hide the prompt if the user would only have degraded mode
|
||||
return null;
|
||||
}
|
||||
|
||||
const onClick = (): void => {
|
||||
if (localStorage.getItem("mx_seen_feature_thread") === null) {
|
||||
if (firstTimeSeeingThreads) {
|
||||
localStorage.setItem("mx_seen_feature_thread", "true");
|
||||
}
|
||||
|
||||
|
@ -219,7 +225,7 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
|
|||
|
||||
onClick={onClick}
|
||||
>
|
||||
{ firstTimeSeeingThreads && (
|
||||
{ firstTimeSeeingThreads && !threadsEnabled && (
|
||||
<div className="mx_Indicator" />
|
||||
) }
|
||||
</RovingAccessibleTooltipButton>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue