|
|
@ -39,12 +39,12 @@ class Conference extends Model |
|
|
|
public function presences() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Presence', ['jid', 'session_id'], ['conference', 'session_id']) |
|
|
|
->where('resource', '!=', '') |
|
|
|
->where('value', '<', 5) |
|
|
|
->orderBy('mucrole') |
|
|
|
->orderBy('mucaffiliation', 'desc') |
|
|
|
->orderBy('value') |
|
|
|
->orderBy('resource'); |
|
|
|
->where('resource', '!=', '') |
|
|
|
->where('value', '<', 5) |
|
|
|
->orderBy('mucrole') |
|
|
|
->orderBy('mucaffiliation', 'desc') |
|
|
|
->orderBy('value') |
|
|
|
->orderBy('resource'); |
|
|
|
} |
|
|
|
|
|
|
|
public function mujiCalls() |
|
|
@ -61,82 +61,82 @@ class Conference extends Model |
|
|
|
public function unreads() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Message', 'jidfrom', 'conference') |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->whereNull('subject') |
|
|
|
->where('seen', false); |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->whereNull('subject') |
|
|
|
->where('seen', false); |
|
|
|
} |
|
|
|
|
|
|
|
public function quoted() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Message', 'jidfrom', 'conference') |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->whereNull('subject') |
|
|
|
->where('quoted', true) |
|
|
|
->where('seen', false); |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->whereNull('subject') |
|
|
|
->where('quoted', true) |
|
|
|
->where('seen', false); |
|
|
|
} |
|
|
|
|
|
|
|
public function presence() |
|
|
|
{ |
|
|
|
return $this->hasOne('App\Presence', ['jid', 'session_id'], ['conference', 'session_id']) |
|
|
|
->where('value', '<', 5) |
|
|
|
->where('mucjid', me()->id); |
|
|
|
->where('value', '<', 5) |
|
|
|
->where('mucjid', me()->id); |
|
|
|
} |
|
|
|
|
|
|
|
public function members() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Member', 'conference', 'conference') |
|
|
|
->orderBy('role') |
|
|
|
->orderBy('affiliation', 'desc'); |
|
|
|
->orderBy('role') |
|
|
|
->orderBy('affiliation', 'desc'); |
|
|
|
} |
|
|
|
|
|
|
|
public function activeMembers() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Member', 'conference', 'conference') |
|
|
|
->where('affiliation', '!=', 'outcast') |
|
|
|
->where('affiliation', '!=', 'none') |
|
|
|
->orderBy('role') |
|
|
|
->orderBy('affiliation', 'desc'); |
|
|
|
->where('affiliation', '!=', 'outcast') |
|
|
|
->where('affiliation', '!=', 'none') |
|
|
|
->orderBy('role') |
|
|
|
->orderBy('affiliation', 'desc'); |
|
|
|
} |
|
|
|
|
|
|
|
public function pictures() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Message', 'jidfrom', 'conference') |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->where('picture', true) |
|
|
|
->where('retracted', false) |
|
|
|
->orderBy('published', 'desc'); |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->where('picture', true) |
|
|
|
->where('retracted', false) |
|
|
|
->orderBy('published', 'desc'); |
|
|
|
} |
|
|
|
|
|
|
|
public function links() |
|
|
|
{ |
|
|
|
return $this->hasMany('App\Message', 'jidfrom', 'conference') |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->whereNotNull('urlid') |
|
|
|
->where('picture', false) |
|
|
|
->where('retracted', false) |
|
|
|
->orderBy('published', 'desc'); |
|
|
|
->where('user_id', me()->id) |
|
|
|
->where('type', 'groupchat') |
|
|
|
->whereNotNull('urlid') |
|
|
|
->where('picture', false) |
|
|
|
->where('retracted', false) |
|
|
|
->orderBy('published', 'desc'); |
|
|
|
} |
|
|
|
|
|
|
|
public function info() |
|
|
|
{ |
|
|
|
return $this->hasOne('App\Info', 'server', 'conference') |
|
|
|
->where(function ($query) { |
|
|
|
$query->where('node', function ($query) { |
|
|
|
$query->select('node') |
|
|
|
->from('presences') |
|
|
|
->where('session_id', me()->session->id) |
|
|
|
->whereColumn('jid', 'infos.server') |
|
|
|
->where('resource', '') |
|
|
|
->take(1); |
|
|
|
}) |
|
|
|
->orWhere('node', ''); |
|
|
|
}) |
|
|
|
->whereCategory('conference') |
|
|
|
->whereType('text'); |
|
|
|
->where(function ($query) { |
|
|
|
$query->where('node', function ($query) { |
|
|
|
$query->select('node') |
|
|
|
->from('presences') |
|
|
|
->where('session_id', me()->session->id) |
|
|
|
->whereColumn('jid', 'infos.server') |
|
|
|
->where('resource', '') |
|
|
|
->take(1); |
|
|
|
}) |
|
|
|
->orWhere('node', ''); |
|
|
|
}) |
|
|
|
->whereCategory('conference') |
|
|
|
->whereType('text'); |
|
|
|
} |
|
|
|
|
|
|
|
public function contact() |
|
|
@ -153,16 +153,18 @@ class Conference extends Model |
|
|
|
$this->bookmarkversion = (int)substr((string)$item->conference->attributes()->xmlns, -1, 1); |
|
|
|
|
|
|
|
if ($item->conference->extensions) { |
|
|
|
if ($item->conference->extensions && $item->conference->extensions->notifications |
|
|
|
&& $item->conference->extensions->notifications->attributes()->xmlns == self::$xmlnsNotifications) { |
|
|
|
$this->notify = (int)array_flip(self::$notifications)[ |
|
|
|
(string)$item->conference->extensions->notifications->attributes()->notify |
|
|
|
]; |
|
|
|
if ( |
|
|
|
$item->conference->extensions && $item->conference->extensions->notifications |
|
|
|
&& $item->conference->extensions->notifications->attributes()->xmlns == self::$xmlnsNotifications |
|
|
|
) { |
|
|
|
$this->notify = (int)array_flip(self::$notifications)[(string)$item->conference->extensions->notifications->attributes()->notify]; |
|
|
|
unset($item->conference->extensions->notifications); |
|
|
|
} |
|
|
|
|
|
|
|
if ($item->conference->extensions && $item->conference->extensions->pinned |
|
|
|
&& in_array($item->conference->extensions->pinned->attributes()->xmlns, [self::$xmlnsPinned, 'xmpp:movim.eu/pinned:0'])) { |
|
|
|
if ( |
|
|
|
$item->conference->extensions && $item->conference->extensions->pinned |
|
|
|
&& in_array($item->conference->extensions->pinned->attributes()->xmlns, [self::$xmlnsPinned, 'xmpp:movim.eu/pinned:0']) |
|
|
|
) { |
|
|
|
$this->pinned = true; |
|
|
|
unset($item->conference->extensions->pinned); |
|
|
|
} |
|
|
@ -212,13 +214,13 @@ class Conference extends Model |
|
|
|
public function getSubjectAttribute() |
|
|
|
{ |
|
|
|
$subject = me() |
|
|
|
->messages() |
|
|
|
->jid($this->conference) |
|
|
|
->whereNotNull('subject') |
|
|
|
->whereNull('body') |
|
|
|
->where('type', 'groupchat') |
|
|
|
->orderBy('published', 'desc') |
|
|
|
->first(); |
|
|
|
->messages() |
|
|
|
->jid($this->conference) |
|
|
|
->whereNotNull('subject') |
|
|
|
->whereNull('body') |
|
|
|
->where('type', 'groupchat') |
|
|
|
->orderBy('published', 'desc') |
|
|
|
->first(); |
|
|
|
|
|
|
|
return $subject ? $subject->subject : null; |
|
|
|
} |
|
|
@ -243,7 +245,9 @@ class Conference extends Model |
|
|
|
public function currentMuji(): ?MujiCall |
|
|
|
{ |
|
|
|
return $this->mujiCalls->filter( |
|
|
|
function ($muji) { return $muji->joined; } |
|
|
|
function ($muji) { |
|
|
|
return $muji->joined; |
|
|
|
} |
|
|
|
)->first(); |
|
|
|
} |
|
|
|
|
|
|
|