Put message previews for Emoji behind Labs
This commit is contained in:
parent
850c850bde
commit
50b9da7597
3 changed files with 20 additions and 1 deletions
|
@ -27,5 +27,5 @@ export interface IPreview {
|
|||
* @param tagId Optional. The tag where the room the event was sent in resides.
|
||||
* @returns The preview.
|
||||
*/
|
||||
getTextFor(event: MatrixEvent, tagId?: TagID): string;
|
||||
getTextFor(event: MatrixEvent, tagId?: TagID): string | null;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,16 @@ import { TagID } from "../models";
|
|||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { getSenderName, isSelf, shouldPrefixMessagesIn } from "./utils";
|
||||
import { _t } from "../../../languageHandler";
|
||||
import SettingsStore from "../../../settings/SettingsStore";
|
||||
import DMRoomMap from "../../../utils/DMRoomMap";
|
||||
|
||||
export class ReactionEventPreview implements IPreview {
|
||||
public getTextFor(event: MatrixEvent, tagId?: TagID): string {
|
||||
const showDms = SettingsStore.isFeatureEnabled("feature_roomlist_preview_reactions_dms");
|
||||
const showAll = SettingsStore.isFeatureEnabled("feature_roomlist_preview_reactions_all");
|
||||
|
||||
if (!showAll && (!showDms || DMRoomMap.shared().getUserIdForRoomId(event.getRoomId()))) return null;
|
||||
|
||||
const relation = event.getRelation();
|
||||
if (!relation) return null; // invalid reaction (probably redacted)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue