Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
b19d9cab
Verified
Commit
b19d9cab
authored
3 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Sort known UIA flows first
parent
8309ad2f
No related branches found
No related tags found
No related merge requests found
Pipeline
#2815
failed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ui/UIA.cpp
+30
-0
30 additions, 0 deletions
src/ui/UIA.cpp
with
30 additions
and
0 deletions
src/ui/UIA.cpp
+
30
−
0
View file @
b19d9cab
...
...
@@ -60,6 +60,36 @@ UIA::genericHandler(QString context)
return
;
}
// sort flows with known stages first
std
::
sort
(
flows
.
begin
(),
flows
.
end
(),
[](
const
mtx
::
user_interactive
::
Flow
&
a
,
const
mtx
::
user_interactive
::
Flow
&
b
)
{
auto
calcWeight
=
[](
const
mtx
::
user_interactive
::
Flow
&
f
)
{
using
namespace
mtx
::
user_interactive
::
auth_types
;
const
static
std
::
map
<
std
::
string_view
,
int
>
weights
{
{
mtx
::
user_interactive
::
auth_types
::
password
,
0
},
{
mtx
::
user_interactive
::
auth_types
::
email_identity
,
0
},
{
mtx
::
user_interactive
::
auth_types
::
msisdn
,
0
},
{
mtx
::
user_interactive
::
auth_types
::
dummy
,
0
},
{
mtx
::
user_interactive
::
auth_types
::
registration_token
,
0
},
// recaptcha is known, but we'd like to avoid it, because it calls out to
// the browser
{
mtx
::
user_interactive
::
auth_types
::
recaptcha
,
1
},
};
int
weight
=
0
;
for
(
const
auto
&
s
:
f
.
stages
)
{
if
(
!
weights
.
count
(
s
))
weight
+=
3
;
else
weight
+=
weights
.
at
(
s
);
}
return
weight
;
};
return
calcWeight
(
a
)
<
calcWeight
(
b
);
});
auto
current_stage
=
flows
.
front
().
stages
.
at
(
u
.
completed
.
size
());
if
(
current_stage
==
mtx
::
user_interactive
::
auth_types
::
password
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment