Merge pull request #4047 from matrix-org/t3chguy/hide_typing_notifs

Add setting to allow hiding of typing indicator
This commit is contained in:
Michael Telatynski 2020-02-10 18:01:52 +00:00 committed by GitHub
commit b9db0ad013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 1 deletions

View file

@ -115,6 +115,7 @@ export default class MessagePanel extends React.Component {
// previous positions the read marker has been in, so we can // previous positions the read marker has been in, so we can
// display 'ghost' read markers that are animating away // display 'ghost' read markers that are animating away
ghostReadMarkers: [], ghostReadMarkers: [],
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
}; };
// opaque readreceipt info for each userId; used by ReadReceiptMarker // opaque readreceipt info for each userId; used by ReadReceiptMarker
@ -164,6 +165,9 @@ export default class MessagePanel extends React.Component {
this._readMarkerNode = createRef(); this._readMarkerNode = createRef();
this._whoIsTyping = createRef(); this._whoIsTyping = createRef();
this._scrollPanel = createRef(); this._scrollPanel = createRef();
this._showTypingNotificationsWatcherRef =
SettingsStore.watchSetting("showTypingNotifications", this.onShowTypingNotificationsChange);
} }
componentDidMount() { componentDidMount() {
@ -172,6 +176,7 @@ export default class MessagePanel extends React.Component {
componentWillUnmount() { componentWillUnmount() {
this._isMounted = false; this._isMounted = false;
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
@ -184,6 +189,12 @@ export default class MessagePanel extends React.Component {
} }
} }
onShowTypingNotificationsChange = () => {
this.setState({
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
});
};
/* get the DOM node representing the given event */ /* get the DOM node representing the given event */
getNodeForEventId(eventId) { getNodeForEventId(eventId) {
if (!this.eventNodes) { if (!this.eventNodes) {
@ -921,7 +932,7 @@ export default class MessagePanel extends React.Component {
); );
let whoIsTyping; let whoIsTyping;
if (this.props.room && !this.props.tileShape) { if (this.props.room && !this.props.tileShape && this.state.showTypingNotifications) {
whoIsTyping = (<WhoIsTypingTile whoIsTyping = (<WhoIsTypingTile
room={this.props.room} room={this.props.room}
onShown={this._onTypingShown} onShown={this._onTypingShown}

View file

@ -32,6 +32,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
]; ];
static TIMELINE_SETTINGS = [ static TIMELINE_SETTINGS = [
'showTypingNotifications',
'autoplayGifsAndVideos', 'autoplayGifsAndVideos',
'urlPreviewsEnabled', 'urlPreviewsEnabled',
'TextualBody.enableBigEmoji', 'TextualBody.enableBigEmoji',

View file

@ -397,6 +397,7 @@
"Show avatars in user and room mentions": "Show avatars in user and room mentions", "Show avatars in user and room mentions": "Show avatars in user and room mentions",
"Enable big emoji in chat": "Enable big emoji in chat", "Enable big emoji in chat": "Enable big emoji in chat",
"Send typing notifications": "Send typing notifications", "Send typing notifications": "Send typing notifications",
"Show typing notifications": "Show typing notifications",
"Automatically replace plain text Emoji": "Automatically replace plain text Emoji", "Automatically replace plain text Emoji": "Automatically replace plain text Emoji",
"Mirror local video feed": "Mirror local video feed", "Mirror local video feed": "Mirror local video feed",
"Enable Community Filter Panel": "Enable Community Filter Panel", "Enable Community Filter Panel": "Enable Community Filter Panel",

View file

@ -263,6 +263,11 @@ export const SETTINGS = {
default: true, default: true,
invertedSettingName: 'dontSendTypingNotifications', invertedSettingName: 'dontSendTypingNotifications',
}, },
"showTypingNotifications": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td("Show typing notifications"),
default: true,
},
"MessageComposerInput.autoReplaceEmoji": { "MessageComposerInput.autoReplaceEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Automatically replace plain text Emoji'), displayName: _td('Automatically replace plain text Emoji'),