hide live location option when composer has relation (#8746)
Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
@@ -38,8 +38,16 @@ type Props = Omit<ILocationPickerProps, 'onChoose' | 'shareType'> & {
|
||||
relation?: IEventRelation;
|
||||
};
|
||||
|
||||
const getEnabledShareTypes = (): LocationShareType[] => {
|
||||
const enabledShareTypes = [LocationShareType.Own, LocationShareType.Live];
|
||||
const getEnabledShareTypes = (relation): LocationShareType[] => {
|
||||
const enabledShareTypes = [
|
||||
LocationShareType.Own,
|
||||
];
|
||||
|
||||
// live locations cannot have a relation
|
||||
// hide the option when composer has a relation
|
||||
if (!relation) {
|
||||
enabledShareTypes.push(LocationShareType.Live);
|
||||
}
|
||||
|
||||
if (SettingsStore.getValue("feature_location_share_pin_drop")) {
|
||||
enabledShareTypes.push(LocationShareType.Pin);
|
||||
@@ -57,7 +65,7 @@ const LocationShareMenu: React.FC<Props> = ({
|
||||
relation,
|
||||
}) => {
|
||||
const matrixClient = useContext(MatrixClientContext);
|
||||
const enabledShareTypes = getEnabledShareTypes();
|
||||
const enabledShareTypes = getEnabledShareTypes(relation);
|
||||
const isLiveShareEnabled = useFeatureEnabled("feature_location_share_live");
|
||||
|
||||
const multipleShareTypesEnabled = enabledShareTypes.length > 1;
|
||||
|
||||
Reference in New Issue
Block a user