mirror of https://gitlab.com/litecord/litecord.git
channels, guild.roles, user.billing: typing fixes
This commit is contained in:
parent
68c6442375
commit
ed3c436b6d
|
|
@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
"""
|
||||
|
||||
import time
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
|
||||
from quart import Blueprint, request, current_app as app, jsonify
|
||||
from logbook import Logger
|
||||
|
|
@ -263,8 +263,11 @@ async def _update_pos(channel_id, pos: int):
|
|||
""", pos, channel_id)
|
||||
|
||||
|
||||
async def _mass_chan_update(guild_id, channel_ids: List[int]):
|
||||
async def _mass_chan_update(guild_id, channel_ids: List[Optional[int]]):
|
||||
for channel_id in channel_ids:
|
||||
if channel_id is None:
|
||||
continue
|
||||
|
||||
chan = await app.storage.get_channel(channel_id)
|
||||
await app.dispatcher.dispatch(
|
||||
'guild', guild_id, 'CHANNEL_UPDATE', chan)
|
||||
|
|
|
|||
|
|
@ -257,13 +257,16 @@ def gen_pairs(list_of_changes: List[Dict[str, int]],
|
|||
# position we want to change to
|
||||
element_2 = current_state.get(new_pos_1)
|
||||
|
||||
if element_2 is None:
|
||||
continue
|
||||
|
||||
# if there is, is that existing channel being
|
||||
# swapped to another position?
|
||||
new_pos_2 = preferred_state.get(element_2)
|
||||
|
||||
# if its being swapped to leave space, add it
|
||||
# to the pairs list
|
||||
if element_2 and new_pos_2:
|
||||
if new_pos_2 is not None:
|
||||
pairs.append(
|
||||
((element_1, new_pos_1), (element_2, new_pos_2))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -148,8 +148,6 @@ async def get_payment_source(user_id: int, source_id: int, db=None) -> dict:
|
|||
if not db:
|
||||
db = app.db
|
||||
|
||||
source = {}
|
||||
|
||||
source_type = await db.fetchval("""
|
||||
SELECT source_type
|
||||
FROM user_payment_sources
|
||||
|
|
|
|||
Loading…
Reference in New Issue