Skip to content

Commit

Permalink
If blocked, don't display edit notice automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
tonisevener committed Feb 10, 2023
1 parent 59aae66 commit 151acf8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Wikipedia/Code/SectionEditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class SectionEditorViewController: ViewController {
private let findAndReplaceHeaderTitle = WMFLocalizedString("find-replace-header", value: "Find and replace", comment: "Find and replace header title.")

private var editConfirmationSavedData: EditSaveViewController.SaveData? = nil
private var lastBlockedDisplayError: MediaWikiAPIBlockedDisplayError?

init(articleURL: URL, sectionID: Int, messagingController: SectionEditorWebViewMessagingController? = nil, dataStore: MWKDataStore, selectedTextEditInfo: SelectedTextEditInfo? = nil, theme: Theme = Theme.standard) {
self.articleURL = articleURL
Expand Down Expand Up @@ -149,7 +150,7 @@ class SectionEditorViewController: ViewController {
}

private func presentEditNoticesIfNecessary() {
guard UserDefaults.standard.wmf_alwaysDisplayEditNotices else {
guard UserDefaults.standard.wmf_alwaysDisplayEditNotices && lastBlockedDisplayError == nil else {
return
}

Expand Down Expand Up @@ -427,13 +428,16 @@ class SectionEditorViewController: ViewController {
case .success(let response):
self.wikitext = response.wikitext
self.handle(protection: response.protection)
self.initialFetchGroup.leave()

if let blockedError = response.blockedError {
self.lastBlockedDisplayError = blockedError
completion(blockedError)
} else {
self.lastBlockedDisplayError = nil
completion(nil)
}

self.initialFetchGroup.leave()
}
}
}
Expand Down

0 comments on commit 151acf8

Please sign in to comment.