forked from sch/Slixfeed
Improve subscription preview form;
Fix adding subscriptions to a custom JID/
This commit is contained in:
parent
735ce58178
commit
e63a5e4a74
3 changed files with 31 additions and 20 deletions
|
@ -191,6 +191,12 @@ class DateAndTime:
|
||||||
return date
|
return date
|
||||||
|
|
||||||
|
|
||||||
|
def convert_seconds_to_yyyy_mm_dd(seconds_time):
|
||||||
|
date_time = datetime.fromtimestamp(seconds_time)
|
||||||
|
formatted_date = date_time.strftime('%Y-%m-%d')
|
||||||
|
return formatted_date
|
||||||
|
|
||||||
|
|
||||||
def current_date():
|
def current_date():
|
||||||
"""
|
"""
|
||||||
Print MM DD, YYYY (Weekday Time) timestamp.
|
Print MM DD, YYYY (Weekday Time) timestamp.
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
__version__ = '0.1.97'
|
__version__ = '0.1.98'
|
||||||
__version_info__ = (0, 1, 97)
|
__version_info__ = (0, 1, 98)
|
||||||
|
|
|
@ -1802,10 +1802,10 @@ class XmppClient(slixmpp.ClientXMPP):
|
||||||
identifier = values['identifier'] if 'identifier' in values else None
|
identifier = values['identifier'] if 'identifier' in values else None
|
||||||
url = values['subscription']
|
url = values['subscription']
|
||||||
jid_bare = session['from'].bare
|
jid_bare = session['from'].bare
|
||||||
if XmppUtilities.is_operator(self, jid_bare) and 'jid' in values:
|
if 'jid' in values: custom_jid = values['jid']
|
||||||
custom_jid = values['jid']
|
if XmppUtilities.is_operator(self, jid_bare) and custom_jid:
|
||||||
jid_bare = custom_jid[0] if isinstance(custom_jid, list) else jid_bare
|
if isinstance(custom_jid, list): custom_jid = custom_jid[0]
|
||||||
# jid_bare = custom_jid[0] if custom_jid else jid_bare
|
jid_bare = custom_jid or jid_bare
|
||||||
form.add_field(var='jid',
|
form.add_field(var='jid',
|
||||||
ftype='hidden',
|
ftype='hidden',
|
||||||
value=jid_bare)
|
value=jid_bare)
|
||||||
|
@ -1929,13 +1929,16 @@ class XmppClient(slixmpp.ClientXMPP):
|
||||||
entries = sqlite.get_entries_of_feed(db_file, feed_id)
|
entries = sqlite.get_entries_of_feed(db_file, feed_id)
|
||||||
renewed, scanned = sqlite.get_last_update_time_of_feed(db_file,
|
renewed, scanned = sqlite.get_last_update_time_of_feed(db_file,
|
||||||
feed_id)
|
feed_id)
|
||||||
last_updated = renewed or scanned
|
last_updated = DateAndTime.convert_seconds_to_yyyy_mm_dd(
|
||||||
last_updated = str(last_updated)
|
float(renewed or scanned))
|
||||||
options = form.add_field(desc='Recent titles from subscription',
|
form.add_field(desc='Recent titles from subscription',
|
||||||
ftype='list-multi',
|
ftype='fixed',
|
||||||
label='Preview')
|
value='Recent updates')
|
||||||
|
recent_updates = ''
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
options.addOption(entry[1], entry[2])
|
recent_updates += '* ' + entry[1] + '\n\n'
|
||||||
|
form.add_field(ftype='text-multi',
|
||||||
|
value=recent_updates)
|
||||||
form.add_field(ftype='fixed',
|
form.add_field(ftype='fixed',
|
||||||
label='Information')
|
label='Information')
|
||||||
form.add_field(ftype='text-single',
|
form.add_field(ftype='text-single',
|
||||||
|
@ -1966,13 +1969,15 @@ class XmppClient(slixmpp.ClientXMPP):
|
||||||
entries = sqlite.get_entries_of_feed(db_file, feed_id)
|
entries = sqlite.get_entries_of_feed(db_file, feed_id)
|
||||||
renewed, scanned = sqlite.get_last_update_time_of_feed(db_file,
|
renewed, scanned = sqlite.get_last_update_time_of_feed(db_file,
|
||||||
feed_id)
|
feed_id)
|
||||||
last_updated = renewed or scanned
|
last_updated = DateAndTime.convert_seconds_to_yyyy_mm_dd(
|
||||||
last_updated = str(last_updated)
|
float(renewed or scanned))
|
||||||
options = form.add_field(desc='Recent titles from subscription',
|
options = form.add_field(ftype='fixed',
|
||||||
ftype='list-multi',
|
value='Recent updates')
|
||||||
label='Preview')
|
recent_updates = ''
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
options.addOption(entry[1], entry[2])
|
recent_updates += '* ' + entry[1] + '\n\n'
|
||||||
|
form.add_field(ftype='text-multi',
|
||||||
|
value=recent_updates)
|
||||||
form.add_field(ftype='fixed',
|
form.add_field(ftype='fixed',
|
||||||
label='Information')
|
label='Information')
|
||||||
form.add_field(ftype='text-single',
|
form.add_field(ftype='text-single',
|
||||||
|
|
Loading…
Reference in a new issue