Merge pull request #448 from thecodingmachine/report-button

Report button discussion
This commit is contained in:
grégoire parant 2020-11-23 20:48:52 +01:00 committed by GitHub
commit c5af6df7fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -12,12 +12,14 @@ const URL_ROOM_STARTED = '/Floor0/floor0.json';
class ConnectionManager { class ConnectionManager {
private localUser!:LocalUser; private localUser!:LocalUser;
private connexionType?: GameConnexionTypes
/** /**
* Tries to login to the node server and return the starting map url to be loaded * Tries to login to the node server and return the starting map url to be loaded
*/ */
public async initGameConnexion(): Promise<Room> { public async initGameConnexion(): Promise<Room> {
const connexionType = urlManager.getGameConnexionType(); const connexionType = urlManager.getGameConnexionType();
this.connexionType = connexionType;
if(connexionType === GameConnexionTypes.register) { if(connexionType === GameConnexionTypes.register) {
const organizationMemberToken = urlManager.getOrganizationToken(); const organizationMemberToken = urlManager.getOrganizationToken();
const data = await Axios.post(`${API_URL}/register`, {organizationMemberToken}).then(res => res.data); const data = await Axios.post(`${API_URL}/register`, {organizationMemberToken}).then(res => res.data);
@ -108,6 +110,10 @@ class ConnectionManager {
}); });
}); });
} }
get getConnexionType(){
return this.connexionType;
}
} }
export const connectionManager = new ConnectionManager(); export const connectionManager = new ConnectionManager();

View File

@ -1,6 +1,9 @@
import {HtmlUtils} from "./HtmlUtils"; import {HtmlUtils} from "./HtmlUtils";
import {MediaManager, ReportCallback, UpdatedLocalStreamCallback} from "./MediaManager"; import {MediaManager, ReportCallback, UpdatedLocalStreamCallback} from "./MediaManager";
import {UserInputManager} from "../Phaser/UserInput/UserInputManager"; import {UserInputManager} from "../Phaser/UserInput/UserInputManager";
import {connectionManager} from "../Connexion/ConnectionManager";
import {GameConnexionTypes} from "../Url/UrlManager";
export type SendMessageCallback = (message:string) => void; export type SendMessageCallback = (message:string) => void;
export class DiscussionManager { export class DiscussionManager {
@ -115,7 +118,11 @@ export class DiscussionManager {
divParticipant.appendChild(divImgParticipant); divParticipant.appendChild(divImgParticipant);
divParticipant.appendChild(divPParticipant); divParticipant.appendChild(divPParticipant);
if(!isMe) { if(
!isMe
&& connectionManager.getConnexionType
&& connectionManager.getConnexionType !== GameConnexionTypes.anonymous
) {
const reportBanUserAction: HTMLButtonElement = document.createElement('button'); const reportBanUserAction: HTMLButtonElement = document.createElement('button');
reportBanUserAction.classList.add('report-btn') reportBanUserAction.classList.add('report-btn')
reportBanUserAction.innerText = 'Report'; reportBanUserAction.innerText = 'Report';