From b9e3b549b297f1e92f40ca872ab8c468a6529459 Mon Sep 17 00:00:00 2001 From: Ayushya Amitabh Date: Wed, 16 Sep 2020 14:17:55 -0400 Subject: [PATCH] v1.7.6/show player updated by --- app/src/Api.js | 2 +- app/src/Chat.js | 8 ++++++++ app/src/index.css | 3 +++ functions/modules/joinRoom.js | 14 +------------- functions/modules/leaveRoom.js | 2 ++ functions/modules/updatePlayer.js | 1 + website/styles/extralarge.css | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/src/Api.js b/app/src/Api.js index e91fc02..7cdf823 100644 --- a/app/src/Api.js +++ b/app/src/Api.js @@ -14,7 +14,7 @@ COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION. let CHROME_OR_BROWSER = chrome || browser; -const API_HOST = 'https://api.chromewatchparty.com'; +const API_HOST = 'http://localhost:5001/watch-party-crx/us-central1/widgets'; export const PLAYER_STATUS = { PLAYING: 'PLAYING', diff --git a/app/src/Chat.js b/app/src/Chat.js index 5281fad..7745af4 100644 --- a/app/src/Chat.js +++ b/app/src/Chat.js @@ -712,6 +712,14 @@ export default class Chat extends Component { {player.showName && player.status !== PLAYER_STATUS.NOT_PLAYING ? ( + + Last updated by {player.updatedByName} + {player.status === PLAYER_STATUS.PAUSED ? `PAUSED AT ${this.getPrettyTime(player.time)}` diff --git a/app/src/index.css b/app/src/index.css index 1836a5c..3517b75 100644 --- a/app/src/index.css +++ b/app/src/index.css @@ -584,6 +584,9 @@ textarea::-webkit-scrollbar { font-size: 10px !important; padding-left: 3px !important; } +.media-info-at.updated-by { + font-size: 12px !important; +} .media-info-container { display: flex; flex-direction: row; diff --git a/functions/modules/joinRoom.js b/functions/modules/joinRoom.js index 7453fef..7c6149b 100644 --- a/functions/modules/joinRoom.js +++ b/functions/modules/joinRoom.js @@ -23,18 +23,6 @@ module.exports = async (req, res) => { }); if (exists && roomPin !== bodydata.partyPin) return res.status(401).send({ message: 'Incorrect party pin' }); - if (adminUid === bodydata.uid) { - await admin - .firestore() - .collection('rooms') - .doc(bodydata.partyName) - .collection('users') - .doc(bodydata.uid) - .set({ - admin: true, - name: bodydata.userName, - }); - } // GET IF USER EXISTS AND IS ADMIN const [userExists, userAdmin, userName] = await admin .firestore() @@ -101,7 +89,7 @@ module.exports = async (req, res) => { .collection('users') .doc(bodydata.uid) .set({ - admin: false, + admin: adminUid === bodydata.uid, name: bodydata.userName, }) .catch((err) => { diff --git a/functions/modules/leaveRoom.js b/functions/modules/leaveRoom.js index 214ead5..aaec588 100644 --- a/functions/modules/leaveRoom.js +++ b/functions/modules/leaveRoom.js @@ -2,6 +2,8 @@ const admin = require('firebase-admin'); module.exports = async (req, res) => { console.log('Requested Leave - UID - ', req.params.uid, '\n\tRoom - ', req.params.rid); + if (req.params.uid === 'undefined') return res.status(400).send({ message: 'No UID' }); + if (req.params.rid === 'undefined') return res.status(400).send({ message: 'No Party Name' }); const userName = await admin .firestore() .collection('rooms') diff --git a/functions/modules/updatePlayer.js b/functions/modules/updatePlayer.js index 78dfbd1..77c7f63 100644 --- a/functions/modules/updatePlayer.js +++ b/functions/modules/updatePlayer.js @@ -26,6 +26,7 @@ module.exports = async (req, res) => { } } if (roomData.status !== player.status) { + player.updatedByName = userName; await admin .firestore() .collection('rooms') diff --git a/website/styles/extralarge.css b/website/styles/extralarge.css index af899f9..3431549 100644 --- a/website/styles/extralarge.css +++ b/website/styles/extralarge.css @@ -63,7 +63,7 @@ body { .info { width: 70rem; - max-width: 70rem !important; + max-width: 70rem; display: inline-table; }