Merge pull request #5110 from matrix-org/t3chguy/room-list/14298
Put message previews for Emoji behind Labspull/21833/head
						commit
						b577667447
					
				| 
						 | 
					@ -448,6 +448,8 @@
 | 
				
			||||||
    "Multiple integration managers": "Multiple integration managers",
 | 
					    "Multiple integration managers": "Multiple integration managers",
 | 
				
			||||||
    "Try out new ways to ignore people (experimental)": "Try out new ways to ignore people (experimental)",
 | 
					    "Try out new ways to ignore people (experimental)": "Try out new ways to ignore people (experimental)",
 | 
				
			||||||
    "Support adding custom themes": "Support adding custom themes",
 | 
					    "Support adding custom themes": "Support adding custom themes",
 | 
				
			||||||
 | 
					    "Show message previews for reactions in DMs": "Show message previews for reactions in DMs",
 | 
				
			||||||
 | 
					    "Show message previews for reactions in all rooms": "Show message previews for reactions in all rooms",
 | 
				
			||||||
    "Enable advanced debugging for the room list": "Enable advanced debugging for the room list",
 | 
					    "Enable advanced debugging for the room list": "Enable advanced debugging for the room list",
 | 
				
			||||||
    "Show info about bridges in room settings": "Show info about bridges in room settings",
 | 
					    "Show info about bridges in room settings": "Show info about bridges in room settings",
 | 
				
			||||||
    "Font size": "Font size",
 | 
					    "Font size": "Font size",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,6 +158,18 @@ export const SETTINGS: {[setting: string]: ISetting} = {
 | 
				
			||||||
        supportedLevels: LEVELS_FEATURE,
 | 
					        supportedLevels: LEVELS_FEATURE,
 | 
				
			||||||
        default: false,
 | 
					        default: false,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "feature_roomlist_preview_reactions_dms": {
 | 
				
			||||||
 | 
					        isFeature: true,
 | 
				
			||||||
 | 
					        displayName: _td("Show message previews for reactions in DMs"),
 | 
				
			||||||
 | 
					        supportedLevels: LEVELS_FEATURE,
 | 
				
			||||||
 | 
					        default: false,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "feature_roomlist_preview_reactions_all": {
 | 
				
			||||||
 | 
					        isFeature: true,
 | 
				
			||||||
 | 
					        displayName: _td("Show message previews for reactions in all rooms"),
 | 
				
			||||||
 | 
					        supportedLevels: LEVELS_FEATURE,
 | 
				
			||||||
 | 
					        default: false,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "advancedRoomListLogging": {
 | 
					    "advancedRoomListLogging": {
 | 
				
			||||||
        // TODO: Remove flag before launch: https://github.com/vector-im/element-web/issues/14231
 | 
					        // TODO: Remove flag before launch: https://github.com/vector-im/element-web/issues/14231
 | 
				
			||||||
        displayName: _td("Enable advanced debugging for the room list"),
 | 
					        displayName: _td("Enable advanced debugging for the room list"),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,5 +27,5 @@ export interface IPreview {
 | 
				
			||||||
     * @param tagId Optional. The tag where the room the event was sent in resides.
 | 
					     * @param tagId Optional. The tag where the room the event was sent in resides.
 | 
				
			||||||
     * @returns The preview.
 | 
					     * @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 { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
import { getSenderName, isSelf, shouldPrefixMessagesIn } from "./utils";
 | 
					import { getSenderName, isSelf, shouldPrefixMessagesIn } from "./utils";
 | 
				
			||||||
import { _t } from "../../../languageHandler";
 | 
					import { _t } from "../../../languageHandler";
 | 
				
			||||||
 | 
					import SettingsStore from "../../../settings/SettingsStore";
 | 
				
			||||||
 | 
					import DMRoomMap from "../../../utils/DMRoomMap";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class ReactionEventPreview implements IPreview {
 | 
					export class ReactionEventPreview implements IPreview {
 | 
				
			||||||
    public getTextFor(event: MatrixEvent, tagId?: TagID): string {
 | 
					    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();
 | 
					        const relation = event.getRelation();
 | 
				
			||||||
        if (!relation) return null; // invalid reaction (probably redacted)
 | 
					        if (!relation) return null; // invalid reaction (probably redacted)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue