Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate thread in lab for dinum #698

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"agent2.tchap.incubateur.net",
"externe.tchap.incubateur.net"
],
"feature_space": ["agent1.tchap.incubateur.net", "agent2.tchap.incubateur.net", "externe.tchap.incubateur.net"]
"feature_space": ["agent1.tchap.incubateur.net", "agent2.tchap.incubateur.net", "externe.tchap.incubateur.net"],
"feature_thread": ["agent1.tchap.incubateur.net", "agent2.tchap.incubateur.net", "externe.tchap.incubateur.net"]
}
}
1 change: 1 addition & 0 deletions config.preprod.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"custom_translations_url": "/i18n/tchap_translations.json",
"tchap_features": {
"feature_email_notification": ["i.tchap.gouv.fr", "e.tchap.gouv.fr"],
"feature_thread": ["i.tchap.gouv.fr", "e.tchap.gouv.fr"],
"feature_space": ["i.tchap.gouv.fr", "e.tchap.gouv.fr"]
}
}
1 change: 1 addition & 0 deletions config.prod.lab.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"custom_translations_url": "/i18n/tchap_translations.json",
"tchap_features": {
"feature_email_notification": [],
odelcroi marked this conversation as resolved.
Show resolved Hide resolved
"feature_thread": ["agent.dinum.tchap.gouv.fr"],
"feature_space": ["agent.dinum.tchap.gouv.fr"]
}
}
2 changes: 1 addition & 1 deletion patches/patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"files": [
"src/components/views/context_menus/MessageContextMenu.tsx",
"src/components/views/messages/MessageActionBar.tsx",
"src/components/views/right_panel/RoomHeaderButtons.tsx"
"src/components/views/right_panel/LegacyRoomHeaderButtons.tsx"
]
},
"change-sections-order-in-security-privacy-settings": {
Expand Down
108 changes: 73 additions & 35 deletions patches/remove-thread-buttons/matrix-react-sdk+3.78.0.patch
Original file line number Diff line number Diff line change
@@ -1,52 +1,90 @@
diff --git a/node_modules/matrix-react-sdk/src/components/views/context_menus/MessageContextMenu.tsx b/node_modules/matrix-react-sdk/src/components/views/context_menus/MessageContextMenu.tsx
index ffe35fa..aff8c9b 100644
index ffe35fa..02d0430 100644
--- a/node_modules/matrix-react-sdk/src/components/views/context_menus/MessageContextMenu.tsx
+++ b/node_modules/matrix-react-sdk/src/components/views/context_menus/MessageContextMenu.tsx
@@ -698,7 +698,9 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
@@ -61,6 +61,8 @@ import { getForwardableEvent } from "../../../events/forward/getForwardableEvent
import { getShareableLocationEvent } from "../../../events/location/getShareableLocationEvent";
import { ShowThreadPayload } from "../../../dispatcher/payloads/ShowThreadPayload";
import { CardContext } from "../right_panel/context";
+//:tchap: add feature flags
+import TchapUIFeature from "../../../../../../src/tchap/util/TchapUIFeature";

interface IReplyInThreadButton {
mxEvent: MatrixEvent;
@@ -698,7 +700,10 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
<IconizedContextMenuOptionList>
{reactButton}
{replyButton}
+ {/* :TCHAP: Remove Reply In Thread Button
{replyInThreadButton}
+ end :TCHAP: */}
- {replyInThreadButton}
+ {/* :TCHAP: activate Thread based on homeserver feature flag
+ {replyInThreadButton} */}
+ {TchapUIFeature.isFeatureActiveForHomeserver("feature_thread") ? replyInThreadButton : null}
+ {/*:TCHAP: end */}
{editButton}
</IconizedContextMenuOptionList>
);
diff --git a/node_modules/matrix-react-sdk/src/components/views/messages/MessageActionBar.tsx b/node_modules/matrix-react-sdk/src/components/views/messages/MessageActionBar.tsx
index 6b727c5..aa71892 100644
index 6b727c5..e1ae7ec 100644
--- a/node_modules/matrix-react-sdk/src/components/views/messages/MessageActionBar.tsx
+++ b/node_modules/matrix-react-sdk/src/components/views/messages/MessageActionBar.tsx
@@ -332,18 +332,21 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
private readonly forbiddenThreadHeadMsgType = [MsgType.KeyVerificationRequest];
@@ -55,6 +55,7 @@ import { ShowThreadPayload } from "../../../dispatcher/payloads/ShowThreadPayloa
import { GetRelationsForEvent, IEventTileType } from "../rooms/EventTile";
import { VoiceBroadcastInfoEventType } from "../../../voice-broadcast/types";
import { ButtonEvent } from "../elements/AccessibleButton";
+import TchapUIFeature from "../../../../../../src/tchap/util/TchapUIFeature";

interface IOptionsButtonProps {
mxEvent: MatrixEvent;
@@ -343,7 +344,10 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
!M_BEACON_INFO.matches(this.props.mxEvent.getType()) &&
!(this.props.mxEvent.getType() === VoiceBroadcastInfoEventType);

private get showReplyInThreadAction(): boolean {
- const inNotThreadTimeline = this.context.timelineRenderingType !== TimelineRenderingType.Thread;
-
- const isAllowedMessageType =
- !this.forbiddenThreadHeadMsgType.includes(this.props.mxEvent.getContent().msgtype as MsgType) &&
- /** forbid threads from live location shares
- * until cross-platform support
- * (PSF-1041)
- */
- !M_BEACON_INFO.matches(this.props.mxEvent.getType()) &&
- !(this.props.mxEvent.getType() === VoiceBroadcastInfoEventType);
-
- return inNotThreadTimeline && isAllowedMessageType;
+ // :TCHAP: hide thread button
+ return false;
+ // const inNotThreadTimeline = this.context.timelineRenderingType !== TimelineRenderingType.Thread;
+
+ // const isAllowedMessageType =
+ // !this.forbiddenThreadHeadMsgType.includes(this.props.mxEvent.getContent().msgtype as MsgType) &&
+ // /** forbid threads from live location shares
+ // * until cross-platform support
+ // * (PSF-1041)
+ // */
+ // !M_BEACON_INFO.matches(this.props.mxEvent.getType()) &&
+ // !(this.props.mxEvent.getType() === VoiceBroadcastInfoEventType);
+
+ // return inNotThreadTimeline && isAllowedMessageType;
+ // end :TCHAP
+ //:TCHAP: activate Thread based on homeserver feature flag
+ //return inNotThreadTimeline && isAllowedMessageType;
+ return TchapUIFeature.isFeatureActiveForHomeserver("feature_thread") && inNotThreadTimeline && isAllowedMessageType;
+ //:TCHAP: end
}

/**
diff --git a/node_modules/matrix-react-sdk/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx b/node_modules/matrix-react-sdk/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx
index fa9afb1..f71f2bb 100644
--- a/node_modules/matrix-react-sdk/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx
+++ b/node_modules/matrix-react-sdk/src/components/views/right_panel/LegacyRoomHeaderButtons.tsx
@@ -42,6 +42,7 @@ import { SummarizedNotificationState } from "../../../stores/notifications/Summa
import PosthogTrackers from "../../../PosthogTrackers";
import { ButtonEvent } from "../elements/AccessibleButton";
import { doesRoomOrThreadHaveUnreadMessages } from "../../../Unread";
+import TchapUIFeature from "../../../../../../src/tchap/util/TchapUIFeature";

const ROOM_INFO_PHASES = [
RightPanelPhases.RoomSummary,
@@ -295,9 +296,11 @@ export default class LegacyRoomHeaderButtons extends HeaderButtons<IProps> {
onClick={this.onTimelineCardClicked}
/>,
);
- rightPanelPhaseButtons.set(
- RightPanelPhases.ThreadPanel,
- <HeaderButton
+ //:tchap: activate Thread based on homeserver feature flag
+ if(TchapUIFeature.isFeatureActiveForHomeserver("feature_thread")){
+ rightPanelPhaseButtons.set(
+ RightPanelPhases.ThreadPanel,
+ <HeaderButton
key={RightPanelPhases.ThreadPanel}
name="threadsButton"
data-testid="threadsButton"
@@ -305,10 +308,12 @@ export default class LegacyRoomHeaderButtons extends HeaderButtons<IProps> {
onClick={this.onThreadsPanelClicked}
isHighlighted={this.isPhase(LegacyRoomHeaderButtons.THREAD_PHASES)}
isUnread={this.state.threadNotificationColor > NotificationColor.None}
- >
+ >
<UnreadIndicator color={this.state.threadNotificationColor} />
</HeaderButton>,
);
+ }
+ //:tchap: end
rightPanelPhaseButtons.set(
RightPanelPhases.NotificationPanel,
<HeaderButton