Skip to content

Commit

Permalink
bug: fixup tag delete (#24)
Browse files Browse the repository at this point in the history
* bug: fixup tag delete

* changelog/3.0.2
  • Loading branch information
l7ssha authored Nov 20, 2022
1 parent 7262eec commit 5fdac3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.2

- Fixup tag deleting

## 3.0.1

- Fixup reminder execution
Expand Down
8 changes: 4 additions & 4 deletions lib/src/services/db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class DatabaseService {
_readyCompleter.complete();
}

/// Fetch all reminders currrently in the database.
/// Fetch all reminders currently in the database.
Future<Iterable<Reminder>> fetchReminders() async {
await _ready;

Expand Down Expand Up @@ -211,7 +211,7 @@ class DatabaseService {
await _ready;

final result = await _connection.query('''
SELECT * FROM tags;
SELECT * FROM tags WHERE enabled = TRUE;
''');

return result.map(Tag.fromRow);
Expand All @@ -228,7 +228,7 @@ class DatabaseService {
await _ready;

await _connection.execute('''
DELETE FROM tags WHERE id = @id;
UPDATE tags SET enabled = FALSE WHERE id = @id;
''', substitutionValues: {
'id': id,
});
Expand Down Expand Up @@ -299,7 +299,7 @@ class DatabaseService {
await _ready;

final result = await _connection.query('''
SELECT * FROM tag_usage;
SELECT tu.* FROM tag_usage tu JOIN tags t ON t.id = tu.tag_id AND t.enabled = TRUE;
''');

return result.map(TagUsedEvent.fromRow);
Expand Down
5 changes: 3 additions & 2 deletions lib/src/services/poop_name.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class PoopNameService {
return;
}

if ((member.nickname ?? (await member.user.getOrDownload()).username).startsWith(_poopRegexp)) {
_logger.fine("Changing ${member.id} (${member.nickname ?? member.user.getFromCache()?.username})'s nickname to poop emoji");
final memberUser = await member.user.getOrDownload();
if ((member.nickname ?? memberUser.username).startsWith(_poopRegexp)) {
_logger.fine("Changing ${member.id} (${member.nickname ?? memberUser.username})'s nickname to poop emoji");

await member.edit(builder: MemberBuilder()..nick = _poopEmoji);
}
Expand Down

0 comments on commit 5fdac3b

Please sign in to comment.