Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ornicar/lila
Browse files Browse the repository at this point in the history
* 'master' of github.com:ornicar/lila:
  New Crowdin updates (lichess-org#10155)
  New Crowdin updates (lichess-org#10137)
  Hide ratings when importing game to existing study if option selected
  • Loading branch information
ornicar committed Nov 23, 2021
2 parents 5edc8a6 + 4d9a60c commit 3aa28a6
Show file tree
Hide file tree
Showing 34 changed files with 360 additions and 77 deletions.
3 changes: 2 additions & 1 deletion app/controllers/Study.scala
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ final class Study(
env.study.api.importPgns(
StudyModel.Id(id),
data.toChapterDatas,
sticky = data.sticky
sticky = data.sticky,
ctx.pref.showRatings
)(Who(me.id, lila.socket.Socket.Sri(sri)))
)
}
Expand Down
9 changes: 5 additions & 4 deletions modules/study/src/main/ChapterMaker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ final private class ChapterMaker(

import ChapterMaker._

def apply(study: Study, data: Data, order: Int, userId: User.ID): Fu[Chapter] =
def apply(study: Study, data: Data, order: Int, userId: User.ID, withRatings: Boolean): Fu[Chapter] =
data.game.??(parseGame) flatMap {
case None =>
data.game ?? pgnFetch.fromUrl flatMap {
case Some(pgn) => fromFenOrPgnOrBlank(study, data.copy(pgn = pgn.some), order, userId)
case _ => fromFenOrPgnOrBlank(study, data, order, userId)
}
case Some(game) => fromGame(study, game, data, order, userId)
case Some(game) => fromGame(study, game, data, order, userId, withRatings)
} map { (c: Chapter) =>
if (c.name.value.isEmpty) c.copy(name = Chapter defaultName order) else c
}
Expand Down Expand Up @@ -125,14 +125,15 @@ final private class ChapterMaker(
data: Data,
order: Int,
userId: User.ID,
withRatings: Boolean,
initialFen: Option[FEN] = None
): Fu[Chapter] =
for {
root <- game2root(game, initialFen)
tags <- pgnDump.tags(game, initialFen, none, withOpening = true, withRating = true)
tags <- pgnDump.tags(game, initialFen, none, withOpening = true, withRatings)
name <- {
if (data.isDefaultName)
Namer.gameVsText(game, withRatings = false)(lightUser.async) dmap Chapter.Name.apply
Namer.gameVsText(game, withRatings)(lightUser.async) dmap Chapter.Name.apply
else fuccess(data.name)
}
_ = notifyChat(study, game, userId)
Expand Down
25 changes: 18 additions & 7 deletions modules/study/src/main/StudyApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ final class StudyApi(
addChapter(
studyId = study.id,
data = data.form.toChapterData,
sticky = study.settings.sticky
sticky = study.settings.sticky,
withRatings
)(Who(user.id, Sri(""))) >> byIdWithLastChapter(studyId)
case _ => fuccess(none)
} orElse importGame(data.copy(form = data.form.copy(asStr = none)), user, withRatings)
Expand Down Expand Up @@ -587,11 +588,13 @@ final class StudyApi(
}
}

def addChapter(studyId: Study.Id, data: ChapterMaker.Data, sticky: Boolean)(who: Who): Funit =
def addChapter(studyId: Study.Id, data: ChapterMaker.Data, sticky: Boolean, withRatings: Boolean)(
who: Who
): Funit =
data.manyGames match {
case Some(datas) =>
lila.common.Future.applySequentially(datas) { data =>
addChapter(studyId, data, sticky)(who)
addChapter(studyId, data, sticky, withRatings)(who)
}
case _ =>
sequenceStudy(studyId) { study =>
Expand All @@ -605,7 +608,7 @@ final class StudyApi(
}
} >>
chapterRepo.nextOrderByStudy(study.id) flatMap { order =>
chapterMaker(study, data, order, who.u) flatMap { chapter =>
chapterMaker(study, data, order, who.u, withRatings) flatMap { chapter =>
doAddChapter(study, chapter, sticky, who)
} addFailureEffect {
case ChapterMaker.ValidationException(error) =>
Expand All @@ -624,9 +627,11 @@ final class StudyApi(
studyRepo.updateSomeFields(study) >>- indexStudy(study)
}

def importPgns(studyId: Study.Id, datas: List[ChapterMaker.Data], sticky: Boolean)(who: Who) =
def importPgns(studyId: Study.Id, datas: List[ChapterMaker.Data], sticky: Boolean, withRatings: Boolean)(
who: Who
) =
lila.common.Future.applySequentially(datas) { data =>
addChapter(studyId, data, sticky)(who)
addChapter(studyId, data, sticky, withRatings)(who)
}

def doAddChapter(study: Study, chapter: Chapter, sticky: Boolean, who: Who) =
Expand Down Expand Up @@ -731,7 +736,13 @@ final class StudyApi(
chapterRepo.orderedMetadataByStudy(studyId).flatMap { chaps =>
// deleting the only chapter? Automatically create an empty one
if (chaps.sizeIs < 2) {
chapterMaker(study, ChapterMaker.Data(Chapter.Name("Chapter 1")), 1, who.u) flatMap { c =>
chapterMaker(
study,
ChapterMaker.Data(Chapter.Name("Chapter 1")),
1,
who.u,
withRatings = true
) flatMap { c =>
doAddChapter(study, c, sticky = true, who) >> doSetChapter(study, c.id, who)
}
} // deleting the current chapter? Automatically move to another one
Expand Down
2 changes: 1 addition & 1 deletion modules/study/src/main/StudySocket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ final private class StudySocket(
case "addChapter" =>
reading[ChapterMaker.Data](o) { data =>
val sticky = o.obj("d").flatMap(_.boolean("sticky")) | true
who foreach api.addChapter(studyId, data, sticky = sticky)
who foreach api.addChapter(studyId, data, sticky = sticky, withRatings = true)
}
case "setChapter" =>
o.get[Chapter.Id]("d") foreach { chapterId =>
Expand Down
12 changes: 12 additions & 0 deletions translation/dest/arena/kk-KZ.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@
<string name="shareUrl">Адамдар қосылсын десеңіз, осы URL-мен бөлісіңіз: %s</string>
<string name="drawStreak">Тепе-теңдік тізбегі: Ойыншының Алаңда қатарынан тепе-теңдіктері болса, алғашқы тепе-теңдік немесе %s жүрістен кейін орын алған тепе-теңдіктер ұпай береді. Тепе-теңдік тізбегін жеңіліс пен тепе-теңдікпен емес, тек жеңіспен ғана тоқтатуға болады.</string>
<string name="history">Алаң журналы</string>
<plurals name="viewAllXTeams" comment="viewAllXTeams [one] [other]&#10;&#10;%s is the number of teams that can be viewed">
<item quantity="one">Топты қарау</item>
<item quantity="other">Барлық %s топты қарау</item>
</plurals>
<string name="newTeamBattle">Жаңа Топтық Күрес</string>
<string name="customStartDate">Басталудың ерекше күні</string>
<string name="customStartDateHelp">Сіздің жергілікті уақыт белдеуіңіз. Бұл \"Жарысқа дейінгі уақыт\" баптауына әсер етеді</string>
<string name="allowBerserk">Берсерк-ті рұқсат ету</string>
<string name="allowBerserkHelp">Қосымша ұпай жинау үшін ойыншыларға уақытты жартылай қыстартуды рұқсат ету</string>
<string name="allowChatHelp">Ойыншыларға чат бөлмесінде сөйлесуді рұқсат ету</string>
<string name="arenaStreaks">Алаң тізбектері</string>
<string name="arenaStreaksHelp">Қатарынан болған 2 жеңіс 2 ұпайдың орнына 4 ұпай тұрады.</string>
</resources>
4 changes: 3 additions & 1 deletion translation/dest/arena/or-IN.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources>
<string name="howAreScoresCalculated">ସ୍କୋରଗୁଡ଼ିକ କିପରି ଗଣନା କରାଯାଏ?</string>
</resources>
5 changes: 4 additions & 1 deletion translation/dest/coordinates/or-IN.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources>
<string name="averageScoreAsWhiteX">ଧଳା ଭାବରେ ହାରାହାରି ସ୍କୋର୍: %s</string>
<string name="averageScoreAsBlackX">କଳା ଭାବରେ ହାରାହାରି ସ୍କୋର୍: %s</string>
</resources>
20 changes: 10 additions & 10 deletions translation/dest/emails/os-SE.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="emailConfirm_subject">Сфидар кæн дæ lichess.org аккаунт, %s</string>
<string name="emailConfirm_click" comment="emailConfirm_click&#10;&#10;Part of the confirmation email upon registering for a Lichess account.&#10;&#10;The unique reset link is presented just after this string.">Дæ Lichess аккаунт цæмæй скусын кæнай, æрæлхъив дæнцæгыл:</string>
<string name="emailConfirm_click" comment="emailConfirm_click&#10;&#10;Part of the confirmation email upon registering for a Lichess account.&#10;&#10;The unique reset link is presented just after this string.">Дæ Lichess аккаунт цæмæй скусын кæнай, нылхъив дæнцæгыл:</string>
<string name="emailConfirm_ignore">Дæхи Lichess-ы кæд регистраци нæ кодтай, уæд ацы фыстæг ницæмæ дар.</string>
<string name="passwordReset_subject">Раппар дæ lichess.org пароль, %s</string>
<string name="passwordReset_intro">Мах райстам бафæрст дæ аккаунты паролы раппæрыныл.</string>
<string name="passwordReset_clickOrIgnore">Ды кæд уыцы бафæрст скодтай, уæд æрæлхъив уыцы дæнцæгыл. Кæд нæ, уæд ницæмæ дар уыцы фыстаг.</string>
<string name="emailChange_subject">Сфидар кæн дæ ног пост, %s</string>
<string name="emailChange_intro">Ды бафарстай дæ посты ивынад.</string>
<string name="emailChange_click">Цæмæй дæ пост сфидар кæнай, æрæлхъив уыцы дæнцæгыл:</string>
<string name="passwordReset_intro">Мах райстам бафарст дæ аккаунты пароль раппарын.</string>
<string name="passwordReset_clickOrIgnore">Ды кæд ахæм бафарст кодтай, уæд нылхъив дæнцæгыл дæлдæр. Кæд нæ, уæд ницæмæ дар ацы фыстаг.</string>
<string name="emailChange_subject">Сфидар кæн дæ ног посты адрис, %s</string>
<string name="emailChange_intro">Ды бафарстай дæ посты адрис баивын.</string>
<string name="emailChange_click">Цæмæй дæ посты адрис сфидар кæнай, нылхъив дæнцæгыл дæлдæр:</string>
<string name="welcome_subject">Æгас цу lichess.org-мæ, %s</string>
<string name="welcome_text">Æнтыстджынæй дæ lichess.org аккаунт сарæзтай.

Мæнæ ам ис дæ профилы фарс: %1$s. Сфæлындын æй дæ бон у %2$s.
Мæнæ ам ис дæ профилы фарс: %1$s. Сфæлындын æй дæ бон у ам: %2$s.

Хъæлдзаг у, æмæ дæ фигурæтæ ныхмæлæууæджы къаролмæ цæмæй сæ фæндаг æдзухдæр ссарой!</string>
Бантысæд дын, цæмæй дæ фигурæтæ ныхмæлæууæджы къаролмæ сæ фæндаг æдзухдæр ссарой!</string>
<string name="logInToLichess">Бацу lichess.org-мæ, %s</string>
<string name="common_orPaste">(Æлхъивын нæ кусы? Бафæлвар æй дæ браузермæ бавæрын!)</string>
<string name="common_note">Уый у сервисы фыстæг, дæ %s спайдакæнынмæ баст кæй у, ахæм.</string>
<string name="common_contact">Махимæ цæмæй хи сбæттын, %s пайда кæн.</string>
<string name="common_note">Ай у службæйон фыстæг, дæ %s спайдакæнынмæ баст кæй у, ахæм.</string>
<string name="common_contact">Махимæ цæмæй бастдзинад скæнын, %s пайда кæн.</string>
</resources>
2 changes: 1 addition & 1 deletion translation/dest/emails/te-IN.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="emailConfirm_subject">మీ lichess.org ఖాతా %s, ధ్రువపరచండి</string>
<string name="emailConfirm_click" comment="emailConfirm_click&#10;&#10;Part of the confirmation email upon registering for a Lichess account.&#10;&#10;The unique reset link is presented just after this string.">మీ Lichess ఖాతాను నిద్రలేపి, వాడడం మొదలుపెట్టడానికి ఈ లంకెను నొక్కండి:</string>
<string name="emailConfirm_click" comment="emailConfirm_click&#10;&#10;Part of the confirmation email upon registering for a Lichess account.&#10;&#10;The unique reset link is presented just after this string.">మీ Lichess ఖాతాను వాడడం మొదలుపెట్టడానికి ఈ లంకెను నొక్కండి:</string>
<string name="emailConfirm_ignore">ఒకవేళ మీరు lichess లో చేరియుండక పొతే ఈ సందేశాన్ని పట్టించుకోనవసరం లేదు.</string>
<string name="passwordReset_subject">మీ lichess రహస్యపదాన్ని మార్చండి, %s</string>
<string name="passwordReset_intro">మీ ఖాతాకు ప్రస్తుతమున్న రహస్యపదాన్ని తుడిచిపెట్టి, కొత్త రహస్యపదాన్ని సృష్టించమని అభ్యర్థన వచ్చింది.</string>
Expand Down
1 change: 1 addition & 0 deletions translation/dest/faq/fa-IR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="fairPlay">بازی منصفانه</string>
<string name="leavingGameWithoutResigningExplanation">اگر حریف شما به صورت مداوم بازی را ترک کند، از بازی محروم می شود این به این معنی است که به صورت موقت اجازه بازی کردن را نخواهد داشت. این امر در حساب کاربری فرد نمایش داده نمی شود. اگر این رفتار ادامه پیدا کند، مدت زمان محرومیت از بازی افزایش می یابد و انجام این کار در مدت زمان طولانی ممکن است منجر به مسدود شدن حساب کاربر شود.</string>
<string name="howCanIBecomeModerator">چگونه می‌توانم یک مدیر باشم؟</string>
<string name="gameplay">گیم پلی</string>
<string name="goodIntroduction">معرفی و مقدمه خوب</string>
<string name="positions">موقعیت‌ها</string>
<string name="configure">پیکربندی نمایید</string>
Expand Down
Loading

0 comments on commit 3aa28a6

Please sign in to comment.