mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-06-28 10:27:07 -04:00
Keep matrixService stateless and make matrixFilter use modelService.
This commit is contained in:
parent
5ab9929cbb
commit
395bb64b26
5 changed files with 54 additions and 54 deletions
|
@ -705,6 +705,27 @@ function(matrixService, $rootScope, $q, $timeout, mPresence, notificationService
|
|||
return getMember(room_id, user_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the power level of an user in a particular room
|
||||
* @param {String} room_id the room id
|
||||
* @param {String} user_id the user id
|
||||
* @returns {Number} a value between 0 and 10
|
||||
*/
|
||||
getUserPowerLevel: function(room_id, user_id) {
|
||||
var powerLevel = 0;
|
||||
var room = $rootScope.events.rooms[room_id];
|
||||
if (room && room["m.room.power_levels"]) {
|
||||
if (user_id in room["m.room.power_levels"].content) {
|
||||
powerLevel = room["m.room.power_levels"].content[user_id];
|
||||
}
|
||||
else {
|
||||
// Use the room default user power
|
||||
powerLevel = room["m.room.power_levels"].content["default"];
|
||||
}
|
||||
}
|
||||
return powerLevel;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the display name of an user acccording to data already downloaded
|
||||
* @param {String} room_id the room id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue