X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=empathy%2Fempathy.jsx;h=546df87acbbb0129f33deffc8e4996209460800d;hp=dcd558f9639c33d8ee70d555ec20f2490fef88b2;hb=d016635ce24d1502f77c610d1a4afbfeca3ec5e8;hpb=43f8d02fa5b415bb7543e46100fb30fc8dea5383 diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index dcd558f..546df87 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -393,6 +393,8 @@ class Ambiguities extends React.PureComponent { submitted: false, selected: null }; + + this.judging_sent_recently = false; } async handle_submit() { @@ -419,6 +421,17 @@ class Ambiguities extends React.PureComponent { } handle_click(word) { + + /* Let the server know we are doing some judging, (but rate limit + * this so we don't send a "judging" notification more frquently + * than necessary. + */ + if (! this.judging_sent_recently) { + fetch_post_json(`judging/${this.props.prompt.id}`); + this.judging_sent_recently = true; + setTimeout(() => { this.judging_sent_recently = false; }, 1000); + } + if (this.state.selected == word) { /* Second click on same word removes the word from the group. */ const idx = this.state.word_sets.findIndex(s => s.has(word)); @@ -478,7 +491,7 @@ class Ambiguities extends React.PureComponent { Still waiting for the following players: