Added additional class to the markup indicating if the post came from the current user
Этот коммит содержится в:
@@ -6,6 +6,7 @@ var PostBody = require('./post_body.jsx');
|
|||||||
var PostInfo = require('./post_info.jsx');
|
var PostInfo = require('./post_info.jsx');
|
||||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||||
var Constants = require('../utils/constants.jsx');
|
var Constants = require('../utils/constants.jsx');
|
||||||
|
var UserStore = require('../stores/user_store.jsx');
|
||||||
var ActionTypes = Constants.ActionTypes;
|
var ActionTypes = Constants.ActionTypes;
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
@@ -56,7 +57,7 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
var error = this.state.error ? <div className='form-group has-error'><label className='control-label'>{ this.state.error }</label></div> : null;
|
var error = this.state.error ? <div className='form-group has-error'><label className='control-label'>{ this.state.error }</label></div> : null;
|
||||||
|
|
||||||
if(this.props.sameRoot){
|
if (this.props.sameRoot){
|
||||||
rootUser = "same--root";
|
rootUser = "same--root";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -64,13 +65,18 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
var postType = "";
|
var postType = "";
|
||||||
if(type != "Post"){
|
if (type != "Post"){
|
||||||
postType = "post--comment";
|
postType = "post--comment";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentUser = "";
|
||||||
|
if (UserStore.getCurrentId() === post.user_id) {
|
||||||
|
currentUser = "current--user";
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div id={post.id} className={"post " + this.props.sameUser + " " + rootUser + " " + postType}>
|
<div id={post.id} className={"post " + this.props.sameUser + " " + rootUser + " " + postType + " " + currentUser}>
|
||||||
{ !this.props.hideProfilePic ?
|
{ !this.props.hideProfilePic ?
|
||||||
<div className="post-profile-img__container">
|
<div className="post-profile-img__container">
|
||||||
<img className="post-profile-img" src={"/api/v1/users/" + post.user_id + "/image"} height="36" width="36" />
|
<img className="post-profile-img" src={"/api/v1/users/" + post.user_id + "/image"} height="36" width="36" />
|
||||||
|
|||||||
@@ -68,9 +68,14 @@ RootPost = React.createClass({
|
|||||||
var filenames = this.props.post.filenames;
|
var filenames = this.props.post.filenames;
|
||||||
var isOwner = UserStore.getCurrentId() == this.props.post.user_id;
|
var isOwner = UserStore.getCurrentId() == this.props.post.user_id;
|
||||||
|
|
||||||
var type = "Post"
|
var type = "Post";
|
||||||
if (this.props.post.root_id.length > 0) {
|
if (this.props.post.root_id.length > 0) {
|
||||||
type = "Comment"
|
type = "Comment";
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentUser = "";
|
||||||
|
if (UserStore.getCurrentId() === this.props.post.user_id) {
|
||||||
|
currentUser = "current--user";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filenames) {
|
if (filenames) {
|
||||||
@@ -84,7 +89,7 @@ RootPost = React.createClass({
|
|||||||
if (fileSplit.length < 2) continue;
|
if (fileSplit.length < 2) continue;
|
||||||
|
|
||||||
var ext = fileSplit[fileSplit.length-1];
|
var ext = fileSplit[fileSplit.length-1];
|
||||||
fileSplit.splice(fileSplit.length-1,1)
|
fileSplit.splice(fileSplit.length-1,1);
|
||||||
var filePath = fileSplit.join('.');
|
var filePath = fileSplit.join('.');
|
||||||
var filename = filePath.split('/')[filePath.split('/').length-1];
|
var filename = filePath.split('/')[filePath.split('/').length-1];
|
||||||
|
|
||||||
@@ -111,7 +116,7 @@ RootPost = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="post post--root">
|
<div className={"post post--root " + currentUser}>
|
||||||
<div className="post-profile-img__container">
|
<div className="post-profile-img__container">
|
||||||
<img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
|
<img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
|
||||||
</div>
|
</div>
|
||||||
@@ -170,6 +175,11 @@ CommentPost = React.createClass({
|
|||||||
|
|
||||||
var commentClass = "post";
|
var commentClass = "post";
|
||||||
|
|
||||||
|
var currentUser = "";
|
||||||
|
if (UserStore.getCurrentId() === this.props.post.user_id) {
|
||||||
|
currentUser = "current--user";
|
||||||
|
}
|
||||||
|
|
||||||
var postImageModalId = "rhs_comment_view_image_modal_" + this.props.post.id;
|
var postImageModalId = "rhs_comment_view_image_modal_" + this.props.post.id;
|
||||||
var filenames = this.props.post.filenames;
|
var filenames = this.props.post.filenames;
|
||||||
var isOwner = UserStore.getCurrentId() == this.props.post.user_id;
|
var isOwner = UserStore.getCurrentId() == this.props.post.user_id;
|
||||||
@@ -219,7 +229,7 @@ CommentPost = React.createClass({
|
|||||||
var message = utils.textToJsx(this.props.post.message);
|
var message = utils.textToJsx(this.props.post.message);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={commentClass}>
|
<div className={commentClass + " " + currentUser}>
|
||||||
<div className="post-profile-img__container">
|
<div className="post-profile-img__container">
|
||||||
<img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
|
<img className="post-profile-img" src={"/api/v1/users/" + this.props.post.user_id + "/image"} height="36" width="36" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user