hide live location option when composer has relation (#8746)
Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
228abb6f07
commit
91cbd4dc8a
2 changed files with 25 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue