Merge pull request #3234 from matrix-org/jryans/v1.4.0/rm-reactions-edits-flags

Remove feature flags for reactions and edits
This commit is contained in:
J. Ryan Stinnett 2019-07-18 10:28:57 +01:00 committed by GitHub
commit adc2648b46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 44 deletions

View file

@ -208,9 +208,6 @@ class MatrixClientPeg {
} }
_createClient(creds: MatrixClientCreds) { _createClient(creds: MatrixClientCreds) {
const aggregateRelations = SettingsStore.isFeatureEnabled("feature_reactions");
const enableEdits = SettingsStore.isFeatureEnabled("feature_message_editing");
const opts = { const opts = {
baseUrl: creds.homeserverUrl, baseUrl: creds.homeserverUrl,
idBaseUrl: creds.identityServerUrl, idBaseUrl: creds.identityServerUrl,
@ -220,7 +217,7 @@ class MatrixClientPeg {
timelineSupport: true, timelineSupport: true,
forceTURN: !SettingsStore.getValue('webRtcAllowPeerToPeer', false), forceTURN: !SettingsStore.getValue('webRtcAllowPeerToPeer', false),
verificationMethods: [verificationMethods.SAS], verificationMethods: [verificationMethods.SAS],
unstableClientRelationAggregation: aggregateRelations || enableEdits, unstableClientRelationAggregation: true,
}; };
this.matrixClient = createMatrixClient(opts); this.matrixClient = createMatrixClient(opts);

View file

@ -110,7 +110,6 @@ module.exports = React.createClass({
}, },
componentWillMount: function() { componentWillMount: function() {
this._editingEnabled = SettingsStore.isFeatureEnabled("feature_message_editing");
// the event after which we put a visible unread marker on the last // the event after which we put a visible unread marker on the last
// render cycle; null if readMarkerVisible was false or the RM was // render cycle; null if readMarkerVisible was false or the RM was
// suppressed (eg because it was at the end of the timeline) // suppressed (eg because it was at the end of the timeline)
@ -586,7 +585,7 @@ module.exports = React.createClass({
<EventTile mxEvent={mxEv} <EventTile mxEvent={mxEv}
continuation={continuation} continuation={continuation}
isRedacted={mxEv.isRedacted()} isRedacted={mxEv.isRedacted()}
replacingEventId={this._editingEnabled && mxEv.replacingEventId()} replacingEventId={mxEv.replacingEventId()}
editState={isEditing && this.props.editState} editState={isEditing && this.props.editState}
onHeightChanged={this._onHeightChanged} onHeightChanged={this._onHeightChanged}
readReceipts={readReceipts} readReceipts={readReceipts}

View file

@ -22,7 +22,6 @@ import sdk from '../../../index';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
import Modal from '../../../Modal'; import Modal from '../../../Modal';
import { createMenu } from '../../structures/ContextualMenu'; import { createMenu } from '../../structures/ContextualMenu';
import SettingsStore from '../../../settings/SettingsStore';
import { isContentActionable, canEditContent } from '../../../utils/EventUtils'; import { isContentActionable, canEditContent } from '../../../utils/EventUtils';
export default class MessageActionBar extends React.PureComponent { export default class MessageActionBar extends React.PureComponent {
@ -123,19 +122,7 @@ export default class MessageActionBar extends React.PureComponent {
this.onFocusChange(true); this.onFocusChange(true);
} }
isReactionsEnabled() {
return SettingsStore.isFeatureEnabled("feature_reactions");
}
isEditingEnabled() {
return SettingsStore.isFeatureEnabled("feature_message_editing");
}
renderReactButton() { renderReactButton() {
if (!this.isReactionsEnabled()) {
return null;
}
const ReactMessageAction = sdk.getComponent('messages.ReactMessageAction'); const ReactMessageAction = sdk.getComponent('messages.ReactMessageAction');
const { mxEvent, reactions } = this.props; const { mxEvent, reactions } = this.props;
@ -158,7 +145,7 @@ export default class MessageActionBar extends React.PureComponent {
onClick={this.onReplyClick} onClick={this.onReplyClick}
/>; />;
} }
if (this.isEditingEnabled() && canEditContent(this.props.mxEvent)) { if (canEditContent(this.props.mxEvent)) {
editButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_editButton" editButton = <span className="mx_MessageActionBar_maskButton mx_MessageActionBar_editButton"
title={_t("Edit")} title={_t("Edit")}
onClick={this.onEditClick} onClick={this.onEditClick}

View file

@ -202,7 +202,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 (this.props.showReactions && SettingsStore.isFeatureEnabled("feature_reactions")) { if (this.props.showReactions) {
this.props.mxEvent.on("Event.relationsCreated", this._onReactionsCreated); this.props.mxEvent.on("Event.relationsCreated", this._onReactionsCreated);
} }
}, },
@ -227,7 +227,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 (this.props.showReactions && SettingsStore.isFeatureEnabled("feature_reactions")) { if (this.props.showReactions) {
this.props.mxEvent.removeListener("Event.relationsCreated", this._onReactionsCreated); this.props.mxEvent.removeListener("Event.relationsCreated", this._onReactionsCreated);
} }
}, },
@ -490,8 +490,7 @@ module.exports = withMatrixClient(React.createClass({
getReactions() { getReactions() {
if ( if (
!this.props.showReactions || !this.props.showReactions ||
!this.props.getRelationsForEvent || !this.props.getRelationsForEvent
!SettingsStore.isFeatureEnabled("feature_reactions")
) { ) {
return null; return null;
} }
@ -681,7 +680,7 @@ module.exports = withMatrixClient(React.createClass({
</div> : null; </div> : null;
let reactionsRow; let reactionsRow;
if (SettingsStore.isFeatureEnabled("feature_reactions") && !isRedacted) { if (!isRedacted) {
const ReactionsRow = sdk.getComponent('messages.ReactionsRow'); const ReactionsRow = sdk.getComponent('messages.ReactionsRow');
reactionsRow = <ReactionsRow reactionsRow = <ReactionsRow
mxEvent={this.props.mxEvent} mxEvent={this.props.mxEvent}
@ -829,7 +828,7 @@ module.exports.haveTileForEvent = function(e) {
if (e.isRedacted() && !isMessageEvent(e)) return false; if (e.isRedacted() && !isMessageEvent(e)) return false;
// No tile for replacement events since they update the original tile // No tile for replacement events since they update the original tile
if (e.isRelation("m.replace") && SettingsStore.isFeatureEnabled("feature_message_editing")) return false; if (e.isRelation("m.replace")) return false;
const handler = getHandlerTile(e); const handler = getHandlerTile(e);
if (handler === undefined) return false; if (handler === undefined) return false;

View file

@ -1141,9 +1141,8 @@ export default class MessageComposerInput extends React.Component {
if (!selection.anchor.isAtEndOfNode(document)) return; if (!selection.anchor.isAtEndOfNode(document)) return;
} }
const editingEnabled = SettingsStore.isFeatureEnabled("feature_message_editing"); const shouldSelectHistory = e.altKey;
const shouldSelectHistory = (editingEnabled && e.altKey) || !editingEnabled; const shouldEditLastMessage = !e.altKey && up && !RoomViewStore.getQuotingEvent();
const shouldEditLastMessage = editingEnabled && !e.altKey && up && !RoomViewStore.getQuotingEvent();
if (shouldSelectHistory) { if (shouldSelectHistory) {
// Try select composer history // Try select composer history

View file

@ -315,8 +315,6 @@
"Custom user status messages": "Custom user status messages", "Custom user status messages": "Custom user status messages",
"Group & filter rooms by custom tags (refresh to apply changes)": "Group & filter rooms by custom tags (refresh to apply changes)", "Group & filter rooms by custom tags (refresh to apply changes)": "Group & filter rooms by custom tags (refresh to apply changes)",
"Render simple counters in room header": "Render simple counters in room header", "Render simple counters in room header": "Render simple counters in room header",
"Edit messages after they have been sent (refresh to apply changes)": "Edit messages after they have been sent (refresh to apply changes)",
"React to messages with emoji (refresh to apply changes)": "React to messages with emoji (refresh to apply changes)",
"Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing", "Enable Emoji suggestions while typing": "Enable Emoji suggestions while typing",
"Use compact timeline layout": "Use compact timeline layout", "Use compact timeline layout": "Use compact timeline layout",
"Show a placeholder for removed messages": "Show a placeholder for removed messages", "Show a placeholder for removed messages": "Show a placeholder for removed messages",

View file

@ -114,18 +114,6 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE, supportedLevels: LEVELS_FEATURE,
default: false, default: false,
}, },
"feature_message_editing": {
isFeature: true,
displayName: _td("Edit messages after they have been sent (refresh to apply changes)"),
supportedLevels: LEVELS_FEATURE,
default: true,
},
"feature_reactions": {
isFeature: true,
displayName: _td("React to messages with emoji (refresh to apply changes)"),
supportedLevels: LEVELS_FEATURE,
default: true,
},
"MessageComposerInput.suggestEmoji": { "MessageComposerInput.suggestEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Enable Emoji suggestions while typing'), displayName: _td('Enable Emoji suggestions while typing'),

View file

@ -47,7 +47,7 @@ export default function shouldHideEvent(ev) {
if (ev.isRedacted() && !isEnabled('showRedactions')) return true; if (ev.isRedacted() && !isEnabled('showRedactions')) return true;
// Hide replacement events since they update the original tile (if enabled) // Hide replacement events since they update the original tile (if enabled)
if (ev.isRelation("m.replace") && SettingsStore.isFeatureEnabled("feature_message_editing")) return true; if (ev.isRelation("m.replace")) return true;
const eventDiff = memberEventDiff(ev); const eventDiff = memberEventDiff(ev);