Add a feature flag for custom status messages

pull/21833/head
Travis Ralston 2018-12-18 15:11:08 -07:00
parent d20a934642
commit 04c9fff6ce
6 changed files with 30 additions and 4 deletions

View File

@ -22,8 +22,9 @@ import MemberAvatar from '../avatars/MemberAvatar';
import classNames from 'classnames'; import classNames from 'classnames';
import * as ContextualMenu from "../../structures/ContextualMenu"; import * as ContextualMenu from "../../structures/ContextualMenu";
import StatusMessageContextMenu from "../context_menus/StatusMessageContextMenu"; import StatusMessageContextMenu from "../context_menus/StatusMessageContextMenu";
import SettingsStore from "../../../settings/SettingsStore";
export default class MemberStatusMessageAvatar extends React.PureComponent { export default class MemberStatusMessageAvatar extends React.Component {
static propTypes = { static propTypes = {
member: PropTypes.object.isRequired, member: PropTypes.object.isRequired,
width: PropTypes.number, width: PropTypes.number,
@ -92,6 +93,13 @@ export default class MemberStatusMessageAvatar extends React.PureComponent {
}; };
render() { render() {
if (!SettingsStore.isFeatureEnabled("feature_custom_status")) {
return <MemberAvatar member={this.props.member}
width={this.props.width}
height={this.props.height}
resizeMethod={this.props.resizeMethod} />;
}
const hasStatus = this.props.member.user ? !!this.props.member.user._unstable_statusMessage : false; const hasStatus = this.props.member.user ? !!this.props.member.user._unstable_statusMessage : false;
const classes = classNames({ const classes = classNames({

View File

@ -42,6 +42,7 @@ import AccessibleButton from '../elements/AccessibleButton';
import RoomViewStore from '../../../stores/RoomViewStore'; import RoomViewStore from '../../../stores/RoomViewStore';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import MultiInviter from "../../../utils/MultiInviter"; import MultiInviter from "../../../utils/MultiInviter";
import SettingsStore from "../../../settings/SettingsStore";
module.exports = withMatrixClient(React.createClass({ module.exports = withMatrixClient(React.createClass({
displayName: 'MemberInfo', displayName: 'MemberInfo',
@ -895,8 +896,11 @@ module.exports = withMatrixClient(React.createClass({
presenceState = this.props.member.user.presence; presenceState = this.props.member.user.presence;
presenceLastActiveAgo = this.props.member.user.lastActiveAgo; presenceLastActiveAgo = this.props.member.user.lastActiveAgo;
presenceCurrentlyActive = this.props.member.user.currentlyActive; presenceCurrentlyActive = this.props.member.user.currentlyActive;
if (SettingsStore.isFeatureEnabled("feature_custom_status")) {
statusMessage = this.props.member.user._unstable_statusMessage; statusMessage = this.props.member.user._unstable_statusMessage;
} }
}
const room = this.props.matrixClient.getRoom(this.props.member.roomId); const room = this.props.matrixClient.getRoom(this.props.member.roomId);
const powerLevelEvent = room ? room.currentState.getStateEvents("m.room.power_levels", "") : null; const powerLevelEvent = room ? room.currentState.getStateEvents("m.room.power_levels", "") : null;

View File

@ -16,6 +16,8 @@ limitations under the License.
'use strict'; 'use strict';
import SettingsStore from "../../../settings/SettingsStore";
const React = require('react'); const React = require('react');
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -84,7 +86,11 @@ module.exports = React.createClass({
const name = this._getDisplayName(); const name = this._getDisplayName();
const active = -1; const active = -1;
const presenceState = member.user ? member.user.presence : null; const presenceState = member.user ? member.user.presence : null;
const statusMessage = member.user ? member.user._unstable_statusMessage : null;
let statusMessage = null;
if (member.user && SettingsStore.isFeatureEnabled("feature_custom_status")) {
statusMessage = member.user._unstable_statusMessage;
}
const av = ( const av = (
<MemberAvatar member={member} width={36} height={36} /> <MemberAvatar member={member} width={36} height={36} />

View File

@ -30,6 +30,7 @@ import * as FormattingUtils from '../../../utils/FormattingUtils';
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
import ActiveRoomObserver from '../../../ActiveRoomObserver'; import ActiveRoomObserver from '../../../ActiveRoomObserver';
import RoomViewStore from '../../../stores/RoomViewStore'; import RoomViewStore from '../../../stores/RoomViewStore';
import SettingsStore from "../../../settings/SettingsStore";
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'RoomTile', displayName: 'RoomTile',
@ -254,7 +255,7 @@ module.exports = React.createClass({
const isJoined = this.props.room.getMyMembership() === "join"; const isJoined = this.props.room.getMyMembership() === "join";
const looksLikeDm = this.props.room.getInvitedAndJoinedMemberCount() === 2; const looksLikeDm = this.props.room.getInvitedAndJoinedMemberCount() === 2;
let subtext = null; let subtext = null;
if (!isInvite && isJoined && looksLikeDm) { if (!isInvite && isJoined && looksLikeDm && SettingsStore.isFeatureEnabled("feature_custom_status")) {
const selfId = MatrixClientPeg.get().getUserId(); const selfId = MatrixClientPeg.get().getUserId();
const otherMember = this.props.room.currentState.getMembersExcept([selfId])[0]; const otherMember = this.props.room.currentState.getMembersExcept([selfId])[0];
if (otherMember && otherMember.user && otherMember.user._unstable_statusMessage) { if (otherMember && otherMember.user && otherMember.user._unstable_statusMessage) {

View File

@ -255,6 +255,7 @@
"Please contact your homeserver administrator.": "Please contact your homeserver administrator.", "Please contact your homeserver administrator.": "Please contact your homeserver administrator.",
"Failed to join room": "Failed to join room", "Failed to join room": "Failed to join room",
"Message Pinning": "Message Pinning", "Message Pinning": "Message Pinning",
"Custom user status messages": "Custom user status messages",
"Increase performance by only loading room members on first view": "Increase performance by only loading room members on first view", "Increase performance by only loading room members on first view": "Increase performance by only loading room members on first view",
"Backup of encryption keys to server": "Backup of encryption keys to server", "Backup of encryption keys to server": "Backup of encryption keys to server",
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing", "Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",

View File

@ -83,6 +83,12 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE, supportedLevels: LEVELS_FEATURE,
default: false, default: false,
}, },
"feature_custom_status": {
isFeature: true,
displayName: _td("Custom user status messages"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
"feature_lazyloading": { "feature_lazyloading": {
isFeature: true, isFeature: true,
displayName: _td("Increase performance by only loading room members on first view"), displayName: _td("Increase performance by only loading room members on first view"),