mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-02 13:45:42 +08:00
Merge fix/issue-1095-rss-reenable (#1096): re-enable disabled RSS on re-subscribe
This commit is contained in:
@@ -17,6 +17,14 @@ class RSSDatabase:
|
||||
result = await self.session.execute(statement)
|
||||
db_data = result.scalar_one_or_none()
|
||||
if db_data:
|
||||
if not db_data.enabled:
|
||||
# 删除番剧时孤儿 RSS 会被停用(#1053);重新订阅同一 URL 表达了
|
||||
# 恢复更新的意图,必须重新启用,否则番剧会静默断更(#1095)。
|
||||
db_data.enabled = True
|
||||
self.session.add(db_data)
|
||||
await self.session.commit()
|
||||
logger.info("Re-enabled disabled RSS Item %s.", data.url)
|
||||
return True
|
||||
logger.debug("RSS Item %s already exists.", data.url)
|
||||
return False
|
||||
else:
|
||||
|
||||
@@ -112,6 +112,20 @@ async def test_rss_database(db_session):
|
||||
assert result.url == rss_url
|
||||
|
||||
|
||||
async def test_rss_add_reenables_disabled_duplicate(db_session):
|
||||
"""重新订阅已存在但被停用的 RSS(删除番剧后孤儿停用,#1095)应重新启用。"""
|
||||
rss_url = "https://mikanani.me/RSS/Bangumi?bangumiId=4020&subgroupid=583"
|
||||
db = RSSDatabase(db_session)
|
||||
|
||||
await db.add(RSSItem(url=rss_url, name="Test RSS"))
|
||||
item = await db.search_url(rss_url)
|
||||
await db.disable(item.id)
|
||||
|
||||
assert await db.add(RSSItem(url=rss_url, name="Test RSS")) is True
|
||||
item = await db.search_url(rss_url)
|
||||
assert item.enabled is True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# TorrentDatabase qb_hash methods
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user