Fixed edit().
This commit is contained in:
@@ -274,7 +274,7 @@ class BasePage(object):
|
|||||||
prompt = 'Are you sure you want to delete this? (y/n):'
|
prompt = 'Are you sure you want to delete this? (y/n):'
|
||||||
char = prompt_input(self.stdscr, prompt)
|
char = prompt_input(self.stdscr, prompt)
|
||||||
if char != 'y':
|
if char != 'y':
|
||||||
show_notification(self.stdscr, ['Canceled'])
|
show_notification(self.stdscr, ['Aborted'])
|
||||||
return
|
return
|
||||||
|
|
||||||
with self.safe_call():
|
with self.safe_call():
|
||||||
@@ -313,12 +313,12 @@ class BasePage(object):
|
|||||||
text = open_editor(info)
|
text = open_editor(info)
|
||||||
curses.doupdate()
|
curses.doupdate()
|
||||||
if text == content:
|
if text == content:
|
||||||
show_notification(self.stdscr, ['Canceled'])
|
show_notification(self.stdscr, ['Aborted'])
|
||||||
return
|
return
|
||||||
|
|
||||||
with self.safe_call():
|
with self.safe_call():
|
||||||
with self.loader(message='Editing', delay=0):
|
with self.loader(message='Editing', delay=0):
|
||||||
data['object'].edit()
|
data['object'].edit(text)
|
||||||
time.sleep(2.0)
|
time.sleep(2.0)
|
||||||
self.refresh_content()
|
self.refresh_content()
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class SubmissionPage(BasePage):
|
|||||||
comment_text = open_editor(comment_info)
|
comment_text = open_editor(comment_info)
|
||||||
curses.doupdate()
|
curses.doupdate()
|
||||||
if not comment_text:
|
if not comment_text:
|
||||||
show_notification(self.stdscr, ['Canceled'])
|
show_notification(self.stdscr, ['Aborted'])
|
||||||
return
|
return
|
||||||
|
|
||||||
with self.safe_call():
|
with self.safe_call():
|
||||||
|
|||||||
@@ -132,8 +132,11 @@ class SubredditPage(BasePage):
|
|||||||
curses.doupdate()
|
curses.doupdate()
|
||||||
|
|
||||||
# Validate the submission content
|
# Validate the submission content
|
||||||
if not submission_text or '\n' not in submission_text:
|
if not submission_text:
|
||||||
show_notification(self.stdscr, ['Canceled'])
|
show_notification(self.stdscr, ['Aborted'])
|
||||||
|
return
|
||||||
|
if '\n' not in submission_text:
|
||||||
|
show_notification(self.stdscr, ['No content'])
|
||||||
return
|
return
|
||||||
|
|
||||||
title, content = submission_text.split('\n', 1)
|
title, content = submission_text.split('\n', 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user