Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password fix #2394

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lichess/tournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export function isIn(data: Tournament): boolean {
}

export function previouslyJoined(data: Tournament): boolean {
return data.me != null
return !!data.me
}
3 changes: 2 additions & 1 deletion src/ui/tournament/detail/joinForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import router from '../../../router'
import TournamentCtrl from './TournamentCtrl'
import formWidgets from '../../shared/form'
import settings from '../../../settings'
import * as helper from '../../helper'

let isOpen = false
let tournamentCtrl: TournamentCtrl
Expand Down Expand Up @@ -52,7 +53,7 @@ function renderForm() {
<div className={'select_input no_arrow_after' + (t.private ? '' : ' notVisible')}>
<div className="text_input_container">
<label>Password: </label>
<input type="text" id="tournamentPassword" className="passwordField" />
<input type="text" id="tournamentPassword" className="passwordField" autocapitalize="off" autocomplete="off" oncreate={helper.autofocus} />
</div>
</div>
<div className={'select_input no_arrow_after' + (t.teamBattle ? '' : ' notVisible')}>
Expand Down
14 changes: 8 additions & 6 deletions src/ui/tournament/detail/tournamentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function renderFooter(ctrl: TournamentCtrl): Mithril.Child {
}
</button> : h.fragment({key: 'noChat'}, [])
}
{ ctrl.hasJoined ? withdrawButton(ctrl, t) : joinButton(ctrl, t) }
{ ctrl.hasJoined ? withdrawButton(ctrl) : joinButton(ctrl) }
</div>
)
}
Expand Down Expand Up @@ -181,17 +181,18 @@ function tournamentSpotlightInfo(spotlight: Spotlight) {
)
}

function joinButton(ctrl: TournamentCtrl, t: Tournament) {
function joinButton(ctrl: TournamentCtrl) {
const t = ctrl.tournament
if (!session.isConnected() ||
t.isFinished ||
settings.game.supportedVariants.indexOf(t.variant) < 0 ||
!t.verdicts.accepted ||
(t.teamBattle && t.teamBattle.joinWith.length === 0)) {
return h.fragment({key: 'noJoinButton'}, [])
}
const action = ((t.private || t.teamBattle) && !previouslyJoined(t)) ?
() => joinForm.open(ctrl) :
() => ctrl.join()
const action = () => ((ctrl.tournament.private || ctrl.tournament.teamBattle) && !previouslyJoined(ctrl.tournament)) ?
joinForm.open(ctrl) :
ctrl.join()

return (
<button key="joinButton" className="action_bar_button fa fa-play" oncreate={helper.ontap(
Expand All @@ -202,7 +203,8 @@ function joinButton(ctrl: TournamentCtrl, t: Tournament) {
)
}

function withdrawButton(ctrl: TournamentCtrl, t: Tournament) {
function withdrawButton(ctrl: TournamentCtrl) {
const t = ctrl.tournament
if (t.isFinished || settings.game.supportedVariants.indexOf(t.variant) < 0) {
return h.fragment({key: 'noWithdrawButton'}, [])
}
Expand Down