mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-12-24 09:58:51 +00:00
Load users presence
This commit is contained in:
parent
8705fc6581
commit
5f5f27e79d
7
assets/css/pages/groups/pages/presence.css
Normal file
7
assets/css/pages/groups/pages/presence.css
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Groups presence stylesheet
|
||||
*
|
||||
* This is a Forez feature
|
||||
*
|
||||
* @author Pierre Hubert
|
||||
*/
|
32
assets/js/components/presence/PresenceHelper.js
Normal file
32
assets/js/components/presence/PresenceHelper.js
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Forez Presence Helper
|
||||
*
|
||||
* @author Pierre Hubert
|
||||
*/
|
||||
|
||||
class Presence {
|
||||
constructor(userID, year, month, day) {
|
||||
this.userID = userID;
|
||||
this.year = year;
|
||||
this.month = month;
|
||||
this.day = day;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ForezPresenceHelper {
|
||||
/**
|
||||
* Load the list of presence
|
||||
*
|
||||
* @param {number} groupID Target group ID
|
||||
* @returns {Promise<Presence[]>}
|
||||
*/
|
||||
static async GetList(groupID) {
|
||||
const list = await ws("forez_presence/list", {group: groupID});
|
||||
|
||||
return list.map(el => {
|
||||
const infos = el.split(",").map(e => Number(e));
|
||||
return new Presence(...infos)
|
||||
});
|
||||
}
|
||||
}
|
@ -119,6 +119,12 @@ const GroupsPage = {
|
||||
GroupConversationPage.show(conv, target)
|
||||
return;
|
||||
}
|
||||
|
||||
case "presence":
|
||||
if (group.is_forez_group) {
|
||||
await GroupPresencePage.Show(group, target)
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
ComunicWeb.common.error.pageNotFound(null, target);
|
||||
|
22
assets/js/pages/groups/pages/presence.js
Normal file
22
assets/js/pages/groups/pages/presence.js
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Group presence tab
|
||||
*
|
||||
* This is a Forez feature
|
||||
*
|
||||
* @author Pierre Hubert
|
||||
*/
|
||||
|
||||
class GroupPresencePage {
|
||||
/**
|
||||
* Show the page
|
||||
*
|
||||
* @param {AdvancedGroupInfo} group
|
||||
* @param {HTMLElement} target
|
||||
*/
|
||||
static async Show(group, target) {
|
||||
const presence = await ForezPresenceHelper.GetList(group.id);
|
||||
const users = await getUsers([...new Set(presence.map(e => e.userID))]);
|
||||
|
||||
console.error(presence, users)
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ const GroupTabs = {
|
||||
activePage: activePage,
|
||||
firstArgument: firstArgument,
|
||||
conversations: group.conversations,
|
||||
is_forez: group.is_forez_group
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -5,6 +5,9 @@
|
||||
<ul class="nav nav-tabs group-page-tabs" style="display: flex; flex-wrap: wrap; justify-content: start;">
|
||||
<li v-bind:class="activePage == 'posts' ? 'active': ''"><a @click="openPage('posts')">tr("Posts")</a></li>
|
||||
|
||||
<!-- Forez presence -->
|
||||
<li v-bind:class="activePage == 'presence' ? 'active': ''"><a @click="openPage('presence')" v-if="is_forez">tr("Presence")</a></li>
|
||||
|
||||
<!-- Group conversations -->
|
||||
<li v-for="conv in conversations" v-bind:class="activePage == 'conversation' && firstArgument == conv.id ? 'active': ''">
|
||||
<a @click="openPage('conversation/' + conv.id)">{{conv.name}}</a></li>
|
||||
|
@ -272,6 +272,7 @@ class Dev {
|
||||
"css/pages/groups/pages/members.css",
|
||||
"css/pages/groups/pages/forbidden.css",
|
||||
"css/pages/groups/pages/about.css",
|
||||
"css/pages/groups/pages/presence.css",
|
||||
|
||||
//Groups sections
|
||||
"css/pages/groups/sections/header.css",
|
||||
@ -495,6 +496,9 @@ class Dev {
|
||||
// Small media player
|
||||
"js/components/smallMediaPlayer.js",
|
||||
|
||||
// Presence helper
|
||||
"js/components/presence/PresenceHelper.js",
|
||||
|
||||
//User scripts
|
||||
"js/user/loginTokens.js",
|
||||
"js/user/userLogin.js",
|
||||
@ -539,6 +543,7 @@ class Dev {
|
||||
"js/pages/groups/pages/members.js",
|
||||
"js/pages/groups/pages/forbidden.js",
|
||||
"js/pages/groups/pages/about.js",
|
||||
"js/pages/groups/pages/presence.js",
|
||||
|
||||
//Groups sections
|
||||
"js/pages/groups/sections/header.js",
|
||||
|
Loading…
Reference in New Issue
Block a user