Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Augmentile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Auglement
Augmentile
Commits
541838b0
Verified
Commit
541838b0
authored
3 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Fix lint issues
parent
76ac3298
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#7316
passed
3 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/backends/matrix.js
+1
-1
1 addition, 1 deletion
src/backends/matrix.js
src/utils.js
+6
-5
6 additions, 5 deletions
src/utils.js
with
7 additions
and
6 deletions
src/backends/matrix.js
+
1
−
1
View file @
541838b0
...
...
@@ -25,7 +25,7 @@ class MatrixBackend extends BaseBackend {
set
userId
(
value
)
{
if
(
value
!==
undefined
)
{
const
matrixId
=
utils
.
splitMatrixId
(
value
);
const
homeServerUrl
=
'
https://
'
+
matrixId
.
homeServer
const
homeServerUrl
=
'
https://
'
+
matrixId
.
homeServer
;
this
.
api
=
sdk
.
createClient
(
homeServerUrl
);
this
.
userId
=
value
;
...
...
This diff is collapsed.
Click to expand it.
src/utils.js
+
6
−
5
View file @
541838b0
...
...
@@ -17,6 +17,7 @@
* Split a Matrix ID into local part and homeserver
*
* @param {string} matrixId
* @return {Object}
*
* @example
* splitMatrixId('@foo:example.com')
...
...
@@ -24,11 +25,11 @@
*/
export
function
splitMatrixId
(
matrixId
)
{
if
(
typeof
matrixId
!==
'
string
'
)
{
throw
'
Passed Matrix ID must be a string
'
;
throw
new
Error
(
'
Passed Matrix ID must be a string
'
)
;
}
else
if
(
matrixId
.
substr
(
0
,
1
)
!==
'
@
'
)
{
throw
'
Passed Matrix ID must begin with @
'
;
throw
new
Error
(
'
Passed Matrix ID must begin with @
'
)
;
}
else
if
(
matrixId
.
indexOf
(
'
:
'
)
<
2
)
{
throw
'
Passed Matrix ID must contain :
to separate local part and home server
'
;
throw
new
Error
(
'
Passed Matrix ID must contain :
'
)
;
}
const
localPart
=
matrixId
.
substr
(
1
).
substr
(
0
,
matrixId
.
indexOf
(
'
:
'
));
...
...
@@ -36,6 +37,6 @@ export function splitMatrixId(matrixId) {
return
{
'
localPart
'
:
localPart
,
'
homeServer
'
:
homeServer
}
'
homeServer
'
:
homeServer
,
}
;
}
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