Task lists WIP:
* dropping role support, does not work.
This commit is contained in:
parent
4f8e11d17d
commit
a976b2a1d8
@ -25,8 +25,8 @@ converse.plugins.add('livechat-converse-tasks', {
|
||||
initOrDestroyChatRoomTaskLists(muc)
|
||||
})
|
||||
|
||||
// When the current user role changes, we must also delete or initilize the TaskLists object:
|
||||
muc.occupants.on('change:role', occupant => {
|
||||
// When the current user affiliation changes, we must also delete or initiliaze the TaskLists object:
|
||||
muc.occupants.on('change:affiliation', occupant => {
|
||||
if (occupant.get('jid') !== _converse.bare_jid) { // only for myself
|
||||
return
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ export function initOrDestroyChatRoomTaskLists (mucModel) {
|
||||
}
|
||||
|
||||
const myself = mucModel.getOwnOccupant()
|
||||
if (!myself || !myself.isModerator()) {
|
||||
// User must be moderator
|
||||
if (!myself || !['admin', 'owner'].includes(myself.get('affiliation'))) {
|
||||
// User must be admin or owner
|
||||
return _destroyChatRoomTaskLists(mucModel)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ This module is a custom module that provide some pubsub services associated to a
|
||||
This module is entended to be used in the peertube-plugin-livechat project.
|
||||
|
||||
For each MUC room, there will be an associated pubsub node.
|
||||
This node in only accessible by the ROOM moderators.
|
||||
This node in only accessible by the ROOM admin/owner.
|
||||
|
||||
This node can contains various objects:
|
||||
|
||||
@ -12,7 +12,7 @@ This node can contains various objects:
|
||||
* tasks
|
||||
* ... (more to come)
|
||||
|
||||
These objects are meant te be shared between moderators.
|
||||
These objects are meant te be shared between admin/owner.
|
||||
|
||||
This module is part of peertube-plugin-livechat, and is under the same LICENSE.
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
-- but here there are some differences:
|
||||
-- * there will be several nodes, using MUC JID+NodeID to access them
|
||||
-- (see https://xmpp.org/extensions/xep-0060.html#addressing-jid)
|
||||
-- * nodes can only be subscribed by room moderators,
|
||||
-- * nodes can only be subscribed by room admin/owner,
|
||||
-- * ...
|
||||
|
||||
-- Note: all room moderators will have 'publisher' access:
|
||||
-- Note: all room admin/owner will have 'publisher' access:
|
||||
-- so they can't modify configuration, affiliations or subscriptions.
|
||||
-- There will be no owner. FIXME: is this ok? will prosody accept? (the XEP-0060 says that there must be an owner).
|
||||
|
||||
@ -226,28 +226,18 @@ function get_mep_service(room_jid, room_host)
|
||||
get_affiliation = function (jid)
|
||||
-- module:log("debug", "get_affiliation call for %q", jid);
|
||||
-- First checking if there is an affiliation on the room for this JID.
|
||||
local actor_jid = jid_bare(jid);
|
||||
local room_affiliation = room:get_affiliation(actor_jid);
|
||||
local actor_bare_jid = jid_bare(jid);
|
||||
local room_affiliation = room:get_affiliation(actor_bare_jid);
|
||||
-- if user is banned, don't go any further
|
||||
if (room_affiliation == "outcast") then
|
||||
-- module:log("debug", "get_affiliation for %q: outcast (existing room affiliation)", jid);
|
||||
return "outcast";
|
||||
end
|
||||
if (room_affiliation == "owner" or room_affiliation == "admin") then
|
||||
-- module:log("debug", "get_affiliation for %q: publisher (because owner or admin affiliation)", jid);
|
||||
module:log("debug", "get_affiliation for %q: publisher (because owner or admin affiliation)", jid);
|
||||
return "publisher"; -- always publisher! (see notes at the beginning of this file)
|
||||
end
|
||||
|
||||
-- No permanent room affiliation... Checking role (for users currently connected to the room)
|
||||
local actor_nick = room:get_occupant_jid(jid);
|
||||
if (actor_nick ~= nil) then
|
||||
local role = room:get_role(actor_nick);
|
||||
if valid_roles[role or "none"] >= valid_roles.moderator then
|
||||
module:log("debug", "get_affiliation for %q: publisher (because of current role)", jid);
|
||||
return "publisher"; -- always publisher! (see notes at the beginning of this file)
|
||||
end
|
||||
end
|
||||
|
||||
-- no access!
|
||||
-- module:log("debug", "get_affiliation for %q: outcast", jid);
|
||||
return "outcast";
|
||||
|
Loading…
x
Reference in New Issue
Block a user