mirror of https://github.com/sualko/cloud_bbb
feat: show room shared icon
parent
b5f03b5981
commit
4203ee3987
|
@ -54,12 +54,14 @@ class Room extends Entity implements JsonSerializable {
|
||||||
public $password;
|
public $password;
|
||||||
public $everyoneIsModerator;
|
public $everyoneIsModerator;
|
||||||
public $requireModerator = false;
|
public $requireModerator = false;
|
||||||
|
public $shared = false;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->addType('maxParticipants', 'integer');
|
$this->addType('maxParticipants', 'integer');
|
||||||
$this->addType('record', 'boolean');
|
$this->addType('record', 'boolean');
|
||||||
$this->addType('everyoneIsModerator', 'boolean');
|
$this->addType('everyoneIsModerator', 'boolean');
|
||||||
$this->addType('requireModerator', 'boolean');
|
$this->addType('requireModerator', 'boolean');
|
||||||
|
$this->addType('shared', 'boolean');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize(): array {
|
public function jsonSerialize(): array {
|
||||||
|
@ -75,6 +77,7 @@ class Room extends Entity implements JsonSerializable {
|
||||||
'password' => $this->password,
|
'password' => $this->password,
|
||||||
'everyoneIsModerator' => boolval($this->everyoneIsModerator),
|
'everyoneIsModerator' => boolval($this->everyoneIsModerator),
|
||||||
'requireModerator' => boolval($this->requireModerator),
|
'requireModerator' => boolval($this->requireModerator),
|
||||||
|
'shared' => boolval($this->shared),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,13 @@ class RoomMapper extends QBMapper {
|
||||||
public function find(int $id): Room {
|
public function find(int $id): Room {
|
||||||
/* @var $qb IQueryBuilder */
|
/* @var $qb IQueryBuilder */
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('r.*')
|
||||||
->from($this->tableName)
|
->from($this->tableName, 'r')
|
||||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)));
|
->leftJoin('r', 'bbb_room_shares', 's', $qb->expr()->eq('r.id', 's.room_id'))
|
||||||
|
->addSelect($qb->createFunction('count(case when "s"."permission" = 0 then 1 else null end) as shared'))
|
||||||
|
->where($qb->expr()->eq('r.id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
|
||||||
|
->groupBy('r.id');
|
||||||
|
;
|
||||||
|
|
||||||
/** @var Room */
|
/** @var Room */
|
||||||
return $this->findEntity($qb);
|
return $this->findEntity($qb);
|
||||||
|
@ -34,9 +38,13 @@ class RoomMapper extends QBMapper {
|
||||||
public function findByUid(string $uid): Room {
|
public function findByUid(string $uid): Room {
|
||||||
/* @var $qb IQueryBuilder */
|
/* @var $qb IQueryBuilder */
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->select('*')
|
$qb->select('r.*')
|
||||||
->from($this->tableName)
|
->from($this->tableName, 'r')
|
||||||
->where($qb->expr()->eq('uid', $qb->createNamedParameter($uid)));
|
->leftJoin('r', 'bbb_room_shares', 's', $qb->expr()->eq('r.id', 's.room_id'))
|
||||||
|
->addSelect($qb->createFunction('count(case when "s"."permission" = 0 then 1 else null end) as shared'))
|
||||||
|
->where($qb->expr()->eq('r.uid', $qb->createNamedParameter($uid)))
|
||||||
|
->groupBy('r.id');
|
||||||
|
;
|
||||||
|
|
||||||
/** @var Room */
|
/** @var Room */
|
||||||
return $this->findEntity($qb);
|
return $this->findEntity($qb);
|
||||||
|
@ -51,6 +59,7 @@ class RoomMapper extends QBMapper {
|
||||||
$qb->select('r.*')
|
$qb->select('r.*')
|
||||||
->from($this->tableName, 'r')
|
->from($this->tableName, 'r')
|
||||||
->leftJoin('r', 'bbb_room_shares', 's', $qb->expr()->eq('r.id', 's.room_id'))
|
->leftJoin('r', 'bbb_room_shares', 's', $qb->expr()->eq('r.id', 's.room_id'))
|
||||||
|
->addSelect($qb->createFunction('count(case when "s"."permission" = 0 then 1 else null end) as shared'))
|
||||||
->where(
|
->where(
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->eq('r.user_id', $qb->createNamedParameter($userId)),
|
$qb->expr()->eq('r.user_id', $qb->createNamedParameter($userId)),
|
||||||
|
|
|
@ -37,6 +37,7 @@ export interface Room {
|
||||||
password?: string;
|
password?: string;
|
||||||
everyoneIsModerator: boolean;
|
everyoneIsModerator: boolean;
|
||||||
requireModerator: boolean;
|
requireModerator: boolean;
|
||||||
|
shared: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RoomShare {
|
export interface RoomShare {
|
||||||
|
|
|
@ -44,6 +44,14 @@ const EditRoomDialog: React.FC<Props> = ({ room, restriction, updateProperty, op
|
||||||
});
|
});
|
||||||
}, [room.id, open]);
|
}, [room.id, open]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!shares) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateProperty('shared', shares.filter(share => share.permission === Permission.Admin).length > 0);
|
||||||
|
}, [shares]);
|
||||||
|
|
||||||
function inputElement(label: string, field: string, type: 'text' | 'number' = 'text') {
|
function inputElement(label: string, field: string, type: 'text' | 'number' = 'text') {
|
||||||
return (
|
return (
|
||||||
<div className="bbb-form-element">
|
<div className="bbb-form-element">
|
||||||
|
|
|
@ -187,6 +187,7 @@ const RoomRow: React.FC<Props> = (props) => {
|
||||||
</td>
|
</td>
|
||||||
<td className="bbb-shrink">
|
<td className="bbb-shrink">
|
||||||
{room.userId !== OC.currentUser && <img src={avatarUrl} alt="Avatar" className="bbb-avatar" />}
|
{room.userId !== OC.currentUser && <img src={avatarUrl} alt="Avatar" className="bbb-avatar" />}
|
||||||
|
{(room.userId === OC.currentUser && room.shared) && <span className="icon icon-shared icon-visible"/>}
|
||||||
</td>
|
</td>
|
||||||
<td className="max-participants bbb-shrink">
|
<td className="max-participants bbb-shrink">
|
||||||
{edit('maxParticipants', 'number', {min: minParticipantsLimit, max: maxParticipantsLimit < 0 ? undefined : maxParticipantsLimit})}
|
{edit('maxParticipants', 'number', {min: minParticipantsLimit, max: maxParticipantsLimit < 0 ? undefined : maxParticipantsLimit})}
|
||||||
|
|
Loading…
Reference in New Issue