Merge pull request #3005 from matrix-org/jryans/notif-error

Only show reactions in main message timeline
This commit is contained in:
J. Ryan Stinnett 2019-05-22 09:15:04 +01:00 committed by GitHub
commit 4b4d09266e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View file

@ -96,6 +96,9 @@ module.exports = React.createClass({
// helper function to access relations for an event // helper function to access relations for an event
getRelationsForEvent: PropTypes.func, getRelationsForEvent: PropTypes.func,
// whether to show reactions for an event
showReactions: PropTypes.bool,
}, },
componentWillMount: function() { componentWillMount: function() {
@ -541,6 +544,7 @@ module.exports = React.createClass({
last={last} last={last}
isSelectedEvent={highlight} isSelectedEvent={highlight}
getRelationsForEvent={this.props.getRelationsForEvent} getRelationsForEvent={this.props.getRelationsForEvent}
showReactions={this.props.showReactions}
/> />
</li>, </li>,
); );

View file

@ -1832,6 +1832,7 @@ module.exports = React.createClass({
membersLoaded={this.state.membersLoaded} membersLoaded={this.state.membersLoaded}
permalinkCreator={this._getPermalinkCreatorForRoom(this.state.room)} permalinkCreator={this._getPermalinkCreatorForRoom(this.state.room)}
resizeNotifier={this.props.resizeNotifier} resizeNotifier={this.props.resizeNotifier}
showReactions={true}
/>); />);
let topUnreadMessagesBar = null; let topUnreadMessagesBar = null;

View file

@ -106,6 +106,9 @@ const TimelinePanel = React.createClass({
// placeholder text to use if the timeline is empty // placeholder text to use if the timeline is empty
empty: PropTypes.string, empty: PropTypes.string,
// whether to show reactions for an event
showReactions: PropTypes.bool,
}, },
statics: { statics: {
@ -1261,6 +1264,7 @@ const TimelinePanel = React.createClass({
resizeNotifier={this.props.resizeNotifier} resizeNotifier={this.props.resizeNotifier}
getRelationsForEvent={this.getRelationsForEvent} getRelationsForEvent={this.getRelationsForEvent}
editEvent={this.state.editEvent} editEvent={this.state.editEvent}
showReactions={this.props.showReactions}
/> />
); );
}, },

View file

@ -160,8 +160,11 @@ module.exports = withMatrixClient(React.createClass({
// show twelve hour timestamps // show twelve hour timestamps
isTwelveHour: PropTypes.bool, isTwelveHour: PropTypes.bool,
// helper function to access relations for an event // helper function to access relations for this event
getRelationsForEvent: PropTypes.func, getRelationsForEvent: PropTypes.func,
// whether to show reactions for this event
showReactions: PropTypes.bool,
}, },
getDefaultProps: function() { getDefaultProps: function() {
@ -198,7 +201,7 @@ module.exports = withMatrixClient(React.createClass({
const client = this.props.matrixClient; const client = this.props.matrixClient;
client.on("deviceVerificationChanged", this.onDeviceVerificationChanged); client.on("deviceVerificationChanged", this.onDeviceVerificationChanged);
this.props.mxEvent.on("Event.decrypted", this._onDecrypted); this.props.mxEvent.on("Event.decrypted", this._onDecrypted);
if (SettingsStore.isFeatureEnabled("feature_reactions")) { if (this.props.showReactions && SettingsStore.isFeatureEnabled("feature_reactions")) {
this.props.mxEvent.on("Event.relationsCreated", this._onReactionsCreated); this.props.mxEvent.on("Event.relationsCreated", this._onReactionsCreated);
} }
}, },
@ -223,7 +226,7 @@ module.exports = withMatrixClient(React.createClass({
const client = this.props.matrixClient; const client = this.props.matrixClient;
client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged); client.removeListener("deviceVerificationChanged", this.onDeviceVerificationChanged);
this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted); this.props.mxEvent.removeListener("Event.decrypted", this._onDecrypted);
if (SettingsStore.isFeatureEnabled("feature_reactions")) { if (this.props.showReactions && SettingsStore.isFeatureEnabled("feature_reactions")) {
this.props.mxEvent.removeListener("Event.relationsCreated", this._onReactionsCreated); this.props.mxEvent.removeListener("Event.relationsCreated", this._onReactionsCreated);
} }
}, },
@ -485,6 +488,7 @@ module.exports = withMatrixClient(React.createClass({
getReactions() { getReactions() {
if ( if (
!this.props.showReactions ||
!this.props.getRelationsForEvent || !this.props.getRelationsForEvent ||
!SettingsStore.isFeatureEnabled("feature_reactions") !SettingsStore.isFeatureEnabled("feature_reactions")
) { ) {