Skip to content

Commit

Permalink
chore: temporary disable reporter key
Browse files Browse the repository at this point in the history
  • Loading branch information
eranshmil committed Mar 20, 2019
1 parent 8fb0e41 commit 815bcd8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "botz",
"description": "Recognizes suspicious social media behavior.",
"version": "1.0.0",
"version": "1.0.5",
"repository": "https://github.com/botim/botz.git",
"license": "GPL-3.0",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ browser.runtime.onMessage.addListener((message, _, respond) => {
}

if (message.type === MessageTypes.REPORT) {
const { reporterKey, ...body } = message.body;
// const { reporterKey, ...body } = message.body;
const { body } = message;
const reporterKey = 'Bots-R-us';
return onReportMessage(body, reporterKey);
}
});
6 changes: 3 additions & 3 deletions src/core/api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export class ApiService {
}

public async report(body: any): Promise<boolean> {
if (!body.reporterKey) {
throw new Error('מפתח מדווח חסר או שגוי');
}
// if (!body.reporterKey) {
// throw new Error('מפתח מדווח חסר או שגוי');
// }

const responseStatus: number = await window.browser.runtime.sendMessage({
type: MessageTypes.REPORT,
Expand Down
32 changes: 16 additions & 16 deletions src/core/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { ObjectKeyMap, UserData } from './symbols';
import { Parser } from '../parsers';

const STORAGE_REPORTER_KEY = 'botzReporterKey';
// const STORAGE_REPORTER_KEY = 'botzReporterKey';

/**
* Create a link element to report a user.
Expand All @@ -29,11 +29,11 @@ export function createReportButton(parser: Parser): HTMLElement {

if (input) {
try {
window.localStorage[STORAGE_REPORTER_KEY] = input.reporterKey;
// window.localStorage[STORAGE_REPORTER_KEY] = input.reporterKey;
await parser.reportUser(input);
} catch (error) {
delete window.localStorage[STORAGE_REPORTER_KEY];
openModal('invalid-reporter-key');
// delete window.localStorage[STORAGE_REPORTER_KEY];
// openModal('invalid-reporter-key');
}
}
});
Expand Down Expand Up @@ -65,17 +65,17 @@ export async function loadTemplate(name: string, data?: Partial<UserData>): Prom
* If there's already a reporter key in local storage,
* set it in form and hide reporter key input
*/
function initReporterKeyInput(modalWrapperElement: Element) {
const reporterKeyInput: HTMLInputElement = modalWrapperElement.querySelector(
'[name="reporterKey"]'
);
const reporterKey = window.localStorage[STORAGE_REPORTER_KEY] || null;

if (reporterKey) {
reporterKeyInput.value = reporterKey;
reporterKeyInput.classList.add(MODAL_HIDE_REPORTER_KEY_CLASS);
}
}
// function initReporterKeyInput(modalWrapperElement: Element) {
// const reporterKeyInput: HTMLInputElement = modalWrapperElement.querySelector(
// '[name="reporterKey"]'
// );
// const reporterKey = window.localStorage[STORAGE_REPORTER_KEY] || null;

// if (reporterKey) {
// reporterKeyInput.value = reporterKey;
// reporterKeyInput.classList.add(MODAL_HIDE_REPORTER_KEY_CLASS);
// }
// }

/**
* Open modal on the screen and send form data to server.
Expand Down Expand Up @@ -124,7 +124,7 @@ export async function openModal(
.querySelector(`.${MODAL_CLOSE_CLASS}`)
.addEventListener('click', () => modalWrapperElement.remove());

initReporterKeyInput(modalWrapperElement);
// initReporterKeyInput(modalWrapperElement);
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "Botz",
"version": "1.0",
"description": "Recognizes suspicious social media behavior.",
"version": "1.0.5",
"description": "פרויקט הבוטים הגדול מוקדש לזהות פעילויות לא אורגניות בפלטפורמות החברתיות.",
"icons": {
"16": "images/icon16.png",
"48": "images/icon48.png",
Expand Down
6 changes: 3 additions & 3 deletions src/styles/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
margin: 0 0 12px 0;
}

input[name='reporterKey'].hidden {
display: none;
}
// input[name='reporterKey'].hidden {
// display: none;
// }
}
4 changes: 2 additions & 2 deletions src/templates/report-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<div class="botz-modal-title">מדוע אתם מדווחים על החשבון {{ username }}?</div>

<div class="botz-modal-content">
<p>
<!-- <p>
<input type="text" name="reporterKey" placeholder="מפתח מדווח" class="botz-input" />
</p>
</p> -->
<p>
<label class="botz-checkbox">
<input type="checkbox" name="reasons" value="BOT" checked /> בוט אוטומטי
Expand Down

0 comments on commit 815bcd8

Please sign in to comment.