mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-23 14:53:50 -05:00
@@ -18,6 +18,7 @@ export function init(user, features) {
|
||||
deleteProfile: false,
|
||||
readComment: true,
|
||||
addComment: false,
|
||||
mentionComment: false,
|
||||
deleteComment: false,
|
||||
editMedia: false,
|
||||
deleteMedia: false,
|
||||
@@ -60,6 +61,7 @@ export function init(user, features) {
|
||||
|
||||
MEMBER.can.deleteProfile = true === user.can.deleteProfile;
|
||||
MEMBER.can.addComment = true === user.can.addComment;
|
||||
MEMBER.can.mentionComment = true === user.can.mentionComment;
|
||||
MEMBER.can.deleteComment = true === user.can.deleteComment;
|
||||
MEMBER.can.editMedia = true === user.can.editMedia;
|
||||
MEMBER.can.deleteMedia = true === user.can.deleteMedia;
|
||||
@@ -100,6 +102,7 @@ export function init(user, features) {
|
||||
const mediaActions = features.media.actions;
|
||||
|
||||
MEMBER.can.addComment = MEMBER.can.addComment && true === mediaActions.comment;
|
||||
MEMBER.can.mentionComment = MEMBER.can.mentionComment && true === mediaActions.comment_mention;
|
||||
|
||||
MEMBER.can.likeMedia = false === mediaActions.like ? false : true;
|
||||
MEMBER.can.dislikeMedia = false === mediaActions.dislike ? false : true;
|
||||
|
||||
@@ -51,6 +51,7 @@ class MediaPageStore extends EventEmitter {
|
||||
|
||||
this.pagePlaylistId = null;
|
||||
this.pagePlaylistData = null;
|
||||
this.userList = null;
|
||||
|
||||
MediaPageStoreData[
|
||||
Object.defineProperty(this, 'id', { value: 'MediaPageStoreData_' + Object.keys(MediaPageStoreData).length }).id
|
||||
@@ -158,6 +159,12 @@ class MediaPageStore extends EventEmitter {
|
||||
getRequest(this.commentsAPIUrl, !1, this.commentsResponse);
|
||||
}
|
||||
|
||||
loadUsers() {
|
||||
this.usersAPIUrl = this.mediacms_config.api.users;
|
||||
this.usersResponse = this.usersResponse.bind(this);
|
||||
getRequest(this.usersAPIUrl, !1, this.usersResponse);
|
||||
}
|
||||
|
||||
loadPlaylists() {
|
||||
if (!this.mediacms_config.member.can.saveMedia) {
|
||||
return;
|
||||
@@ -187,6 +194,7 @@ class MediaPageStore extends EventEmitter {
|
||||
}
|
||||
|
||||
this.loadPlaylists();
|
||||
this.loadUsers();
|
||||
|
||||
if (this.mediacms_config.member.can.readComment) {
|
||||
this.loadComments();
|
||||
@@ -215,6 +223,13 @@ class MediaPageStore extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
usersResponse(response) {
|
||||
if (response && response.data) {
|
||||
MediaPageStoreData.userList = response.data.count ? response.data.results : [];
|
||||
this.emit('users_load');
|
||||
}
|
||||
}
|
||||
|
||||
playlistsResponse(response) {
|
||||
if (response && response.data) {
|
||||
let tmp_playlists = response.data.count ? response.data.results : [];
|
||||
@@ -403,6 +418,9 @@ class MediaPageStore extends EventEmitter {
|
||||
i,
|
||||
r = null;
|
||||
switch (type) {
|
||||
case 'users':
|
||||
r = MediaPageStoreData.userList || [];
|
||||
break;
|
||||
case 'playlists':
|
||||
r = MediaPageStoreData[this.id].playlists || [];
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user