Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Chat.jsx #894

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions web/app/components/Chat/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Comment extends React.Component {

render() {
let {comment, user, color} = this.props;
let systemUsers = [counterpart.translate("chat.welcome_user"), "SYSTEM"];
let systemUsers = [counterpart.translate("chat.welcome_user"), "SYSTEM", "TROLLBOT"];
return (
<div style={{padding: "3px 1px"}}>
<span
Expand Down Expand Up @@ -329,21 +329,25 @@ class Chat extends React.Component {
_onTipSuccess() {
let tip = this._parseTip();
let message = {
user: "SYSTEM",
user: "TROLLBOT",
message: this.props.currentAccount + " tipped " + tip.to + " " + tip.amount + " " + tip.asset,
color: "#B71A00"
};

// Public and local broadcast
this._broadCastMessage(message);
this._broadCastMessage(message, local = false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw an error because local is not defined here. The local flag is used in _broadCastMessage to also show the message locally, so the tip message is already being broadcast to all other users.

Copy link
Contributor Author

@nmywn nmywn Jan 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasnt working for me yesterday... I should test better before trying to "fix" something. All because chat history works not so good. I understand (not sure) that history is taken from first random peer, but some peers have more history than others. In consequence, if I'm really unlucky my history count is 0, no messages at all. This can perhaps work if trollbox being crowded, but for now it sucks. Would be very cool if I could read last 100 messages, not just 2. Something like if history < 100 {search peer with longest history} would be cool.


this.refs.input.value = "";
}

_parseTip() {
let parsed = this.refs.input.value.split(" ");

let memo;
let memo = "TROLLBOT: You have received tip!" // or more randomly choosen from MEME pool:
//TROLLBOT: Looks like someone's like you
//TROLLBOT: [Maybe funny joke here]
//TROLLBOT: [SMART FUNNY MESSAGE] // most preferable
//if someone want own memo.
if (parsed.length > 4) {
memo = "";
for (let i = 4; i < parsed.length; i++) {
Expand Down