Display started polls in timeline (without votes) (behind labs setting) (#7088)

* Display started polls in timeline (without votes)

* Update i18n info

* Keep original background colour of poll options, even on hover

* Show full avatar above a poll message
This commit is contained in:
Andy Balaam 2021-11-10 15:44:57 +00:00 committed by GitHub
parent 8ea551fb6d
commit 431b69ee49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 229 additions and 5 deletions

View file

@ -27,6 +27,7 @@ import { MediaEventHelper } from "../../../utils/MediaEventHelper";
import { ReactAnyComponent } from "../../../@types/common";
import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
import { IBodyProps } from "./IBodyProps";
import { POLL_START_EVENT_TYPE } from '../../../polls/consts';
// onMessageAllowed is handled internally
interface IProps extends Omit<IBodyProps, "onMessageAllowed"> {
@ -111,6 +112,15 @@ export default class MessageEvent extends React.Component<IProps> implements IMe
// Fallback to UnknownBody otherwise if not redacted
BodyType = UnknownBody;
}
if (type && type === POLL_START_EVENT_TYPE.name) {
// TODO: this can all disappear when Polls comes out of labs -
// instead, add something like this into this.evTypes:
// [EventType.Poll]: "messages.MPollBody"
if (SettingsStore.getValue("feature_polls")) {
BodyType = sdk.getComponent('messages.MPollBody');
}
}
}
if (SettingsStore.getValue("feature_mjolnir")) {