Skip to content

Commit aac3668

Browse files
author
Bot
committed
change owner to admin
1 parent 26f4ffc commit aac3668

File tree

9 files changed

+48
-48
lines changed

9 files changed

+48
-48
lines changed

server/rooms.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ module.exports = (http) => {
5656

5757
const playerData = {
5858
...playerDataTemplate,
59-
name: data.ownerName,
60-
owner: true,
59+
name: data.adminName,
60+
admin: true,
6161
ready: true,
6262
};
6363

@@ -148,7 +148,7 @@ module.exports = (http) => {
148148
});
149149

150150
socket.on('reset', () => {
151-
if (rooms[roomName].players[socket.id].owner) {
151+
if (rooms[roomName].players[socket.id].admin) {
152152
console.warn(`room "${roomName}" reset`);
153153
io.in(roomName).emit('reset');
154154
}
@@ -161,9 +161,9 @@ module.exports = (http) => {
161161

162162
socket.to(roomName).emit('player_disconnected', {
163163
playerName: player.name,
164-
owner: player.owner,
164+
admin: player.admin,
165165
});
166-
if (player.owner) {
166+
if (player.admin) {
167167
delete rooms[roomName];
168168
console.warn(`room ${roomName} deleted`);
169169
} else {

src/components/LanguagesList.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
ref="languagesList"
2323
tabindex="0"
2424
class="languages list"
25-
:class="{'showStats': !($route.path !== '/' || (room.connected && !room.owner)), 'forceStats': forceStats} "
25+
:class="{'showStats': !($route.path !== '/' || (room.connected && !room.admin)), 'forceStats': forceStats} "
2626
@keydown.shift.capture.prevent="toggleStats"
2727
>
2828
<button
29-
:disabled="room.connected && !room.owner"
29+
:disabled="room.connected && !room.admin"
3030
class="language random-btn"
3131
:class="{'selected': language.index === null}"
3232
:style="{'--col-span': randomBtnColSpan}"
@@ -47,7 +47,7 @@
4747
v-model="language"
4848
type="radio"
4949
class="language-radio"
50-
:disabled="room.connected && !room.owner"
50+
:disabled="room.connected && !room.admin"
5151
:value="languagesList[filteredLanguage.index]"
5252
:data-index="filteredLanguage.index"
5353
@input="setRoomLanguage"
@@ -94,7 +94,7 @@ export default {
9494
},
9595
},
9696
watch: {
97-
'room.owner': {
97+
'room.admin': {
9898
deep: true,
9999
handler(current) {
100100
if (current && this.language.index) {
@@ -105,7 +105,7 @@ export default {
105105
'language.index': {
106106
deep: true,
107107
handler(current) {
108-
if (this.room.connected && !this.room.owner && current) {
108+
if (this.room.connected && !this.room.admin && current) {
109109
this.$refs.languagesList.querySelector(`label[data-index="${current}"]`).scrollIntoView({
110110
block: 'center',
111111
behavior: 'smooth',
@@ -139,7 +139,7 @@ export default {
139139
this.selectRandom();
140140
}
141141
this.language = this.filteredList[index];
142-
if (this.room.owner) {
142+
if (this.room.admin) {
143143
this.$socket.client.emit('languageChange', index);
144144
}
145145
this.$refs.languagesList.querySelector(`label[data-index="${index}"]`).scrollIntoView({
@@ -156,7 +156,7 @@ export default {
156156
}
157157
},
158158
setRoomLanguage(ev) {
159-
if (this.room.owner) {
159+
if (this.room.admin) {
160160
this.$nextTick(() => this.$socket.client.emit('languageChange', ev.target.getAttribute('data-index')));
161161
}
162162
},

src/components/PlayersList.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727
</span>
2828
<div class="icons">
2929
<fa
30-
v-if="player.owner && $route.path !== '/results'"
30+
v-if="player.admin && $route.path !== '/results'"
3131
class="icon"
3232
:icon="['fas', 'user-cog']"
3333
size="xs"
3434
/>
3535
<fa
36-
v-show="player.inLobby && player.ready && !player.owner"
36+
v-show="player.inLobby && player.ready && !player.admin"
3737
class="icon"
3838
:icon="['fas', 'check']"
3939
size="xs"
4040
/>
4141
<fa
42-
v-show="($route.path === '/results' && !player.place) || ($route.path !== '/results' && !player.inLobby && !player.owner)"
42+
v-show="($route.path === '/results' && !player.place) || ($route.path !== '/results' && !player.inLobby && !player.admin)"
4343
class="icon"
4444
:icon="['fas', 'hourglass-end']"
4545
size="xs"
@@ -106,8 +106,8 @@ export default {
106106
return -1;
107107
}
108108
}
109-
if (p1.owner) {
110-
console.log('owner');
109+
if (p1.admin) {
110+
console.log('admin');
111111
return -1;
112112
}
113113

src/components/RoomPanel.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<fa :icon="['fas', 'sign-out-alt']" size="lg" />
8888
</button>
8989
</div>
90-
<div v-if="room.owner && showRoomLink && $route.path === '/'" class="linkContainer">
90+
<div v-if="room.admin && showRoomLink && $route.path === '/'" class="linkContainer">
9191
<p>
9292
Share this link with other players:
9393
</p>
@@ -117,7 +117,7 @@
117117

118118
<PlayersList v-if="room.connected && $route.path !== '/run'" class="playersList" />
119119

120-
<div v-if="room.newGameRequest && !room.owner" class="moveToLobby popUp">
120+
<div v-if="room.newGameRequest && !room.admin" class="moveToLobby popUp">
121121
<div class="wrapper">
122122
<h2>Room owner wants to start a new game.</h2>
123123
<h3>If you want to stay on current page {{ $route.path === '/results' ? 'and continue reading the results' : '' }} you have to leave the room. You can always join again later.</h3>
@@ -170,7 +170,7 @@ export default {
170170
this.$store.commit('SET_ROOM_PROPERTY', ['connected', true]);
171171
this.$store.commit('SET_ROOM_PROPERTY', ['name', this.roomName]);
172172
this.$store.commit('SET_ROOM_PROPERTY', ['myName', this.playerName]);
173-
this.$store.commit('SET_ROOM_PROPERTY', ['owner', true]);
173+
this.$store.commit('SET_ROOM_PROPERTY', ['admin', true]);
174174
setTimeout(() => this.$refs.closeInfoBtn.focus(), 100);
175175
},
176176
room_exist() {
@@ -230,7 +230,7 @@ export default {
230230
},
231231
createRoom() {
232232
this.$socket.client.emit('createRoom', {
233-
ownerName: this.playerName,
233+
adminName: this.playerName,
234234
roomName: this.roomName,
235235
options: {
236236
codeLength: this.options.codeLength,
@@ -259,7 +259,7 @@ export default {
259259
this.$socket.client.close();
260260
this.$store.commit('SET_ROOM_PROPERTY', ['connected', false]);
261261
this.$store.commit('SET_ROOM_PROPERTY', ['name', '']);
262-
this.$store.commit('SET_ROOM_PROPERTY', ['owner', false]);
262+
this.$store.commit('SET_ROOM_PROPERTY', ['admin', false]);
263263
this.$store.commit('SET_ROOM_PROPERTY', ['newGameRequest', false]);
264264
this.$store.commit('SET_ROOM_PROPERTY', ['players', {}]);
265265
if (action) {

src/components/SettingsMenu.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ export default {
106106
...mapGetters(['room']),
107107
...mapFields(['selectedTheme', 'selectedMode', 'underScore', 'codeLength', 'lineNumbers', 'autoIndent']),
108108
block() {
109-
return this.room.connected && !this.room.owner;
109+
return this.room.connected && !this.room.admin;
110110
},
111111
},
112112
watch: {
113-
'room.owner': {
113+
'room.admin': {
114114
deep: true,
115115
handler(current) {
116116
if (current) {
@@ -133,7 +133,7 @@ export default {
133133
},
134134
methods: {
135135
updateOption(ev) {
136-
if (this.room.owner && ev.target.name) {
136+
if (this.room.admin && ev.target.name) {
137137
const payload = {
138138
name: ev.target.name,
139139
value: ev.target.checked,

src/components/UploadCode.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@change="toggleExpand"
3232
>
3333
</label>
34-
<span v-show="!language.index && !(room.connected && !room.owner)" class="language-warning">
34+
<span v-show="!language.index && !(room.connected && !room.admin)" class="language-warning">
3535
Choose language <fa class="arrow" :icon="['fas', 'play']" />
3636
</span>
3737
</div>
@@ -83,7 +83,7 @@ export default {
8383
cmOptions() {
8484
return {
8585
tabSize: this.selectedSize,
86-
readOnly: this.room.connected && !this.room.owner,
86+
readOnly: this.room.connected && !this.room.admin,
8787
lineNumbers: true,
8888
mathBrackets: true,
8989
styleSelectedText: true,
@@ -108,13 +108,13 @@ export default {
108108
immediate: true,
109109
deep: true,
110110
handler(current) {
111-
if (this.room.connected && !this.room.owner) {
111+
if (this.room.connected && !this.room.admin) {
112112
this.code = current.text;
113113
this.selectedSize = current.tabSize || 2;
114114
}
115115
},
116116
},
117-
'room.owner': {
117+
'room.admin': {
118118
deep: true,
119119
handler(current) {
120120
if (current) {
@@ -128,7 +128,7 @@ export default {
128128
},
129129
},
130130
selectedSize() {
131-
if (this.room.owner) {
131+
if (this.room.admin) {
132132
this.$socket.client.emit('customCodeData', {
133133
text: this.code,
134134
tabSize: this.selectedSize,
@@ -184,7 +184,7 @@ export default {
184184
short: this.customCode.text.length < 30 || this.customCode.lines < 4,
185185
};
186186
this.$store.commit('SET_CUSTOM_CODE', data);
187-
if (this.room.owner) {
187+
if (this.room.admin) {
188188
this.$socket.client.emit('customCodeData', data);
189189
}
190190
}, 50);

src/store/modules/room.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const state = {
66
name: '',
77
players: {},
88
myName: '',
9-
owner: false,
9+
admin: false,
1010
},
1111
};
1212

@@ -17,12 +17,12 @@ const getters = {
1717

1818
const actions = {
1919
socket_playerDisconnected({ commit }, msg) {
20-
if (msg.owner) {
20+
if (msg.admin) {
2121
console.log('admin disconnected');
2222
this._vm.$socket.client.disconnect();
2323
commit('SET_ROOM_PROPERTY', ['connected', false]);
2424
commit('SET_ROOM_PROPERTY', ['name', '']);
25-
commit('SET_ROOM_PROPERTY', ['owner', false]);
25+
commit('SET_ROOM_PROPERTY', ['admin', false]);
2626
commit('SET_ROOM_PROPERTY', ['newGameRequest', false]);
2727
commit('SET_ROOM_PROPERTY', ['players', {}]);
2828
}

src/views/Run.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export default {
8787
codeSource() {
8888
if (this.codeInfo.name) {
8989
return this.codeInfo.source === 'own' ? 'Łukasz Wielgus archive' : this.codeInfo.source;
90-
} if (this.room.connected && !this.room.owner) {
91-
return 'Code provided by room owner';
90+
} if (this.room.connected && !this.room.admin) {
91+
return 'Code provided by room admin';
9292
}
9393
return 'Code provided by You';
9494
},

src/views/Start.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
<span>{{ uploadCodeText }}</span>
2222
<input
2323
:checked="customCode.showEditor"
24-
:disabled="room.connected && !room.owner"
24+
:disabled="room.connected && !room.admin"
2525
type="checkbox"
2626
@input="useCustomCode($event.target.checked)"
2727
>
2828
</label>
29-
<label v-if="room.connected && !room.owner" class="button ready-btn" :class="{ highlight: isReady }">
29+
<label v-if="room.connected && !room.admin" class="button ready-btn" :class="{ highlight: isReady }">
3030
<span>Ready</span>
3131
<input
3232
v-model="isReady"
@@ -36,9 +36,9 @@
3636
>
3737
</label>
3838
<button
39-
:disabled="room.connected && !room.owner"
39+
:disabled="room.connected && !room.admin"
4040
class="button start-btn"
41-
:class="{ highlight: language.name && !(room.connected && !room.owner) }"
41+
:class="{ highlight: language.name && !(room.connected && !room.admin) }"
4242
@click="run"
4343
>
4444
START
@@ -87,7 +87,7 @@ export default {
8787
this.error = '';
8888
}
8989
},
90-
'room.owner': {
90+
'room.admin': {
9191
deep: true,
9292
handler(current) {
9393
if (current) {
@@ -99,7 +99,7 @@ export default {
9999
immediate: true,
100100
deep: true,
101101
handler(current) {
102-
if (this.room.connected && !this.room.owner) {
102+
if (this.room.connected && !this.room.admin) {
103103
if (current.showEditor) {
104104
this.showEditor = current.showEditor;
105105
} else {
@@ -126,13 +126,13 @@ export default {
126126
});
127127
}
128128
129-
if (this.room.connected && !this.room.owner) {
129+
if (this.room.connected && !this.room.admin) {
130130
this.$socket.client.emit('playerInLobby', true);
131131
}
132132
},
133133
methods: {
134134
handleEnter() {
135-
if (!(this.room.connected && !this.room.owner) && !this.showEditor) {
135+
if (!(this.room.connected && !this.room.admin) && !this.showEditor) {
136136
this.run();
137137
}
138138
},
@@ -160,7 +160,7 @@ export default {
160160
this.showEditor = value;
161161
}, 500);
162162
}
163-
if (this.room.owner) {
163+
if (this.room.admin) {
164164
this.$socket.client.emit('useCustomCode', value);
165165
}
166166
@@ -191,12 +191,12 @@ export default {
191191
}
192192
}
193193
194-
if (this.showEditor && this.room.owner) {
194+
if (this.showEditor && this.room.admin) {
195195
this.$socket.client.emit('customCodeData', this.customCode);
196196
}
197197
198198
this.prepareCodeInfo();
199-
if (this.room.owner) {
199+
if (this.room.admin) {
200200
this.$socket.client.emit('start', Date.now());
201201
}
202202
@@ -211,7 +211,7 @@ export default {
211211
fileIndex = Math.floor(Math.random() * this.language.files.length);
212212
}
213213
this.$store.dispatch('generateCodeInfo', fileIndex);
214-
if (this.room.owner) {
214+
if (this.room.admin) {
215215
this.$socket.client.emit('fileIndex', fileIndex);
216216
}
217217
},

0 commit comments

Comments
 (0)