UI Feature Flag: Hide flair
This commit is contained in:
parent
3d9c520af8
commit
9cc789756b
11 changed files with 76 additions and 29 deletions
|
@ -135,6 +135,9 @@ export default class MessagePanel extends React.Component {
|
||||||
|
|
||||||
// whether to use the irc layout
|
// whether to use the irc layout
|
||||||
useIRCLayout: PropTypes.bool,
|
useIRCLayout: PropTypes.bool,
|
||||||
|
|
||||||
|
// whether or not to show flair at all
|
||||||
|
enableFlair: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Force props to be loaded for useIRCLayout
|
// Force props to be loaded for useIRCLayout
|
||||||
|
@ -579,7 +582,8 @@ export default class MessagePanel extends React.Component {
|
||||||
data-scroll-tokens={scrollToken}
|
data-scroll-tokens={scrollToken}
|
||||||
>
|
>
|
||||||
<TileErrorBoundary mxEvent={mxEv}>
|
<TileErrorBoundary mxEvent={mxEv}>
|
||||||
<EventTile mxEvent={mxEv}
|
<EventTile
|
||||||
|
mxEvent={mxEv}
|
||||||
continuation={continuation}
|
continuation={continuation}
|
||||||
isRedacted={mxEv.isRedacted()}
|
isRedacted={mxEv.isRedacted()}
|
||||||
replacingEventId={mxEv.replacingEventId()}
|
replacingEventId={mxEv.replacingEventId()}
|
||||||
|
@ -598,6 +602,7 @@ export default class MessagePanel extends React.Component {
|
||||||
getRelationsForEvent={this.props.getRelationsForEvent}
|
getRelationsForEvent={this.props.getRelationsForEvent}
|
||||||
showReactions={this.props.showReactions}
|
showReactions={this.props.showReactions}
|
||||||
useIRCLayout={this.props.useIRCLayout}
|
useIRCLayout={this.props.useIRCLayout}
|
||||||
|
enableFlair={this.props.enableFlair}
|
||||||
/>
|
/>
|
||||||
</TileErrorBoundary>
|
</TileErrorBoundary>
|
||||||
</li>,
|
</li>,
|
||||||
|
|
|
@ -35,6 +35,7 @@ import Timer from '../../utils/Timer';
|
||||||
import shouldHideEvent from '../../shouldHideEvent';
|
import shouldHideEvent from '../../shouldHideEvent';
|
||||||
import EditorStateTransfer from '../../utils/EditorStateTransfer';
|
import EditorStateTransfer from '../../utils/EditorStateTransfer';
|
||||||
import {haveTileForEvent} from "../views/rooms/EventTile";
|
import {haveTileForEvent} from "../views/rooms/EventTile";
|
||||||
|
import {UIFeature} from "../../settings/UIFeature";
|
||||||
|
|
||||||
const PAGINATE_SIZE = 20;
|
const PAGINATE_SIZE = 20;
|
||||||
const INITIAL_SIZE = 20;
|
const INITIAL_SIZE = 20;
|
||||||
|
@ -1446,6 +1447,7 @@ class TimelinePanel extends React.Component {
|
||||||
editState={this.state.editState}
|
editState={this.state.editState}
|
||||||
showReactions={this.props.showReactions}
|
showReactions={this.props.showReactions}
|
||||||
useIRCLayout={this.props.useIRCLayout}
|
useIRCLayout={this.props.useIRCLayout}
|
||||||
|
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import FlairUserSettingsTab from "../settings/tabs/user/FlairUserSettingsTab";
|
||||||
import * as sdk from "../../../index";
|
import * as sdk from "../../../index";
|
||||||
import SdkConfig from "../../../SdkConfig";
|
import SdkConfig from "../../../SdkConfig";
|
||||||
import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab";
|
import MjolnirUserSettingsTab from "../settings/tabs/user/MjolnirUserSettingsTab";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
export const USER_GENERAL_TAB = "USER_GENERAL_TAB";
|
export const USER_GENERAL_TAB = "USER_GENERAL_TAB";
|
||||||
export const USER_APPEARANCE_TAB = "USER_APPEARANCE_TAB";
|
export const USER_APPEARANCE_TAB = "USER_APPEARANCE_TAB";
|
||||||
|
@ -86,12 +87,14 @@ export default class UserSettingsDialog extends React.Component {
|
||||||
"mx_UserSettingsDialog_appearanceIcon",
|
"mx_UserSettingsDialog_appearanceIcon",
|
||||||
<AppearanceUserSettingsTab />,
|
<AppearanceUserSettingsTab />,
|
||||||
));
|
));
|
||||||
tabs.push(new Tab(
|
if (SettingsStore.getValue(UIFeature.Flair)) {
|
||||||
USER_FLAIR_TAB,
|
tabs.push(new Tab(
|
||||||
_td("Flair"),
|
USER_FLAIR_TAB,
|
||||||
"mx_UserSettingsDialog_flairIcon",
|
_td("Flair"),
|
||||||
<FlairUserSettingsTab />,
|
"mx_UserSettingsDialog_flairIcon",
|
||||||
));
|
<FlairUserSettingsTab />,
|
||||||
|
));
|
||||||
|
}
|
||||||
tabs.push(new Tab(
|
tabs.push(new Tab(
|
||||||
USER_NOTIFICATIONS_TAB,
|
USER_NOTIFICATIONS_TAB,
|
||||||
_td("Notifications"),
|
_td("Notifications"),
|
||||||
|
|
|
@ -21,6 +21,8 @@ import { MatrixEvent } from 'matrix-js-sdk/src/models/event';
|
||||||
import * as Avatar from '../../../Avatar';
|
import * as Avatar from '../../../Avatar';
|
||||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||||
import EventTile from '../rooms/EventTile';
|
import EventTile from '../rooms/EventTile';
|
||||||
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +123,11 @@ export default class EventTilePreview extends React.Component<IProps, IState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
return <div className={className}>
|
return <div className={className}>
|
||||||
<EventTile mxEvent={event} useIRCLayout={this.props.useIRCLayout} />
|
<EventTile
|
||||||
|
mxEvent={event}
|
||||||
|
useIRCLayout={this.props.useIRCLayout}
|
||||||
|
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
||||||
|
/>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import escapeHtml from "escape-html";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {Action} from "../../../dispatcher/actions";
|
import {Action} from "../../../dispatcher/actions";
|
||||||
import sanitizeHtml from "sanitize-html";
|
import sanitizeHtml from "sanitize-html";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
// This component does no cycle detection, simply because the only way to make such a cycle would be to
|
// This component does no cycle detection, simply because the only way to make such a cycle would be to
|
||||||
// craft event_id's, using a homeserver that generates predictable event IDs; even then the impact would
|
// craft event_id's, using a homeserver that generates predictable event IDs; even then the impact would
|
||||||
|
@ -366,6 +367,7 @@ export default class ReplyThread extends React.Component {
|
||||||
isRedacted={ev.isRedacted()}
|
isRedacted={ev.isRedacted()}
|
||||||
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")}
|
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")}
|
||||||
useIRCLayout={this.props.useIRCLayout}
|
useIRCLayout={this.props.useIRCLayout}
|
||||||
|
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
||||||
/>
|
/>
|
||||||
</blockquote>;
|
</blockquote>;
|
||||||
});
|
});
|
||||||
|
|
|
@ -206,6 +206,9 @@ export default class EventTile extends React.Component {
|
||||||
|
|
||||||
// whether to use the irc layout
|
// whether to use the irc layout
|
||||||
useIRCLayout: PropTypes.bool,
|
useIRCLayout: PropTypes.bool,
|
||||||
|
|
||||||
|
// whether or not to show flair at all
|
||||||
|
enableFlair: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -736,10 +739,10 @@ export default class EventTile extends React.Component {
|
||||||
else if (msgtype === 'm.file') text = _td('%(senderName)s uploaded a file');
|
else if (msgtype === 'm.file') text = _td('%(senderName)s uploaded a file');
|
||||||
sender = <SenderProfile onClick={this.onSenderProfileClick}
|
sender = <SenderProfile onClick={this.onSenderProfileClick}
|
||||||
mxEvent={this.props.mxEvent}
|
mxEvent={this.props.mxEvent}
|
||||||
enableFlair={!text}
|
enableFlair={this.props.enableFlair && !text}
|
||||||
text={text} />;
|
text={text} />;
|
||||||
} else {
|
} else {
|
||||||
sender = <SenderProfile mxEvent={this.props.mxEvent} enableFlair={true} />;
|
sender = <SenderProfile mxEvent={this.props.mxEvent} enableFlair={this.props.enableFlair} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import RoomViewStore from '../../../stores/RoomViewStore';
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import {RoomPermalinkCreator} from "../../../utils/permalinks/Permalinks";
|
import {RoomPermalinkCreator} from "../../../utils/permalinks/Permalinks";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
function cancelQuoting() {
|
function cancelQuoting() {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
|
@ -80,11 +81,14 @@ export default class ReplyPreview extends React.Component {
|
||||||
onClick={cancelQuoting} />
|
onClick={cancelQuoting} />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_ReplyPreview_clear" />
|
<div className="mx_ReplyPreview_clear" />
|
||||||
<EventTile last={true}
|
<EventTile
|
||||||
tileShape="reply_preview"
|
last={true}
|
||||||
mxEvent={this.state.event}
|
tileShape="reply_preview"
|
||||||
permalinkCreator={this.props.permalinkCreator}
|
mxEvent={this.state.event}
|
||||||
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")} />
|
permalinkCreator={this.props.permalinkCreator}
|
||||||
|
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")}
|
||||||
|
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import {haveTileForEvent} from "./EventTile";
|
import {haveTileForEvent} from "./EventTile";
|
||||||
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
|
import {UIFeature} from "../../../settings/UIFeature";
|
||||||
|
|
||||||
export default class SearchResultTile extends React.Component {
|
export default class SearchResultTile extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -45,18 +47,27 @@ export default class SearchResultTile extends React.Component {
|
||||||
const ret = [<DateSeparator key={ts1 + "-search"} ts={ts1} />];
|
const ret = [<DateSeparator key={ts1 + "-search"} ts={ts1} />];
|
||||||
|
|
||||||
const timeline = result.context.getTimeline();
|
const timeline = result.context.getTimeline();
|
||||||
for (var j = 0; j < timeline.length; j++) {
|
for (let j = 0; j < timeline.length; j++) {
|
||||||
const ev = timeline[j];
|
const ev = timeline[j];
|
||||||
var highlights;
|
let highlights;
|
||||||
const contextual = (j != result.context.getOurEventIndex());
|
const contextual = (j != result.context.getOurEventIndex());
|
||||||
if (!contextual) {
|
if (!contextual) {
|
||||||
highlights = this.props.searchHighlights;
|
highlights = this.props.searchHighlights;
|
||||||
}
|
}
|
||||||
if (haveTileForEvent(ev)) {
|
if (haveTileForEvent(ev)) {
|
||||||
ret.push(<EventTile key={eventId+"+"+j} mxEvent={ev} contextual={contextual} highlights={highlights}
|
ret.push((
|
||||||
permalinkCreator={this.props.permalinkCreator}
|
<EventTile
|
||||||
highlightLink={this.props.resultLink}
|
key={`${eventId}+${j}`}
|
||||||
onHeightChanged={this.props.onHeightChanged} />);
|
mxEvent={ev}
|
||||||
|
contextual={contextual}
|
||||||
|
highlights={highlights}
|
||||||
|
permalinkCreator={this.props.permalinkCreator}
|
||||||
|
highlightLink={this.props.resultLink}
|
||||||
|
onHeightChanged={this.props.onHeightChanged}
|
||||||
|
isTwelveHour={SettingsStore.getValue("showTwelveHourTimestamps")}
|
||||||
|
enableFlair={SettingsStore.getValue(UIFeature.Flair)}
|
||||||
|
/>
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -73,6 +73,18 @@ export default class GeneralRoomSettingsTab extends React.Component {
|
||||||
urlPreviewSettings = null;
|
urlPreviewSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let flairSection;
|
||||||
|
if (SettingsStore.getValue(UIFeature.Flair)) {
|
||||||
|
flairSection = <>
|
||||||
|
<span className='mx_SettingsTab_subheading'>{_t("Flair")}</span>
|
||||||
|
<div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'>
|
||||||
|
<RelatedGroupSettings roomId={room.roomId}
|
||||||
|
canSetRelatedGroups={canChangeGroups}
|
||||||
|
relatedGroupsEvent={groupsEvent} />
|
||||||
|
</div>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_SettingsTab mx_GeneralRoomSettingsTab">
|
<div className="mx_SettingsTab mx_GeneralRoomSettingsTab">
|
||||||
<div className="mx_SettingsTab_heading">{_t("General")}</div>
|
<div className="mx_SettingsTab_heading">{_t("General")}</div>
|
||||||
|
@ -87,14 +99,8 @@ export default class GeneralRoomSettingsTab extends React.Component {
|
||||||
canonicalAliasEvent={canonicalAliasEv} aliasEvents={aliasEvents} />
|
canonicalAliasEvent={canonicalAliasEv} aliasEvents={aliasEvents} />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_SettingsTab_heading">{_t("Other")}</div>
|
<div className="mx_SettingsTab_heading">{_t("Other")}</div>
|
||||||
<span className='mx_SettingsTab_subheading'>{_t("Flair")}</span>
|
{ flairSection }
|
||||||
<div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'>
|
{ urlPreviewSettings }
|
||||||
<RelatedGroupSettings roomId={room.roomId}
|
|
||||||
canSetRelatedGroups={canChangeGroups}
|
|
||||||
relatedGroupsEvent={groupsEvent} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{urlPreviewSettings}
|
|
||||||
|
|
||||||
<span className='mx_SettingsTab_subheading'>{_t("Leave room")}</span>
|
<span className='mx_SettingsTab_subheading'>{_t("Leave room")}</span>
|
||||||
<div className='mx_SettingsTab_section'>
|
<div className='mx_SettingsTab_section'>
|
||||||
|
|
|
@ -618,4 +618,8 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
||||||
supportedLevels: LEVELS_UI_FEATURE,
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
[UIFeature.Flair]: {
|
||||||
|
supportedLevels: LEVELS_UI_FEATURE,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,4 +17,5 @@ limitations under the License.
|
||||||
// see settings.md for documentation on conventions
|
// see settings.md for documentation on conventions
|
||||||
export enum UIFeature {
|
export enum UIFeature {
|
||||||
URLPreviews = "UIFeature.urlPreviews",
|
URLPreviews = "UIFeature.urlPreviews",
|
||||||
|
Flair = "UIFeature.flair",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue