Skip to content

Commit

Permalink
style: Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-damocles committed Dec 11, 2024
1 parent 62844f9 commit f679bca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
3 changes: 1 addition & 2 deletions lib/app/extensions/event_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import 'package:nostr_dart/nostr_dart.dart';

extension MasterKeyExtensions on EventMessage {
String get masterPubkey {
final masterPubkey =
tags.firstWhereOrNull((tags) => tags[0] == 'b')?.elementAtOrNull(1);
final masterPubkey = tags.firstWhereOrNull((tags) => tags[0] == 'b')?.elementAtOrNull(1);

if (masterPubkey == null) {
throw EventMasterPubkeyNotFoundException(eventId: id);
Expand Down
32 changes: 14 additions & 18 deletions lib/app/services/database/ion_database.c.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,24 @@ class IONDatabase extends _$IONDatabase {
Future<String?> _lookupConversationByPubkeys(
EventMessage eventMessage,
) async {
final conversationsWithSameParticipants =
await (select(conversationMessagesTable)
..where(
(table) => table.pubKeys.equals(eventMessage.pubkeysMask),
)
..limit(1))
.get();
final conversationsWithSameParticipants = await (select(conversationMessagesTable)
..where(
(table) => table.pubKeys.equals(eventMessage.pubkeysMask),
)
..limit(1))
.get();

if (conversationsWithSameParticipants.isEmpty) {
// Check if there are conversations with the same subject but different pubkeys
// (this means that amount of participants in conversation was changed)
final subject = eventMessage.subject;
if (subject != null) {
final conversationsWithChangedParticipants =
await (select(conversationMessagesTable)
..where(
(table) => table.subject.equals(subject),
)
..limit(1))
.get();
final conversationsWithChangedParticipants = await (select(conversationMessagesTable)
..where(
(table) => table.subject.equals(subject),
)
..limit(1))
.get();

return conversationsWithChangedParticipants.isEmpty
? null
Expand Down Expand Up @@ -141,9 +139,8 @@ class IONDatabase extends _$IONDatabase {
readsFrom: {conversationMessagesTable},
).get();

final lastConversationMessagesIds = uniqueConversationRows
.map((row) => row.data['event_message_id'] as String)
.toList();
final lastConversationMessagesIds =
uniqueConversationRows.map((row) => row.data['event_message_id'] as String).toList();

final lastConversationEventMessages = (await (select(eventMessagesTable)
..where((table) => table.id.isIn(lastConversationMessagesIds)))
Expand Down Expand Up @@ -401,4 +398,3 @@ class EventMessageTableData implements Insertable<EventMessageTableData> {
*/

0 comments on commit f679bca

Please sign in to comment.