mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-08-31 16:22:06 +00:00
reply button
This commit is contained in:
parent
ad270cf3c6
commit
aa7e3bba10
File diff suppressed because it is too large
Load Diff
@ -29995,15 +29995,15 @@ TwisterAccount.prototype.post = function (msg,cbfunc) {
|
|||||||
msg
|
msg
|
||||||
],function(result){
|
],function(result){
|
||||||
|
|
||||||
var TwisterPost = require("../TwisterPost.js");
|
// var TwisterPost = require("../TwisterPost.js");
|
||||||
var data = {};
|
// var data = {};
|
||||||
data.n = thisAccount._name;
|
// data.n = thisAccount._name;
|
||||||
data.k = newid;
|
// data.k = newid;
|
||||||
data.time = Math.round(Date.now()/1000);
|
// data.time = Math.round(Date.now()/1000);
|
||||||
data.msg = msg;
|
// data.msg = msg;
|
||||||
var newpost = new TwisterPost(data,"",Twister);
|
// var newpost = new TwisterPost(data,"",Twister);
|
||||||
cbfunc(newpost);
|
// cbfunc(newpost);
|
||||||
Twister.getUser(thisAccount._name).doStatus(function(){},{outdatedLimit: 0});
|
Twister.getUser(thisAccount._name).doStatus(cbfunc,{outdatedLimit: 0});
|
||||||
},function(error){
|
},function(error){
|
||||||
thisAccount._handleError(error);
|
thisAccount._handleError(error);
|
||||||
});
|
});
|
||||||
@ -30031,16 +30031,16 @@ TwisterAccount.prototype.reply = function (replyusername,replyid,msg,cbfunc) {
|
|||||||
replyid
|
replyid
|
||||||
],function(result){
|
],function(result){
|
||||||
|
|
||||||
var TwisterPost = require("../TwisterPost.js");
|
// var TwisterPost = require("../TwisterPost.js");
|
||||||
var data = {};
|
// var data = {};
|
||||||
data.n = thisAccount._name;
|
// data.n = thisAccount._name;
|
||||||
data.k = newid;
|
// data.k = newid;
|
||||||
data.time = Math.round(Date.now()/1000);
|
// data.time = Math.round(Date.now()/1000);
|
||||||
data.msg = msg;
|
// data.msg = msg;
|
||||||
data.reply = { k: replyid, n: replyusername };
|
// data.reply = { k: replyid, n: replyusername };
|
||||||
var newpost = new TwisterPost(data,"",Twister);
|
// var newpost = new TwisterPost(data,"",Twister);
|
||||||
cbfunc(newpost);
|
// cbfunc(newpost);
|
||||||
Twister.getUser(thisAccount._name).doStatus(function(){},{outdatedLimit: 0});
|
Twister.getUser(thisAccount._name).doStatus(cbfunc,{outdatedLimit: 0});
|
||||||
},function(error){
|
},function(error){
|
||||||
thisAccount._handleError(error);
|
thisAccount._handleError(error);
|
||||||
});
|
});
|
||||||
@ -30068,15 +30068,15 @@ TwisterAccount.prototype.retwist = function (rtusername,rtid,cbfunc) {
|
|||||||
{ sig_userpost: post._signature, userpost: post._data }
|
{ sig_userpost: post._signature, userpost: post._data }
|
||||||
],function(result){
|
],function(result){
|
||||||
|
|
||||||
var TwisterPost = require("../TwisterPost.js");
|
// var TwisterPost = require("../TwisterPost.js");
|
||||||
var data = {};
|
// var data = {};
|
||||||
data.n = thisAccount._name;
|
// data.n = thisAccount._name;
|
||||||
data.k = newid;
|
// data.k = newid;
|
||||||
data.time = Math.round(Date.now()/1000);
|
// data.time = Math.round(Date.now()/1000);
|
||||||
data.rt = post._data;
|
// data.rt = post._data;
|
||||||
var newpost = new TwisterPost(data,"",Twister);
|
// var newpost = new TwisterPost(data,"",Twister);
|
||||||
cbfunc(newpost);
|
// cbfunc(newpost);
|
||||||
Twister.getUser(thisAccount._name).doStatus(function(){},{outdatedLimit: 0});
|
Twister.getUser(thisAccount._name).doStatus(cbfunc,{outdatedLimit: 0});
|
||||||
|
|
||||||
},function(error){
|
},function(error){
|
||||||
thisAccount._handleError(error);
|
thisAccount._handleError(error);
|
||||||
@ -30128,7 +30128,7 @@ TwisterAccount.prototype.doLatestDirectMessagesUntil = function (username, cbfun
|
|||||||
this.getDirectMessages(username)._doUntil(cbfunc, querySettings);
|
this.getDirectMessages(username)._doUntil(cbfunc, querySettings);
|
||||||
|
|
||||||
}
|
}
|
||||||
},{"../TwisterAvatar.js":143,"../TwisterPost.js":147,"../TwisterProfile.js":148,"../TwisterResource.js":152,"./TwisterDirectMessages.js":140,"./TwisterTorrent.js":141,"inherits":52}],140:[function(require,module,exports){
|
},{"../TwisterAvatar.js":143,"../TwisterProfile.js":148,"../TwisterResource.js":152,"./TwisterDirectMessages.js":140,"./TwisterTorrent.js":141,"inherits":52}],140:[function(require,module,exports){
|
||||||
var inherits = require('inherits');
|
var inherits = require('inherits');
|
||||||
|
|
||||||
var TwisterResource = require('../TwisterResource.js');
|
var TwisterResource = require('../TwisterResource.js');
|
||||||
@ -31464,8 +31464,6 @@ TwisterHashtag.prototype._queryAndDo = function (cbfunc, querySettings) {
|
|||||||
|
|
||||||
function (result) {
|
function (result) {
|
||||||
|
|
||||||
console.log(result)
|
|
||||||
|
|
||||||
var TwisterPost = require("./TwisterPost.js");
|
var TwisterPost = require("./TwisterPost.js");
|
||||||
|
|
||||||
for (i=0; i<result.length; i++) {
|
for (i=0; i<result.length; i++) {
|
||||||
|
@ -13,6 +13,7 @@ var React = require('react');
|
|||||||
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
|
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
|
||||||
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
||||||
var PostContent = require('../common/PostContent.js');
|
var PostContent = require('../common/PostContent.js');
|
||||||
|
var ReplyModalButton = require('../common/ReplyModalButton.js');
|
||||||
|
|
||||||
module.exports = Post = React.createClass({
|
module.exports = Post = React.createClass({
|
||||||
mixins: [SetIntervalMixin,SafeStateChangeMixin],
|
mixins: [SetIntervalMixin,SafeStateChangeMixin],
|
||||||
@ -95,6 +96,19 @@ module.exports = Post = React.createClass({
|
|||||||
var conversationLink = (<span/>);
|
var conversationLink = (<span/>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!post.isRetwist()) {
|
||||||
|
var replyLink = <OverlayTrigger placement='left' overlay={
|
||||||
|
<Tooltip>Reply</Tooltip>
|
||||||
|
}>
|
||||||
|
<small>
|
||||||
|
<ReplyModalButton replyUsername={post.getUsername()} replyPostId={post.getId()} activeAccount={this.props.activeAccount} originalMsg={post.getContent()} replyUserFullname={this.state.fullname}/>
|
||||||
|
</small>
|
||||||
|
</OverlayTrigger>
|
||||||
|
} else {
|
||||||
|
var replyLink = (<span/>);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListGroupItem>
|
<ListGroupItem>
|
||||||
<Row className="nomargin">
|
<Row className="nomargin">
|
||||||
@ -114,7 +128,12 @@ module.exports = Post = React.createClass({
|
|||||||
{retwist && <small><em> retwisted by {this.state.retwistingUser}</em></small>
|
{retwist && <small><em> retwisted by {this.state.retwistingUser}</em></small>
|
||||||
}
|
}
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={6} md={6} className="fullytight text-align-right">{conversationLink}</Col>
|
<Col xs={5} md={5} className="fullytight text-align-right">
|
||||||
|
{replyLink}
|
||||||
|
</Col>
|
||||||
|
<Col xs={1} md={1} className="fullytight text-align-right">
|
||||||
|
{conversationLink}
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
</ListGroupItem>
|
</ListGroupItem>
|
||||||
|
@ -16,9 +16,12 @@ var Post = require("../common/Post.js");
|
|||||||
|
|
||||||
module.exports = Postboard = React.createClass({
|
module.exports = Postboard = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
||||||
|
var activeAccount = this.props.activeAccount;
|
||||||
|
|
||||||
var posts = this.props.data.map(function(post, index) {
|
var posts = this.props.data.map(function(post, index) {
|
||||||
return (
|
return (
|
||||||
<Post post={post} key={post.postid} />
|
<Post post={post} key={post.postid} activeAccount={activeAccount}/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
84
jsx/common/ReplyModalButton.js
Normal file
84
jsx/common/ReplyModalButton.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
|
||||||
|
var ReactBootstrap = require('react-bootstrap')
|
||||||
|
, OverlayMixin = ReactBootstrap.OverlayMixin
|
||||||
|
, Button = ReactBootstrap.Button
|
||||||
|
, ButtonGroup = ReactBootstrap.ButtonGroup
|
||||||
|
, Glyphicon = ReactBootstrap.Glyphicon
|
||||||
|
, Modal = ReactBootstrap.Modal
|
||||||
|
, Input = ReactBootstrap.Input
|
||||||
|
|
||||||
|
var React = require('react');
|
||||||
|
|
||||||
|
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
||||||
|
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
|
||||||
|
var PostContent = require("../common/PostContent.js");
|
||||||
|
|
||||||
|
module.exports = ReplyModalButton = React.createClass({
|
||||||
|
mixins: [OverlayMixin],
|
||||||
|
getInitialState: function () {
|
||||||
|
return {
|
||||||
|
isModalOpen: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
handleToggle: function () {
|
||||||
|
this.setState({
|
||||||
|
isModalOpen: !this.state.isModalOpen
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleReply: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
//console.log(e)
|
||||||
|
var msg = JSON.parse(JSON.stringify(e.target[0].value));
|
||||||
|
if (!msg) {
|
||||||
|
console.log("empty post was passed as new post")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Twister.getAccount(this.props.activeAccount).reply(
|
||||||
|
this.props.replyUsername,
|
||||||
|
this.props.replyPostId,
|
||||||
|
msg,
|
||||||
|
function(post){
|
||||||
|
|
||||||
|
var event = new CustomEvent('newpostbyuser',{detail: post});
|
||||||
|
//alert("scrolled to bottom")
|
||||||
|
window.dispatchEvent(event);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
e.target[0].value = "";
|
||||||
|
|
||||||
|
|
||||||
|
this.handleToggle();
|
||||||
|
|
||||||
|
//React.findDOMNode(this.refs.msg).value = '';
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
render: function() {
|
||||||
|
return (
|
||||||
|
<a onClick={this.handleToggle} className="link-button-gray"><Glyphicon glyph='arrow-left' /></a>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
renderOverlay: function() {
|
||||||
|
|
||||||
|
if (!this.state.isModalOpen) {
|
||||||
|
return <span/>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal bsStyle='primary' title={
|
||||||
|
<Glyphicon glyph='arrow-left'/>
|
||||||
|
} onRequestHide={this.handleToggle}>
|
||||||
|
<div className='modal-body'>
|
||||||
|
<form onSubmit={this.handleReply}>
|
||||||
|
<strong>{this.props.replyUserFullname}</strong>
|
||||||
|
<PostContent content={this.props.originalMsg}/>
|
||||||
|
<Input type='textarea' label='' placeholder='textarea'/>
|
||||||
|
<Input type='submit' value='Reply' data-dismiss="modal" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
@ -180,7 +180,7 @@ module.exports = Home = React.createClass({
|
|||||||
Home
|
Home
|
||||||
<NewPostModalButton activeAccount={this.props.activeAccount}/>
|
<NewPostModalButton activeAccount={this.props.activeAccount}/>
|
||||||
</ListGroupItem>
|
</ListGroupItem>
|
||||||
} loading={this.state.loading}/>
|
} loading={this.state.loading} activeAccount={this.props.activeAccount}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
@ -88,14 +88,14 @@ module.exports = Timeline = React.createClass({
|
|||||||
|
|
||||||
//alert("got event")
|
//alert("got event")
|
||||||
|
|
||||||
if(this.state.username==event.post.getUsername()) {
|
if(this.state.username==event.detail.getUsername()) {
|
||||||
this.addPost(event.post);
|
this.addPost(event.detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<Postboard data={this.state.data} loading={this.state.loading}/>
|
<Postboard data={this.state.data} loading={this.state.loading} activeAccount={this.props.activeAccount}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user