@@ -255,7 +312,7 @@ function Comment(props) {
{enabledViewMoreContent ? (
@@ -370,12 +427,25 @@ export default function CommentsList(props) {
function onCommentsLoad() {
const retrievedComments = [...MediaPageStore.get('media-comments')];
- retrievedComments.forEach(comment => {
- comment.text = setTimestampAnchors(comment.text);
+ if (MediaCMS.features.media.actions.comment_mention === true)
+ {
+ retrievedComments.forEach(comment => {
+ comment.text = setMentions(comment.text);
});
-
- displayCommentsRelatedAlert();
- setComments(retrievedComments);
+ }
+ retrievedComments.forEach(comment => {
+ comment.text = setTimestampAnchors(comment.text);
+ });
+
+ displayCommentsRelatedAlert();
+ setComments(retrievedComments);
+ }
+
+ function setMentions(text)
+ {
+ let sanitizedComment = text.split('@(_').join("
");
+ return sanitizedComment.split('_]').join("");
}
function setTimestampAnchors(text)
diff --git a/frontend/src/static/js/components/comments/Comments.scss b/frontend/src/static/js/components/comments/Comments.scss
index e01afb55..99e64345 100755
--- a/frontend/src/static/js/components/comments/Comments.scss
+++ b/frontend/src/static/js/components/comments/Comments.scss
@@ -2,7 +2,7 @@
.comments-form-inner {
.form {
- .form-textarea-wrap {
+ .form-textarea-wrap{
border-color: var(--comments-textarea-wrapper-border-color);
&:after {
@@ -10,13 +10,20 @@
}
}
- .form-textarea {
+ .form-textarea, .form-textarea__input, .form-textarea__suggestions__list {
color: var(--comments-textarea-text-color);
&:placeholder {
color: var(--comments-textarea-text-placeholder-color);
}
}
+ .form-textarea__suggestions__list {
+ background-color: var(--body-bg-color);
+ }
+
+ strong {
+ background-color: var(--comment-text-mentions-background-color-highlight)
+ }
}
}
@@ -160,7 +167,7 @@
}
}
- .form-textarea {
+ .form-textarea, .form-textarea__input {
position: relative;
resize: none;
display: block;
@@ -204,7 +211,7 @@
text-decoration: none;
- .form-textarea {
+ .form-textarea, .form-textarea__input {
opacity: 0.5;
}
}
diff --git a/frontend/src/static/js/utils/settings/member.js b/frontend/src/static/js/utils/settings/member.js
index 9adbe8d7..5d1b3cde 100755
--- a/frontend/src/static/js/utils/settings/member.js
+++ b/frontend/src/static/js/utils/settings/member.js
@@ -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;
diff --git a/frontend/src/static/js/utils/stores/MediaPageStore.js b/frontend/src/static/js/utils/stores/MediaPageStore.js
index edbabe7d..cd12c741 100644
--- a/frontend/src/static/js/utils/stores/MediaPageStore.js
+++ b/frontend/src/static/js/utils/stores/MediaPageStore.js
@@ -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;
diff --git a/templates/config/installation/features.html b/templates/config/installation/features.html
index fc419bdc..79f2a4fe 100644
--- a/templates/config/installation/features.html
+++ b/templates/config/installation/features.html
@@ -22,6 +22,7 @@ MediaCMS.features = {
dislike: {% if CAN_DISLIKE_MEDIA %}true{% else %}false{% endif %},
download: true,
comment: true,
+ comment_mention: {% if CAN_MENTION_IN_COMMENTS %}true{% else %}false{% endif %},
save: true,
},
shareOptions: [ 'embed', 'fb', 'tw', 'whatsapp', 'telegram', 'reddit', 'tumblr', 'vk', 'pinterest', 'mix', 'linkedin', 'email' ],