Commit 63ae0a979b

63ae0a979b79200d9643d1a4a14b24397e4910ec

parent: 1d27f59d36

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-01-03 15:55 UTC

room: Restore the room topic when we restore the room.

Layout: unified · split

Cargo.lock +9 −19
@@ -747,16 +747,6 @@ dependencies = [
747 "num_cpus", 747 "num_cpus",
748] 748]
749 749
750[[package]]
751name = "dashmap"
752version = "4.0.1"
753source = "registry+https://github.com/rust-lang/crates.io-index"
754checksum = "4b937cd1fbd1f194ac842196bd2529f21618088ee6d8bff6a46ece611451c96b"
755dependencies = [
756 "cfg-if 1.0.0",
757 "num_cpus",
758]
759
760[[package]] 750[[package]]
761name = "digest" 751name = "digest"
762version = "0.8.1" 752version = "0.8.1"
@@ -1520,10 +1510,10 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
1520[[package]] 1510[[package]]
1521name = "matrix-sdk" 1511name = "matrix-sdk"
1522version = "0.1.0" 1512version = "0.1.0"
1523source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#0edef38eb70e3aa66fa6d6f52ae00b67d0228d46" 1513source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#74998c8dd80330def131739ce595a2af5bc512e6"
1524dependencies = [ 1514dependencies = [
1525 "async-trait", 1515 "async-trait",
1526 "dashmap 3.11.10", 1516 "dashmap",
1527 "futures", 1517 "futures",
1528 "futures-timer", 1518 "futures-timer",
1529 "http", 1519 "http",
@@ -1544,10 +1534,10 @@ dependencies = [
1544[[package]] 1534[[package]]
1545name = "matrix-sdk-base" 1535name = "matrix-sdk-base"
1546version = "0.1.0" 1536version = "0.1.0"
1547source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#0edef38eb70e3aa66fa6d6f52ae00b67d0228d46" 1537source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#74998c8dd80330def131739ce595a2af5bc512e6"
1548dependencies = [ 1538dependencies = [
1549 "async-trait", 1539 "async-trait",
1550 "dashmap 4.0.1", 1540 "dashmap",
1551 "futures", 1541 "futures",
1552 "matrix-sdk-common", 1542 "matrix-sdk-common",
1553 "matrix-sdk-common-macros", 1543 "matrix-sdk-common-macros",
@@ -1564,7 +1554,7 @@ dependencies = [
1564[[package]] 1554[[package]]
1565name = "matrix-sdk-common" 1555name = "matrix-sdk-common"
1566version = "0.1.0" 1556version = "0.1.0"
1567source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#0edef38eb70e3aa66fa6d6f52ae00b67d0228d46" 1557source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#74998c8dd80330def131739ce595a2af5bc512e6"
1568dependencies = [ 1558dependencies = [
1569 "assign", 1559 "assign",
1570 "futures-locks", 1560 "futures-locks",
@@ -1578,7 +1568,7 @@ dependencies = [
1578[[package]] 1568[[package]]
1579name = "matrix-sdk-common-macros" 1569name = "matrix-sdk-common-macros"
1580version = "0.1.0" 1570version = "0.1.0"
1581source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#0edef38eb70e3aa66fa6d6f52ae00b67d0228d46" 1571source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#74998c8dd80330def131739ce595a2af5bc512e6"
1582dependencies = [ 1572dependencies = [
1583 "quote", 1573 "quote",
1584 "syn", 1574 "syn",
@@ -1587,7 +1577,7 @@ dependencies = [
1587[[package]] 1577[[package]]
1588name = "matrix-sdk-crypto" 1578name = "matrix-sdk-crypto"
1589version = "0.1.0" 1579version = "0.1.0"
1590source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#0edef38eb70e3aa66fa6d6f52ae00b67d0228d46" 1580source = "git+https://github.com/matrix-org/matrix-rust-sdk/?branch=new-state-store#74998c8dd80330def131739ce595a2af5bc512e6"
1591dependencies = [ 1581dependencies = [
1592 "aes-ctr", 1582 "aes-ctr",
1593 "aes-gcm", 1583 "aes-gcm",
@@ -1595,7 +1585,7 @@ dependencies = [
1595 "atomic", 1585 "atomic",
1596 "base64", 1586 "base64",
1597 "byteorder", 1587 "byteorder",
1598 "dashmap 3.11.10", 1588 "dashmap",
1599 "getrandom 0.2.0", 1589 "getrandom 0.2.0",
1600 "hmac", 1590 "hmac",
1601 "matrix-sdk-common", 1591 "matrix-sdk-common",
@@ -3586,7 +3576,7 @@ dependencies = [
3586 "async-trait", 3576 "async-trait",
3587 "chrono", 3577 "chrono",
3588 "clap", 3578 "clap",
3589 "dashmap 3.11.10", 3579 "dashmap",
3590 "futures", 3580 "futures",
3591 "indoc", 3581 "indoc",
3592 "matrix-sdk", 3582 "matrix-sdk",
src/room/mod.rs +4 −3
@@ -327,6 +327,7 @@ impl RoomHandle {
327 prev_batch.map(PrevBatch::Forward); 327 prev_batch.map(PrevBatch::Forward);
328 328
329 room_buffer.update_buffer_name(); 329 room_buffer.update_buffer_name();
330 room_buffer.set_topic();
330 331
331 room_buffer 332 room_buffer
332 } 333 }
@@ -872,9 +873,9 @@ impl MatrixRoom {
872 } 873 }
873 } 874 }
874 875
875 fn set_topic(&self, topic: &str) { 876 fn set_topic(&self) {
876 if let Ok(buffer) = self.buffer_handle().upgrade() { 877 if let Ok(buffer) = self.buffer_handle().upgrade() {
877 buffer.set_title(topic); 878 buffer.set_title(&self.room().topic().unwrap_or_default());
878 } 879 }
879 } 880 }
880 881
@@ -1009,7 +1010,7 @@ impl MatrixRoom {
1009 self.handle_membership_event(e, state_event).await 1010 self.handle_membership_event(e, state_event).await
1010 } 1011 }
1011 AnySyncStateEvent::RoomName(_) => self.update_buffer_name(), 1012 AnySyncStateEvent::RoomName(_) => self.update_buffer_name(),
1012 AnySyncStateEvent::RoomTopic(t) => self.set_topic(&t.content.topic), 1013 AnySyncStateEvent::RoomTopic(_) => self.set_topic(),
1013 _ => (), 1014 _ => (),
1014 } 1015 }
1015 } 1016 }