* check recents length * Improve sorting logic in capabilities dialog * Fix allowedHosts regex array check * Remove double negative in filter checks * prettier
This commit is contained in:
@@ -415,7 +415,7 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
|
||||
// We mutate the given set so that any later callers avoid duplicating these users
|
||||
excludedTargetIds.add(userId);
|
||||
}
|
||||
if (!recents) logger.warn("[Invite:Recents] No recents to suggest!");
|
||||
if (recents.length === 0) logger.warn("[Invite:Recents] No recents to suggest!");
|
||||
|
||||
// Sort the recents by last active to save us time later
|
||||
recents.sort((a, b) => b.lastActive - a.lastActive);
|
||||
|
||||
@@ -91,12 +91,13 @@ export default class WidgetCapabilitiesPromptDialog extends React.PureComponent<
|
||||
const isTimelineA = isTimelineCapability(capA);
|
||||
const isTimelineB = isTimelineCapability(capB);
|
||||
|
||||
if (!isTimelineA && !isTimelineB) return lexicographicCompare(capA, capB);
|
||||
if (isTimelineA && !isTimelineB) return 1;
|
||||
if (!isTimelineA && isTimelineB) return -1;
|
||||
if (isTimelineA && isTimelineB) return lexicographicCompare(capA, capB);
|
||||
// Sort timeline capabilities to the bottom, non-timeline to the top
|
||||
if (isTimelineA !== isTimelineB) {
|
||||
return isTimelineA ? 1 : -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
// Both are the same type (both timeline or both non-timeline), sort lexicographically
|
||||
return lexicographicCompare(capA, capB);
|
||||
});
|
||||
const checkboxRows = orderedCapabilities.map(([cap, isChecked], i) => {
|
||||
const text = CapabilityText.for(cap, this.props.widgetKind);
|
||||
|
||||
@@ -1144,7 +1144,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
||||
|
||||
if (rovingContext.state.activeNode && rovingContext.state.nodes.length > 0) {
|
||||
let nodes = rovingContext.state.nodes;
|
||||
if (!query && !filter !== null) {
|
||||
if (!query && filter === null) {
|
||||
// If the current selection is not in the recently viewed row then only include the
|
||||
// first recently viewed so that is the target when the user is switching into recently viewed.
|
||||
const keptRecentlyViewedRef = nodeIsForRecentlyViewed(rovingContext.state.activeNode)
|
||||
@@ -1164,7 +1164,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
||||
// only handle these keys when we are in the recently viewed row of options
|
||||
if (
|
||||
!query &&
|
||||
!filter !== null &&
|
||||
filter === null &&
|
||||
rovingContext.state.activeNode &&
|
||||
rovingContext.state.nodes.length > 0 &&
|
||||
nodeIsForRecentlyViewed(rovingContext.state.activeNode)
|
||||
@@ -1226,8 +1226,8 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
|
||||
<>
|
||||
<kbd>↓</kbd>
|
||||
<kbd>↑</kbd>
|
||||
{!filter !== null && !query && <kbd>←</kbd>}
|
||||
{!filter !== null && !query && <kbd>→</kbd>}
|
||||
{filter === null && !query && <kbd>←</kbd>}
|
||||
{filter === null && !query && <kbd>→</kbd>}
|
||||
</>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -217,7 +217,7 @@ export class RoomPermalinkCreator {
|
||||
|
||||
const allowed = aclEvent.getContent<{ allow: string[] }>().allow;
|
||||
allowedHostsRegexps = []; // we don't want to use the default rule here
|
||||
if (Array.isArray(denied)) {
|
||||
if (Array.isArray(allowed)) {
|
||||
allowed.forEach((h) => allowedHostsRegexps.push(getRegex(h)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user