@@ -58,6 +58,7 @@ import { Caption } from "../typography/Caption";
58
58
import { SettingsSubsectionHeading } from "./shared/SettingsSubsectionHeading" ;
59
59
import SettingsSubsection from "./shared/SettingsSubsection" ;
60
60
import { doesRoomHaveUnreadMessages } from "../../../Unread" ;
61
+ import SettingsFlag from "../elements/SettingsFlag" ;
61
62
62
63
// TODO: this "view" component still has far too much application logic in it,
63
64
// which should be factored out to other files.
@@ -200,6 +201,18 @@ const maximumVectorState = (
200
201
return vectorState ;
201
202
} ;
202
203
204
+ const NotificationActivitySettings = ( ) : JSX . Element => {
205
+ return (
206
+ < div >
207
+ < SettingsFlag name = "Notifications.showbold" level = { SettingLevel . DEVICE } />
208
+ < SettingsFlag name = "Notifications.tac_only_notifications" level = { SettingLevel . DEVICE } />
209
+ </ div >
210
+ ) ;
211
+ } ;
212
+
213
+ /**
214
+ * The old, deprecated notifications tab view, only displayed if the user has the labs flag disabled.
215
+ */
203
216
export default class Notifications extends React . PureComponent < IProps , IState > {
204
217
private settingWatchers : string [ ] ;
205
218
@@ -731,43 +744,10 @@ export default class Notifications extends React.PureComponent<IProps, IState> {
731
744
}
732
745
733
746
private renderCategory ( category : RuleClass ) : ReactNode {
734
- if ( category !== RuleClass . VectorOther && this . isInhibited ) {
747
+ if ( this . isInhibited ) {
735
748
return null ; // nothing to show for the section
736
749
}
737
750
738
- let clearNotifsButton : JSX . Element | undefined ;
739
- if (
740
- category === RuleClass . VectorOther &&
741
- MatrixClientPeg . safeGet ( )
742
- . getRooms ( )
743
- . some ( ( r ) => doesRoomHaveUnreadMessages ( r , true ) )
744
- ) {
745
- clearNotifsButton = (
746
- < AccessibleButton
747
- onClick = { this . onClearNotificationsClicked }
748
- disabled = { this . state . clearingNotifications }
749
- kind = "danger"
750
- className = "mx_UserNotifSettings_clearNotifsButton"
751
- data-testid = "clear-notifications"
752
- >
753
- { _t ( "notifications|mark_all_read" ) }
754
- </ AccessibleButton >
755
- ) ;
756
- }
757
-
758
- if ( category === RuleClass . VectorOther && this . isInhibited ) {
759
- // only render the utility buttons (if needed)
760
- if ( clearNotifsButton ) {
761
- return (
762
- < div className = "mx_UserNotifSettings_floatingSection" >
763
- < div > { _t ( "notifications|class_other" ) } </ div >
764
- { clearNotifsButton }
765
- </ div >
766
- ) ;
767
- }
768
- return null ;
769
- }
770
-
771
751
let keywordComposer : JSX . Element | undefined ;
772
752
if ( category === RuleClass . VectorMentions ) {
773
753
const tags = filterBoolean < string > ( this . state . vectorKeywordRuleInfo ?. rules . map ( ( r ) => r . pattern ) || [ ] ) ;
@@ -842,7 +822,6 @@ export default class Notifications extends React.PureComponent<IProps, IState> {
842
822
< span className = "mx_UserNotifSettings_gridColumnLabel" > { VectorStateToLabel [ VectorState . Loud ] } </ span >
843
823
{ fieldsetRows }
844
824
</ div >
845
- { clearNotifsButton }
846
825
{ keywordComposer }
847
826
</ div >
848
827
) ;
@@ -878,13 +857,34 @@ export default class Notifications extends React.PureComponent<IProps, IState> {
878
857
return < p data-testid = "error-message" > { _t ( "settings|notifications|error_loading" ) } </ p > ;
879
858
}
880
859
860
+ let clearNotifsButton : JSX . Element | undefined ;
861
+ if (
862
+ MatrixClientPeg . safeGet ( )
863
+ . getRooms ( )
864
+ . some ( ( r ) => doesRoomHaveUnreadMessages ( r , true ) )
865
+ ) {
866
+ clearNotifsButton = (
867
+ < AccessibleButton
868
+ onClick = { this . onClearNotificationsClicked }
869
+ disabled = { this . state . clearingNotifications }
870
+ kind = "danger"
871
+ className = "mx_UserNotifSettings_clearNotifsButton"
872
+ data-testid = "clear-notifications"
873
+ >
874
+ { _t ( "notifications|mark_all_read" ) }
875
+ </ AccessibleButton >
876
+ ) ;
877
+ }
878
+
881
879
return (
882
880
< >
883
881
{ this . renderTopSection ( ) }
884
882
{ this . renderCategory ( RuleClass . VectorGlobal ) }
885
883
{ this . renderCategory ( RuleClass . VectorMentions ) }
886
884
{ this . renderCategory ( RuleClass . VectorOther ) }
887
885
{ this . renderTargets ( ) }
886
+ < NotificationActivitySettings />
887
+ { clearNotifsButton }
888
888
</ >
889
889
) ;
890
890
}
0 commit comments