This repository was archived by the owner on Feb 4, 2023. It is now read-only.
File tree 6 files changed +19
-11
lines changed
6 files changed +19
-11
lines changed Original file line number Diff line number Diff line change
1
+ ## Unreleased
2
+
3
+ ### Fixed
4
+
5
+ - Some actions would pass the wrong user id around causing infinite spinners, this is now fixed
6
+
1
7
## v0.4.0 - 2021-04-05
2
8
3
9
### Added
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class AddInstancePage extends HookWidget {
25
25
final debounce = useDebounce (() async {
26
26
if (prevInput == instanceController.text) return ;
27
27
28
- final inst = cleanUpUrl (instanceController.text);
28
+ final inst = normalizeInstanceHost (instanceController.text);
29
29
if (inst.isEmpty) {
30
30
isSite.value = null ;
31
31
return ;
@@ -47,7 +47,7 @@ class AddInstancePage extends HookWidget {
47
47
instanceController.removeListener (debounce);
48
48
};
49
49
}, []);
50
- final inst = cleanUpUrl (instanceController.text);
50
+ final inst = normalizeInstanceHost (instanceController.text);
51
51
handleOnAdd () async {
52
52
try {
53
53
await accountsStore.addInstance (inst, assumeValid: true );
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ part 'accounts_store.g.dart';
11
11
/// Store that manages all accounts
12
12
@JsonSerializable ()
13
13
class AccountsStore extends ChangeNotifier {
14
- static const prefsKey = 'v2 :AccountsStore' ;
14
+ static const prefsKey = 'v3 :AccountsStore' ;
15
15
static final _prefs = SharedPreferences .getInstance ();
16
16
17
17
/// Map containing JWT tokens of specific users.
@@ -206,7 +206,9 @@ class AccountsStore extends ChangeNotifier {
206
206
final userData =
207
207
await lemmy.run (GetSite (auth: token.raw)).then ((value) => value.myUser);
208
208
209
- tokens[instanceHost][userData.person.name] = token;
209
+ tokens[instanceHost][userData.person.name] = token.copyWith (
210
+ payload: token.payload.copyWith (sub: userData.person.id),
211
+ );
210
212
211
213
await _assignDefaultAccounts ();
212
214
notifyListeners ();
Original file line number Diff line number Diff line change 1
- /// Returns host of a url without a leading 'www.' or protocol if present also
2
- /// removes trailing '/'
3
- String cleanUpUrl (String url) {
1
+ /// Returns a normalized host of a (maybe) url without a leading www.
2
+ String normalizeInstanceHost (String maybeUrl) {
4
3
try {
5
- return urlHost (url.startsWith ('https://' ) ? url : 'https://$url ' );
6
- } on FormatException catch (_) {
4
+ return urlHost (
5
+ maybeUrl.startsWith ('https://' ) ? maybeUrl : 'https://$maybeUrl ' );
6
+ } on FormatException {
7
7
return '' ;
8
8
}
9
9
}
Original file line number Diff line number Diff line change @@ -412,7 +412,7 @@ packages:
412
412
name: lemmy_api_client
413
413
url: "https://pub.dartlang.org"
414
414
source: hosted
415
- version: "0.13 .0"
415
+ version: "0.14 .0"
416
416
logging:
417
417
dependency: transitive
418
418
description:
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ dependencies:
44
44
# utils
45
45
timeago : ^2.0.27
46
46
fuzzy : <1.0.0
47
- lemmy_api_client : ^0.13 .0
47
+ lemmy_api_client : ^0.14 .0
48
48
intl : ^0.17.0
49
49
matrix4_transform : ^1.1.7
50
50
json_annotation : ^4.0.1
You can’t perform that action at this time.
0 commit comments