Fixes!
parent: tbd commit: 398622e
1 | use Error; |
2 | use Value; |
3 | |
4 | use crate:: |
5 | |
6 | UserBioRequest, UserDisplayImageRequest, UserDisplayNameRequest, UserRepositoriesRequest, |
7 | UserRepositoriesResponse, |
8 | , |
9 | , |
10 | ; |
11 | |
12 | use ; |
13 | |
14 | pub async |
15 | message_type: &str, |
16 | message: &NetworkMessage, |
17 | state: &ConnectionState, |
18 | |
19 | match message_type |
20 | "&giterated_daemon::messages::user::UserDisplayNameRequest" => |
21 | display_name.handle_message .await |
22 | |
23 | "&giterated_daemon::messages::user::UserDisplayImageRequest" => |
24 | display_image.handle_message .await |
25 | |
26 | "&giterated_daemon::messages::user::UserBioRequest" => |
27 | bio.handle_message .await |
28 | |
29 | "&giterated_daemon::messages::user::UserRepositoriesRequest" => |
30 | repositories.handle_message .await |
31 | |
32 | _ => Err, |
33 | |
34 | |
35 | |
36 | async |
37 | Message | : ,
38 | State | : ,
39 | |
40 | let mut user_backend = connection_state.user_backend.lock .await; |
41 | let response = user_backend.display_name .await?; |
42 | |
43 | drop; |
44 | |
45 | connection_state.send .await?; |
46 | |
47 | Ok |
48 | |
49 | |
50 | async |
51 | Message | : ,
52 | State | : ,
53 | |
54 | let mut user_backend = connection_state.user_backend.lock .await; |
55 | let response = user_backend.display_image .await?; |
56 | |
57 | drop; |
58 | |
59 | connection_state.send .await?; |
60 | |
61 | Ok |
62 | |
63 | |
64 | async |
65 | Message | : ,
66 | State | : ,
67 | |
68 | let mut user_backend = connection_state.user_backend.lock .await; |
69 | let response = user_backend.bio .await?; |
70 | |
71 | drop; |
72 | |
73 | connection_state.send .await?; |
74 | |
75 | Ok |
76 | |
77 | |
78 | async |
79 | Message | : ,
80 | State | : ,
81 | |
82 | let mut repository_backend = connection_state.repository_backend.lock .await; |
83 | |
84 | let repositories = repository_backend |
85 | .repositories_for_user |
86 | .await; |
87 | |
88 | let repositories = match repositories |
89 | Ok => repositories, |
90 | Err => |
91 | error!; |
92 | return Ok; |
93 | |
94 | ; |
95 | drop; |
96 | |
97 | let mut user_backend = connection_state.user_backend.lock .await; |
98 | let user_exists = user_backend.exists .await; |
99 | |
100 | if repositories.is_empty && !matches! |
101 | panic! |
102 | |
103 | |
104 | let response: UserRepositoriesResponse = UserRepositoriesResponse ; |
105 | |
106 | connection_state.send .await?; |
107 | |
108 | Ok |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | Other, |
115 | |
116 |