Skip to content

Commit 68c4477

Browse files
committed
fix change group name
1 parent 6493411 commit 68c4477

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

pubspec.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ packages:
322322
name: flutter_quill
323323
url: "https://pub.dartlang.org"
324324
source: hosted
325-
version: "2.5.1"
325+
version: "3.0.1"
326326
flutter_test:
327327
dependency: "direct dev"
328328
description: flutter
@@ -386,7 +386,7 @@ packages:
386386
name: i18n_extension
387387
url: "https://pub.dartlang.org"
388388
source: hosted
389-
version: "4.1.3"
389+
version: "4.2.0"
390390
image:
391391
dependency: transitive
392392
description:
@@ -524,7 +524,7 @@ packages:
524524
name: path_provider_android
525525
url: "https://pub.dartlang.org"
526526
source: hosted
527-
version: "2.0.9"
527+
version: "2.0.11"
528528
path_provider_ios:
529529
dependency: transitive
530530
description:
@@ -921,21 +921,21 @@ packages:
921921
name: video_player
922922
url: "https://pub.dartlang.org"
923923
source: hosted
924-
version: "2.2.8"
924+
version: "2.2.10"
925925
video_player_platform_interface:
926926
dependency: transitive
927927
description:
928928
name: video_player_platform_interface
929929
url: "https://pub.dartlang.org"
930930
source: hosted
931-
version: "4.2.0"
931+
version: "5.0.0"
932932
video_player_web:
933933
dependency: transitive
934934
description:
935935
name: video_player_web
936936
url: "https://pub.dartlang.org"
937937
source: hosted
938-
version: "2.0.4"
938+
version: "2.0.5"
939939
vm_service:
940940
dependency: transitive
941941
description:
@@ -970,7 +970,7 @@ packages:
970970
name: win32
971971
url: "https://pub.dartlang.org"
972972
source: hosted
973-
version: "2.3.1"
973+
version: "2.3.3"
974974
xdg_directories:
975975
dependency: transitive
976976
description:

src/account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Account {
8383

8484
Account {
8585
id: 0,
86-
pub_height: 0,
86+
pub_height: 1,
8787
own_height: 0,
8888
wallet: String::new(),
8989
event: EventId::default(),

src/apps/group/layer.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,10 @@ async fn handle_server_event(
253253
// 3. broadcast offline event.
254254
broadcast(&LayerEvent::MemberOffline(gcd, fgid), layer, &gcd, results).await?;
255255
}
256-
LayerEvent::GroupName(_gcd, name) => {
256+
LayerEvent::GroupName(gcd, name) => {
257+
// 1. update group name
257258
let _ = GroupChat::update_name(&db, &id, &name)?;
259+
// 2. UI: update
258260
results.rpcs.push(rpc::group_name(ogid, &id, &name));
259261
if let Ok(sid) = Session::update_name_by_id(
260262
&session_db(&base, &ogid)?,
@@ -264,6 +266,8 @@ async fn handle_server_event(
264266
) {
265267
results.rpcs.push(session_update_name(ogid, &sid, &name));
266268
}
269+
// 3. broadcast
270+
broadcast(&LayerEvent::GroupName(gcd, name), layer, &gcd, results).await?;
267271
}
268272
LayerEvent::Sync(gcd, _, event) => {
269273
match event {

src/apps/group/rpc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,16 @@ pub(crate) fn new_rpc_handler(handler: &mut RpcHandler<RpcState>) {
290290
let g = GroupChat::get(&db, &id)?;
291291
let d = bincode::serialize(&LayerEvent::GroupName(g.g_id, name.to_owned()))?;
292292

293-
if let Ok(sid) = Session::update_name_by_id(
294-
&session_db(&base, &gid)?,
295-
&id,
296-
&SessionType::Group,
297-
&name,
298-
) {
299-
results.rpcs.push(session_update_name(gid, &sid, &name));
300-
}
301-
302293
if g.local {
294+
if let Ok(sid) = Session::update_name_by_id(
295+
&session_db(&base, &gid)?,
296+
&id,
297+
&SessionType::Group,
298+
&name,
299+
) {
300+
results.rpcs.push(session_update_name(gid, &sid, &name));
301+
}
302+
303303
results.rpcs.push(json!([id, name]));
304304
// dissolve group.
305305
for (mgid, maddr) in state.layer.read().await.running(&g.g_id)?.onlines() {

0 commit comments

Comments
 (0)