Skip to content

Commit

Permalink
Merge pull request #216 from ChrisTurk/master
Browse files Browse the repository at this point in the history
 Don't duplicate detailed HIT breakdown overlays if TVJS exists
  • Loading branch information
kadauchi committed Mar 22, 2019
2 parents 1a93463 + df439ae commit 0bdabbe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion background/turkerview.js
Expand Up @@ -49,7 +49,6 @@ async function GET_HIT_STATS({ payload }, sendResponse) {
});
}


chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
switch (request.type) {
case `GET_RETURN_REVIEWS`:
Expand Down
9 changes: 9 additions & 0 deletions mturk/turkerview/hit-reviews.js
Expand Up @@ -198,6 +198,15 @@ async function getDetailedHitData(requester_id, reward, title, assignableHitsCou
}

async function initHitReview(){
const tv_storage_check = localStorage.getItem(`tv-settings`) || null;

if (tv_storage_check){
const tv_last_active = moment(JSON.parse(tv_storage_check).last_sync).tz('America/Los_Angeles');
const diff = moment().tz('America/Los_Angeles').diff(tv_last_active, 'hours')
// TVJS is still installed on this user's machine (most likely) - don't add a 2nd return review dialog, we'll have TVJS defer to MTS later
if (diff < 36) return;
}

const [dom, props] = await Promise.all([
ReactDOM(`ShowModal`),
ReactProps(`ShowModal`)
Expand Down
2 changes: 1 addition & 1 deletion mturk/turkerview/return-reviews.js
Expand Up @@ -300,7 +300,7 @@ function returnsApiExceptionHandler(exception){

async function initReturnReviews(){

const tv_storage_check = localStorage.getItem(`ztv-settings`) || null;
const tv_storage_check = localStorage.getItem(`tv-settings`) || null;

if (tv_storage_check){
const tv_last_active = moment(JSON.parse(tv_storage_check).last_sync).tz('America/Los_Angeles');
Expand Down

0 comments on commit 0bdabbe

Please sign in to comment.