-
Notifications
You must be signed in to change notification settings - Fork 76
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
Issue 1268 #1304
Issue 1268 #1304
Conversation
I messed it up with commit messages... sorry! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a few suggestions but overall it looks good.
For the commit message I would appreciate if you could squash all commits into a single one.
Future.successful("No README found for this project, please check the repository") | ||
} | ||
} | ||
.flatMap(res => Future { element.innerHTML = res }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.flatMap(res => Future { element.innerHTML = res }) | |
.map(res => element.innerHTML = res) |
if (res.status == 200) { | ||
res.text().toFuture | ||
} else { | ||
Future.successful("{\"default_branch\": \"master\"}") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`
For the fallback, I would avoid creating a JSON string if we then need to parse it and extract one field.
if (res.status == 200) { | |
res.text().toFuture | |
} else { | |
Future.successful("{\"default_branch\": \"master\"}") | |
} | |
def extractDefaultBranch(text: String): String = | |
js.JSON.parse(text).asInstanceOf[Repo].default_branch | |
if (res.status == 200) res.text().map(extractDefaultBranch).toFuture | |
else Future.successful("master") |
def setLogo(): Future[Unit] = { | ||
def getLogoAndSetHTML(branch: String, organization: String, repository: String): Unit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not just set the logo, it fixes all the URLs of all the images in the readme file.
def setLogo(): Future[Unit] = { | |
def getLogoAndSetHTML(branch: String, organization: String, repository: String): Unit = { | |
def getDefaultBranchAndFixImages(): Future[Unit] = { | |
def fixImages(branch: String, organization: String, repository: String): Unit = { |
Fixes #1268