mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Gracefully handle force pushes for remote themes (#11325)
Force pushing a commit to a theme repository used to break the updater, because the system was not able to count the commits behind the old and new version. This operation failed because a force push deleted the old commits. The user was prompted with a simple "500 server error" message.
This commit is contained in:
@@ -151,6 +151,15 @@ export default Controller.extend({
|
||||
|
||||
hasTranslations: notEmpty("translations"),
|
||||
|
||||
@discourseComputed(
|
||||
"model.remote_theme.local_version",
|
||||
"model.remote_theme.remote_version",
|
||||
"model.remote_theme.commits_behind"
|
||||
)
|
||||
hasOverwrittenHistory(localVersion, remoteVersion, commitsBehind) {
|
||||
return localVersion !== remoteVersion && commitsBehind === -1;
|
||||
},
|
||||
|
||||
@discourseComputed("model.remoteError", "updatingRemote")
|
||||
showRemoteError(errorMessage, updating) {
|
||||
return errorMessage && !updating;
|
||||
|
||||
@@ -105,7 +105,11 @@
|
||||
{{i18n "admin.customize.theme.updating"}}
|
||||
{{else}}
|
||||
{{#if model.remote_theme.commits_behind}}
|
||||
{{i18n "admin.customize.theme.commits_behind" count=model.remote_theme.commits_behind}}
|
||||
{{#if hasOverwrittenHistory}}
|
||||
{{i18n "admin.customize.theme.has_overwritten_history"}}
|
||||
{{else}}
|
||||
{{i18n "admin.customize.theme.commits_behind" count=model.remote_theme.commits_behind}}
|
||||
{{/if}}
|
||||
{{#if model.remote_theme.github_diff_link}}
|
||||
<a href={{model.remote_theme.github_diff_link}}>
|
||||
{{i18n "admin.customize.theme.compare_commits"}}
|
||||
|
||||
Reference in New Issue
Block a user