Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
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
TeDomum
Matrix
Commits
932f35a7
Commit
932f35a7
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
Added /deop $user_id
parent
756e171a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webclient/components/matrix/matrix-service.js
+27
-2
27 additions, 2 deletions
webclient/components/matrix/matrix-service.js
webclient/room/room-controller.js
+9
-1
9 additions, 1 deletion
webclient/room/room-controller.js
with
36 additions
and
3 deletions
webclient/components/matrix/matrix-service.js
+
27
−
2
View file @
932f35a7
...
...
@@ -522,7 +522,6 @@ angular.module('matrixService', [])
return
powerLevel
;
},
//
/**
* Change the power level of a user
* @param {String} room_id the room id
...
...
@@ -554,7 +553,33 @@ angular.module('matrixService', [])
// The room does not exist or does not contain power_levels data
var
deferred
=
$q
.
defer
();
deferred
.
reject
({
data
:{
error
:
"
Invalied room:
"
+
room_id
}});
deferred
.
reject
({
data
:{
error
:
"
Invalid room:
"
+
room_id
}});
return
deferred
.
promise
;
},
/**
* reset the power level of a user so that he will use the room default power level
* @param {String} room_id the room id
* @param {String} user_id the user id
* @returns {promise} an $http promise
*/
resetUserPowerLevel
:
function
(
room_id
,
user_id
)
{
// Hack: currently, there is no home server API so do it by hand by updating
// the current m.room.power_levels of the room and send it to the server
var
room
=
$rootScope
.
events
.
rooms
[
room_id
];
if
(
room
&&
room
[
"
m.room.power_levels
"
])
{
var
content
=
angular
.
copy
(
room
[
"
m.room.power_levels
"
].
content
);
delete
content
[
user_id
];
var
path
=
"
/rooms/$room_id/state/m.room.power_levels
"
;
path
=
path
.
replace
(
"
$room_id
"
,
encodeURIComponent
(
room_id
));
return
doRequest
(
"
PUT
"
,
path
,
undefined
,
content
);
}
// The room does not exist or does not contain power_levels data
var
deferred
=
$q
.
defer
();
deferred
.
reject
({
data
:{
error
:
"
Invalid room:
"
+
room_id
}});
return
deferred
.
promise
;
}
...
...
This diff is collapsed.
Click to expand it.
webclient/room/room-controller.js
+
9
−
1
View file @
932f35a7
...
...
@@ -299,13 +299,21 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
break
;
case
"
/op
"
:
// Define the power level of an user
if
(
3
===
args
.
length
)
{
var
user_id
=
args
[
1
];
var
powerLevel
=
parseInt
(
args
[
2
]);
promise
=
matrixService
.
setUserPowerLevel
(
$scope
.
room_id
,
user_id
,
powerLevel
);
}
break
;
case
"
/deop
"
:
// Reset the power level of an user
if
(
2
===
args
.
length
)
{
var
user_id
=
args
[
1
];
promise
=
matrixService
.
resetUserPowerLevel
(
$scope
.
room_id
,
user_id
);
}
break
;
}
}
else
{
...
...
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