mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-21 23:04:49 +01:00
fix(py): unify current_user
This commit is contained in:
parent
a44edee07b
commit
a721e17024
2 changed files with 9 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
|||
use super::a_sync_allow_threads;
|
||||
use super::Client;
|
||||
use crate::api::User;
|
||||
use crate::workspace::Workspace;
|
||||
use pyo3::prelude::*;
|
||||
|
||||
|
@ -82,14 +83,9 @@ impl Client {
|
|||
self.active_workspaces()
|
||||
}
|
||||
|
||||
#[pyo3(name = "user_id")]
|
||||
fn pyuser_id(&self) -> String {
|
||||
self.my_user().id.to_string()
|
||||
}
|
||||
|
||||
#[pyo3(name = "user_name")]
|
||||
fn pyuser_name(&self) -> String {
|
||||
self.my_user().name.clone()
|
||||
#[pyo3(name = "current_user")]
|
||||
fn pycurrent_user(&self) -> User {
|
||||
self.current_user().clone()
|
||||
}
|
||||
|
||||
#[pyo3(name = "refresh")]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::api::controller::AsyncReceiver;
|
||||
use crate::api::User;
|
||||
use crate::buffer::Controller as BufferController;
|
||||
use crate::cursor::Controller as CursorController;
|
||||
use crate::workspace::Workspace;
|
||||
|
@ -25,7 +26,7 @@ impl Workspace {
|
|||
|
||||
#[pyo3(name = "detach_buffer")]
|
||||
fn pydetach_buffer(&self, path: String) -> bool {
|
||||
self.detach(path.as_str())
|
||||
self.detach_buffer(path.as_str())
|
||||
}
|
||||
|
||||
#[pyo3(name = "fetch_buffers")]
|
||||
|
@ -63,9 +64,9 @@ impl Workspace {
|
|||
self.cursor()
|
||||
}
|
||||
|
||||
#[pyo3(name = "buffer_by_name")]
|
||||
fn pybuffer_by_name(&self, path: String) -> Option<BufferController> {
|
||||
self.buffer_by_name(path.as_str())
|
||||
#[pyo3(name = "get_buffer")]
|
||||
fn pyget_buffer(&self, path: String) -> Option<BufferController> {
|
||||
self.get_buffer(path.as_str())
|
||||
}
|
||||
|
||||
#[pyo3(name = "active_buffers")]
|
||||
|
|
Loading…
Reference in a new issue