Fix ViewImageModals created by RHS posts so that their ids are distinct from those in the main window
Этот коммит содержится в:
@@ -8,7 +8,7 @@ module.exports = React.createClass({
|
|||||||
propTypes: {
|
propTypes: {
|
||||||
filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
|
filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
|
||||||
index: React.PropTypes.number.isRequired,
|
index: React.PropTypes.number.isRequired,
|
||||||
imageModalId: React.PropTypes.string.isRequired,
|
modalId: React.PropTypes.string.isRequired,
|
||||||
handleImageClick: React.PropTypes.func
|
handleImageClick: React.PropTypes.func
|
||||||
},
|
},
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
@@ -66,7 +66,7 @@ module.exports = React.createClass({
|
|||||||
if (type === "image") {
|
if (type === "image") {
|
||||||
thumbnail = (
|
thumbnail = (
|
||||||
<a className="post-image__thumbnail" href="#" onClick={this.props.handleImageClick}
|
<a className="post-image__thumbnail" href="#" onClick={this.props.handleImageClick}
|
||||||
data-img-id={this.props.index} data-toggle="modal" data-target={"#" + this.props.imageModalId }>
|
data-img-id={this.props.index} data-toggle="modal" data-target={"#" + this.props.modalId }>
|
||||||
<div ref={filename} className="post__load" style={{backgroundImage: 'url(/static/images/load.gif)'}}/>
|
<div ref={filename} className="post__load" style={{backgroundImage: 'url(/static/images/load.gif)'}}/>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ module.exports = React.createClass({
|
|||||||
displayName: "FileAttachmentList",
|
displayName: "FileAttachmentList",
|
||||||
propTypes: {
|
propTypes: {
|
||||||
filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
|
filenames: React.PropTypes.arrayOf(React.PropTypes.string).isRequired,
|
||||||
postId: React.PropTypes.string.isRequired,
|
modalId: React.PropTypes.string.isRequired,
|
||||||
channelId: React.PropTypes.string,
|
channelId: React.PropTypes.string,
|
||||||
userId: React.PropTypes.string
|
userId: React.PropTypes.string
|
||||||
},
|
},
|
||||||
@@ -18,12 +18,11 @@ module.exports = React.createClass({
|
|||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var filenames = this.props.filenames;
|
var filenames = this.props.filenames;
|
||||||
|
var modalId = this.props.modalId;
|
||||||
var postImageModalId = "view_image_modal_" + this.props.postId;
|
|
||||||
|
|
||||||
var postFiles = [];
|
var postFiles = [];
|
||||||
for (var i = 0; i < filenames.length && i < Constants.MAX_DISPLAY_FILES; i++) {
|
for (var i = 0; i < filenames.length && i < Constants.MAX_DISPLAY_FILES; i++) {
|
||||||
postFiles.push(<FileAttachment key={i} filenames={filenames} index={i} imageModalId={postImageModalId} handleImageClick={this.handleImageClick} />);
|
postFiles.push(<FileAttachment key={i} filenames={filenames} index={i} modalId={modalId} handleImageClick={this.handleImageClick} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -34,7 +33,7 @@ module.exports = React.createClass({
|
|||||||
<ViewImageModal
|
<ViewImageModal
|
||||||
channelId={this.props.channelId}
|
channelId={this.props.channelId}
|
||||||
userId={this.props.userId}
|
userId={this.props.userId}
|
||||||
modalId={postImageModalId}
|
modalId={modalId}
|
||||||
startId={this.state.startImgId}
|
startId={this.state.startImgId}
|
||||||
imgCount={0}
|
imgCount={0}
|
||||||
filenames={filenames} />
|
filenames={filenames} />
|
||||||
|
|||||||
@@ -70,10 +70,10 @@ module.exports = React.createClass({
|
|||||||
<p key={post.id+"_message"} className={postClass}><span>{inner}</span></p>
|
<p key={post.id+"_message"} className={postClass}><span>{inner}</span></p>
|
||||||
{ filenames && filenames.length > 0 ?
|
{ filenames && filenames.length > 0 ?
|
||||||
<FileAttachmentList
|
<FileAttachmentList
|
||||||
postId={post.id}
|
filenames={filenames}
|
||||||
|
modalId={"view_image_modal_" + post.id}
|
||||||
channelId={post.channel_id}
|
channelId={post.channel_id}
|
||||||
userId={post.user_id}
|
userId={post.user_id} />
|
||||||
filenames={filenames} />
|
|
||||||
: "" }
|
: "" }
|
||||||
{ embed }
|
{ embed }
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -104,10 +104,10 @@ RootPost = React.createClass({
|
|||||||
<p>{message}</p>
|
<p>{message}</p>
|
||||||
{ post.filenames && post.filenames.length > 0 ?
|
{ post.filenames && post.filenames.length > 0 ?
|
||||||
<FileAttachmentList
|
<FileAttachmentList
|
||||||
postId={post.id}
|
filenames={post.filenames}
|
||||||
|
modalId={"rhs_view_image_modal_" + post.id}
|
||||||
channelId={post.channel_id}
|
channelId={post.channel_id}
|
||||||
userId={post.user_id}
|
userId={post.user_id} />
|
||||||
filenames={post.filenames} />
|
|
||||||
: "" }
|
: "" }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -163,10 +163,10 @@ CommentPost = React.createClass({
|
|||||||
<p>{message}</p>
|
<p>{message}</p>
|
||||||
{ post.filenames && post.filenames.length > 0 ?
|
{ post.filenames && post.filenames.length > 0 ?
|
||||||
<FileAttachmentList
|
<FileAttachmentList
|
||||||
postId={post.id}
|
filenames={post.filenames}
|
||||||
|
modalId={"rhs_comment_view_image_modal_" + post.id}
|
||||||
channelId={post.channel_id}
|
channelId={post.channel_id}
|
||||||
userId={post.user_id}
|
userId={post.user_id} />
|
||||||
filenames={post.filenames} />
|
|
||||||
: "" }
|
: "" }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user