Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5d4d182

Browse files
committed
Delabs threads
1 parent 9c5b1f3 commit 5d4d182

30 files changed

+52
-211
lines changed

cypress/e2e/polls/polls.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ describe("Polls", () => {
7777
};
7878

7979
beforeEach(() => {
80-
cy.enableLabsFeature("feature_thread");
8180
cy.window().then((win) => {
8281
win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests
8382
});

cypress/e2e/threads/threads.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ describe("Threads", () => {
2828
let synapse: SynapseInstance;
2929

3030
beforeEach(() => {
31-
// Default threads to ON for this spec
32-
cy.enableLabsFeature("feature_thread");
3331
cy.window().then((win) => {
3432
win.localStorage.setItem("mx_lhs_size", "0"); // Collapse left panel for these tests
3533
});

res/css/views/messages/_MessageActionBar.pcss

-7
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ limitations under the License.
118118
color: $primary-content;
119119
}
120120

121-
&.mx_MessageActionBar_threadButton {
122-
.mx_Indicator {
123-
background: $links;
124-
animation-iteration-count: infinite;
125-
}
126-
}
127-
128121
&.mx_MessageActionBar_favouriteButton_fillstar {
129122
color: var(--MessageActionBar-star-button-color);
130123
}

res/img/betas/threads.png

-85 KB
Binary file not shown.

src/MatrixClientPeg.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
233233
opts.pendingEventOrdering = PendingEventOrdering.Detached;
234234
opts.lazyLoadMembers = true;
235235
opts.clientWellKnownPollPeriod = 2 * 60 * 60; // 2 hours
236-
opts.experimentalThreadSupport = SettingsStore.getValue("feature_thread");
236+
opts.experimentalThreadSupport = true;
237237

238238
if (SettingsStore.getValue("feature_sliding_sync")) {
239239
const proxyUrl = SettingsStore.getValue("feature_sliding_sync_proxy_url");

src/components/structures/MessagePanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export default class MessagePanel extends React.Component<IProps, IState> {
287287
// and we check this in a hot code path. This is also cached in our
288288
// RoomContext, however we still need a fallback for roomless MessagePanels.
289289
this._showHiddenEvents = SettingsStore.getValue("showHiddenEventsInTimeline");
290-
this.threadsEnabled = SettingsStore.getValue("feature_thread");
290+
this.threadsEnabled = SettingsStore.getValue("feature_threadstable");
291291

292292
this.showTypingNotificationsWatcherRef = SettingsStore.watchSetting(
293293
"showTypingNotifications",

src/components/structures/RoomSearchView.tsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import ResizeNotifier from "../../utils/ResizeNotifier";
3333
import MatrixClientContext from "../../contexts/MatrixClientContext";
3434
import { RoomPermalinkCreator } from "../../utils/permalinks/Permalinks";
3535
import RoomContext from "../../contexts/RoomContext";
36+
import SettingsStore from "../../settings/SettingsStore";
3637

3738
const DEBUG = false;
3839
let debuglog = function (msg: string) {};
@@ -98,7 +99,7 @@ export const RoomSearchView = forwardRef<ScrollPanel, Props>(
9899
return b.length - a.length;
99100
});
100101

101-
if (client.supportsExperimentalThreads()) {
102+
if (SettingsStore.getValue("feature_threadstable")) {
102103
// Process all thread roots returned in this batch of search results
103104
// XXX: This won't work for results coming from Seshat which won't include the bundled relationship
104105
for (const result of results.results) {
@@ -109,12 +110,7 @@ export const RoomSearchView = forwardRef<ScrollPanel, Props>(
109110
);
110111
if (!bundledRelationship || event.getThread()) continue;
111112
const room = client.getRoom(event.getRoomId());
112-
const thread = room.findThreadForEvent(event);
113-
if (thread) {
114-
event.setThread(thread);
115-
} else {
116-
room.createThread(event.getId(), event, [], true);
117-
}
113+
room.createThread(event.getId(), event, [], true);
118114
}
119115
}
120116
}

src/components/structures/RoomView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
11771177
CHAT_EFFECTS.forEach((effect) => {
11781178
if (containsEmoji(ev.getContent(), effect.emojis) || ev.getContent().msgtype === effect.msgType) {
11791179
// For initial threads launch, chat effects are disabled see #19731
1180-
if (!SettingsStore.getValue("feature_thread") || !ev.isRelation(THREAD_RELATION_TYPE.name)) {
1180+
if (!SettingsStore.getValue("feature_threadstable") || !ev.isRelation(THREAD_RELATION_TYPE.name)) {
11811181
dis.dispatch({ action: `effects.${effect.command}` });
11821182
}
11831183
}

src/components/structures/ThreadPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ const ThreadPanel: React.FC<IProps> = ({ roomId, onClose, permalinkCreator }) =>
249249
const openFeedback = shouldShowFeedback()
250250
? () => {
251251
Modal.createDialog(BetaFeedbackDialog, {
252-
featureId: "feature_thread",
252+
featureId: "feature_threadstable",
253253
});
254254
}
255255
: null;

src/components/structures/TimelinePanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
16831683
is very tied to the main room timeline, we are forcing the timeline to
16841684
send read receipts for threaded events */
16851685
const isThreadTimeline = this.context.timelineRenderingType === TimelineRenderingType.Thread;
1686-
if (SettingsStore.getValue("feature_thread") && isThreadTimeline) {
1686+
if (SettingsStore.getValue("feature_threadstable") && isThreadTimeline) {
16871687
return 0;
16881688
}
16891689
const index = this.state.events.findIndex((ev) => ev.getId() === evId);

src/components/views/context_menus/MessageContextMenu.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ const ReplyInThreadButton = ({ mxEvent, closeMenu }: IReplyInThreadButton) => {
7171
if (Boolean(relationType) && relationType !== RelationType.Thread) return null;
7272

7373
const onClick = (): void => {
74-
if (!localStorage.getItem("mx_seen_feature_thread")) {
75-
localStorage.setItem("mx_seen_feature_thread", "true");
74+
if (!localStorage.getItem("mx_seen_feature_threadstable")) {
75+
localStorage.setItem("mx_seen_feature_threadstable", "true");
7676
}
7777

78-
if (!SettingsStore.getValue("feature_thread")) {
78+
if (!SettingsStore.getValue("feature_threadstable")) {
7979
dis.dispatch({
8080
action: Action.ViewUserSettings,
8181
initialTabId: UserTab.Labs,
@@ -644,7 +644,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
644644
rightClick &&
645645
contentActionable &&
646646
canSendMessages &&
647-
SettingsStore.getValue("feature_thread") &&
647+
SettingsStore.getValue("feature_threadstable") &&
648648
Thread.hasServerSideSupport &&
649649
timelineRenderingType !== TimelineRenderingType.Thread
650650
) {

src/components/views/messages/MessageActionBar.tsx

+3-25
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import { Key } from "../../../Keyboard";
5656
import { ALTERNATE_KEY_NAME } from "../../../accessibility/KeyboardShortcuts";
5757
import { UserTab } from "../dialogs/UserTab";
5858
import { Action } from "../../../dispatcher/actions";
59-
import SdkConfig from "../../../SdkConfig";
6059
import { ShowThreadPayload } from "../../../dispatcher/payloads/ShowThreadPayload";
6160
import useFavouriteMessages from "../../../hooks/useFavouriteMessages";
6261
import { GetRelationsForEvent } from "../rooms/EventTile";
@@ -204,8 +203,7 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
204203

205204
const relationType = mxEvent?.getRelation()?.rel_type;
206205
const hasARelation = !!relationType && relationType !== RelationType.Thread;
207-
const firstTimeSeeingThreads = !localStorage.getItem("mx_seen_feature_thread");
208-
const threadsEnabled = SettingsStore.getValue("feature_thread");
206+
const threadsEnabled = SettingsStore.getValue("feature_threadstable");
209207

210208
if (!threadsEnabled && !Thread.hasServerSideSupport) {
211209
// hide the prompt if the user would only have degraded mode
@@ -217,11 +215,7 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
217215
e.preventDefault();
218216
e.stopPropagation();
219217

220-
if (firstTimeSeeingThreads) {
221-
localStorage.setItem("mx_seen_feature_thread", "true");
222-
}
223-
224-
if (!SettingsStore.getValue("feature_thread")) {
218+
if (!SettingsStore.getValue("feature_threadstable")) {
225219
dis.dispatch({
226220
action: Action.ViewUserSettings,
227221
initialTabId: UserTab.Labs,
@@ -273,7 +267,6 @@ const ReplyInThreadButton = ({ mxEvent }: IReplyInThreadButton) => {
273267
onContextMenu={onClick}
274268
>
275269
<ThreadIcon />
276-
{firstTimeSeeingThreads && !threadsEnabled && <div className="mx_Indicator" />}
277270
</RovingAccessibleTooltipButton>
278271
);
279272
};
@@ -393,21 +386,6 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
393386
private readonly forbiddenThreadHeadMsgType = [MsgType.KeyVerificationRequest];
394387

395388
private get showReplyInThreadAction(): boolean {
396-
if (!SettingsStore.getValue("feature_thread") && !Thread.hasServerSideSupport) {
397-
// hide the prompt if the user would only have degraded mode
398-
return null;
399-
}
400-
401-
if (
402-
!SettingsStore.getBetaInfo("feature_thread") &&
403-
!SettingsStore.getValue("feature_thread") &&
404-
!SdkConfig.get("show_labs_settings")
405-
) {
406-
// Hide the beta prompt if there is no UI to enable it,
407-
// e.g if config.json disables it and doesn't enable show labs flags
408-
return false;
409-
}
410-
411389
const inNotThreadTimeline = this.context.timelineRenderingType !== TimelineRenderingType.Thread;
412390

413391
const isAllowedMessageType =
@@ -568,7 +546,7 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
568546
);
569547
}
570548
} else if (
571-
SettingsStore.getValue("feature_thread") &&
549+
SettingsStore.getValue("feature_threadstable") &&
572550
// Show thread icon even for deleted messages, but only within main timeline
573551
this.context.timelineRenderingType === TimelineRenderingType.Room &&
574552
this.props.mxEvent.getThread()

src/components/views/right_panel/RoomHeaderButtons.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ export default class RoomHeaderButtons extends HeaderButtons<IProps> {
297297
);
298298
rightPanelPhaseButtons.set(
299299
RightPanelPhases.ThreadPanel,
300-
SettingsStore.getValue("feature_thread") ? (
300+
SettingsStore.getValue("feature_threadstable") ? (
301301
<HeaderButton
302302
key={RightPanelPhases.ThreadPanel}
303303
name="threadsButton"

src/components/views/rooms/EventTile.tsx

+4-15
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
387387
}
388388
}
389389

390-
if (SettingsStore.getValue("feature_thread")) {
390+
if (SettingsStore.getValue("feature_threadstable")) {
391391
this.props.mxEvent.on(ThreadEvent.Update, this.updateThread);
392392

393393
if (this.thread && !this.supportsThreadNotifications) {
@@ -469,7 +469,7 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
469469
if (this.props.showReactions) {
470470
this.props.mxEvent.removeListener(MatrixEventEvent.RelationsCreated, this.onReactionsCreated);
471471
}
472-
if (SettingsStore.getValue("feature_thread")) {
472+
if (SettingsStore.getValue("feature_threadstable")) {
473473
this.props.mxEvent.off(ThreadEvent.Update, this.updateThread);
474474
}
475475
this.threadState?.off(NotificationStateEvents.Update, this.onThreadStateUpdate);
@@ -496,22 +496,11 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
496496
};
497497

498498
private get thread(): Thread | null {
499-
if (!SettingsStore.getValue("feature_thread")) {
499+
if (!SettingsStore.getValue("feature_threadstable")) {
500500
return null;
501501
}
502502

503-
let thread = this.props.mxEvent.getThread();
504-
/**
505-
* Accessing the threads value through the room due to a race condition
506-
* that will be solved when there are proper backend support for threads
507-
* We currently have no reliable way to discover than an event is a thread
508-
* when we are at the sync stage
509-
*/
510-
if (!thread) {
511-
const room = MatrixClientPeg.get().getRoom(this.props.mxEvent.getRoomId());
512-
thread = room?.findThreadForEvent(this.props.mxEvent);
513-
}
514-
return thread ?? null;
503+
return this.props.mxEvent.getThread() ?? null;
515504
}
516505

517506
private renderThreadPanelSummary(): JSX.Element | null {

src/components/views/rooms/SearchResultTile.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default class SearchResultTile extends React.Component<IProps> {
6767
const layout = SettingsStore.getValue("layout");
6868
const isTwelveHour = SettingsStore.getValue("showTwelveHourTimestamps");
6969
const alwaysShowTimestamps = SettingsStore.getValue("alwaysShowTimestamps");
70-
const threadsEnabled = SettingsStore.getValue("feature_thread");
70+
const threadsEnabled = SettingsStore.getValue("feature_threadstable");
7171

7272
const timeline = result.context.getTimeline();
7373
for (let j = 0; j < timeline.length; j++) {

src/components/views/rooms/SendMessageComposer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
436436
// For initial threads launch, chat effects are disabled
437437
// see #19731
438438
const isNotThread = this.props.relation?.rel_type !== THREAD_RELATION_TYPE.name;
439-
if (!SettingsStore.getValue("feature_thread") || isNotThread) {
439+
if (!SettingsStore.getValue("feature_threadstable") || isNotThread) {
440440
dis.dispatch({ action: `effects.${effect.command}` });
441441
}
442442
}

src/components/views/rooms/wysiwyg_composer/utils/message.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function sendMessage(message: string, isHTML: boolean, { roomContext, mxC
108108
// For initial threads launch, chat effects are disabled
109109
// see #19731
110110
const isNotThread = relation?.rel_type !== THREAD_RELATION_TYPE.name;
111-
if (!SettingsStore.getValue("feature_thread") || isNotThread) {
111+
if (!SettingsStore.getValue("feature_threadstable") || isNotThread) {
112112
dis.dispatch({ action: `effects.${effect.command}` });
113113
}
114114
}

src/i18n/strings/en_EN.json

+3-9
Original file line numberDiff line numberDiff line change
@@ -915,15 +915,7 @@
915915
"In rooms that support moderation, the “Report” button will let you report abuse to room moderators.": "In rooms that support moderation, the “Report” button will let you report abuse to room moderators.",
916916
"Render LaTeX maths in messages": "Render LaTeX maths in messages",
917917
"Message Pinning": "Message Pinning",
918-
"Threaded messaging": "Threaded messaging",
919-
"Keep discussions organised with threads.": "Keep discussions organised with threads.",
920-
"Threads help keep conversations on-topic and easy to track. <a>Learn more</a>.": "Threads help keep conversations on-topic and easy to track. <a>Learn more</a>.",
921-
"How can I start a thread?": "How can I start a thread?",
922-
"Use “%(replyInThread)s” when hovering over a message.": "Use “%(replyInThread)s” when hovering over a message.",
923-
"Reply in thread": "Reply in thread",
924-
"How can I leave the beta?": "How can I leave the beta?",
925-
"To leave, return to this page and use the “%(leaveTheBeta)s” button.": "To leave, return to this page and use the “%(leaveTheBeta)s” button.",
926-
"Leave the beta": "Leave the beta",
918+
"Threaded messages": "Threaded messages",
927919
"Rich text editor": "Rich text editor",
928920
"Use rich text instead of Markdown in the message composer. Plain text mode coming soon.": "Use rich text instead of Markdown in the message composer. Plain text mode coming soon.",
929921
"Render simple counters in room header": "Render simple counters in room header",
@@ -2322,6 +2314,7 @@
23222314
"Error processing audio message": "Error processing audio message",
23232315
"View live location": "View live location",
23242316
"React": "React",
2317+
"Reply in thread": "Reply in thread",
23252318
"Can't create a thread from an event with an existing relation": "Can't create a thread from an event with an existing relation",
23262319
"Beta feature": "Beta feature",
23272320
"Beta feature. Click to learn more.": "Beta feature. Click to learn more.",
@@ -3198,6 +3191,7 @@
31983191
"Beta": "Beta",
31993192
"Leaving the beta will reload %(brand)s.": "Leaving the beta will reload %(brand)s.",
32003193
"Joining the beta will reload %(brand)s.": "Joining the beta will reload %(brand)s.",
3194+
"Leave the beta": "Leave the beta",
32013195
"Join the beta": "Join the beta",
32023196
"Updated %(humanizedUpdateTime)s": "Updated %(humanizedUpdateTime)s",
32033197
"Live until %(expiryTime)s": "Live until %(expiryTime)s",

src/settings/Settings.tsx

+3-47
Original file line numberDiff line numberDiff line change
@@ -255,57 +255,13 @@ export const SETTINGS: { [setting: string]: ISetting } = {
255255
supportedLevels: LEVELS_FEATURE,
256256
default: false,
257257
},
258-
"feature_thread": {
258+
"feature_threadstable": {
259259
isFeature: true,
260260
labsGroup: LabGroup.Messaging,
261261
controller: new ThreadBetaController(),
262-
displayName: _td("Threaded messaging"),
262+
displayName: _td("Threaded messages"),
263263
supportedLevels: LEVELS_FEATURE,
264-
default: false,
265-
betaInfo: {
266-
title: _td("Threads"),
267-
caption: () => (
268-
<>
269-
<p>{_t("Keep discussions organised with threads.")}</p>
270-
<p>
271-
{_t(
272-
"Threads help keep conversations on-topic and easy to track. <a>Learn more</a>.",
273-
{},
274-
{
275-
a: (sub) => (
276-
<a href="https://element.io/help#threads" rel="noreferrer noopener" target="_blank">
277-
{sub}
278-
</a>
279-
),
280-
},
281-
)}
282-
</p>
283-
</>
284-
),
285-
faq: () =>
286-
SdkConfig.get().bug_report_endpoint_url && (
287-
<>
288-
<h4>{_t("How can I start a thread?")}</h4>
289-
<p>
290-
{_t("Use “%(replyInThread)s” when hovering over a message.", {
291-
replyInThread: _t("Reply in thread"),
292-
})}
293-
</p>
294-
<h4>{_t("How can I leave the beta?")}</h4>
295-
<p>
296-
{_t("To leave, return to this page and use the “%(leaveTheBeta)s” button.", {
297-
leaveTheBeta: _t("Leave the beta"),
298-
})}
299-
</p>
300-
</>
301-
),
302-
feedbackLabel: "thread-feedback",
303-
feedbackSubheading: _td(
304-
"Thank you for trying the beta, " + "please go into as much detail as you can so we can improve it.",
305-
),
306-
image: require("../../res/img/betas/threads.png"),
307-
requiresRefresh: true,
308-
},
264+
default: true,
309265
},
310266
"feature_wysiwyg_composer": {
311267
isFeature: true,

src/stores/TypingStore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default class TypingStore {
6565
if (SettingsStore.getValue("lowBandwidth")) return;
6666
// Disable typing notification for threads for the initial launch
6767
// before we figure out a better user experience for them
68-
if (SettingsStore.getValue("feature_thread") && threadId) return;
68+
if (SettingsStore.getValue("feature_threadstable") && threadId) return;
6969

7070
let currentTyping = this.typingStates[roomId];
7171
if ((!isTyping && !currentTyping) || (currentTyping && currentTyping.isTyping === isTyping)) {

0 commit comments

Comments
 (0)