🐛 Fix bugs

This commit is contained in:
2025-04-01 00:46:46 +08:00
parent a4ecf30c5b
commit 1cec1bf82e
5 changed files with 80 additions and 53 deletions

View File

@ -241,7 +241,9 @@ class PostWriteController extends ChangeNotifier {
contentController.text = post.body['content'] ?? '';
aliasController.text = post.alias ?? '';
rewardController.text = post.body['reward']?.toString() ?? '';
videoAttachment = SnAttachment.fromJson(post.body['video']);
videoAttachment = post.body['video'] != null
? SnAttachment.fromJson(post.body['video'])
: null;
publishedAt = post.publishedAt;
publishedUntil = post.publishedUntil;
visibleUsers = List.from(post.visibleUsersList ?? [], growable: true);
@ -253,7 +255,7 @@ class PostWriteController extends ChangeNotifier {
List.from(post.categories.map((ele) => ele.alias), growable: true);
attachments.addAll(
post.body['attachments']
.where(SnAttachment.fromJson)
?.where((ele) => SnAttachment.fromJson(ele))
?.map(PostWriteMedia) ??
[],
);

View File

@ -152,7 +152,7 @@ class KeyPairProvider {
Future<SnKeyPair?> reloadActive({bool autoEnroll = true}) async {
final kp = await (_dt.db.snLocalKeyPair.select()
..where((e) => e.accountId.equals(_ua.user!.id))
..where((e) => e.accountId.equals(_ua.user?.id ?? 0))
..where((e) => e.privateKey.isNotNull())
..where((e) => e.isActive.equals(true))
..limit(1))

View File

@ -346,9 +346,15 @@ class _PostEditorScreenState extends State<PostEditorScreen>
children: [
const Icon(Icons.edit, size: 16),
const Gap(10),
Text('postEditingNotice').tr(args: [
'@${_writeController.editingPost!.publisher.name}'
]),
Expanded(
child: Text(
'postEditingNotice',
maxLines: 1,
overflow: TextOverflow.ellipsis,
).tr(args: [
'@${_writeController.editingPost!.publisher.name}'
]),
),
],
),
),