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::a_sync_allow_threads;
|
||||||
use super::Client;
|
use super::Client;
|
||||||
|
use crate::api::User;
|
||||||
use crate::workspace::Workspace;
|
use crate::workspace::Workspace;
|
||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
|
|
||||||
|
@ -82,14 +83,9 @@ impl Client {
|
||||||
self.active_workspaces()
|
self.active_workspaces()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyo3(name = "user_id")]
|
#[pyo3(name = "current_user")]
|
||||||
fn pyuser_id(&self) -> String {
|
fn pycurrent_user(&self) -> User {
|
||||||
self.my_user().id.to_string()
|
self.current_user().clone()
|
||||||
}
|
|
||||||
|
|
||||||
#[pyo3(name = "user_name")]
|
|
||||||
fn pyuser_name(&self) -> String {
|
|
||||||
self.my_user().name.clone()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyo3(name = "refresh")]
|
#[pyo3(name = "refresh")]
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::api::controller::AsyncReceiver;
|
use crate::api::controller::AsyncReceiver;
|
||||||
|
use crate::api::User;
|
||||||
use crate::buffer::Controller as BufferController;
|
use crate::buffer::Controller as BufferController;
|
||||||
use crate::cursor::Controller as CursorController;
|
use crate::cursor::Controller as CursorController;
|
||||||
use crate::workspace::Workspace;
|
use crate::workspace::Workspace;
|
||||||
|
@ -25,7 +26,7 @@ impl Workspace {
|
||||||
|
|
||||||
#[pyo3(name = "detach_buffer")]
|
#[pyo3(name = "detach_buffer")]
|
||||||
fn pydetach_buffer(&self, path: String) -> bool {
|
fn pydetach_buffer(&self, path: String) -> bool {
|
||||||
self.detach(path.as_str())
|
self.detach_buffer(path.as_str())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyo3(name = "fetch_buffers")]
|
#[pyo3(name = "fetch_buffers")]
|
||||||
|
@ -63,9 +64,9 @@ impl Workspace {
|
||||||
self.cursor()
|
self.cursor()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyo3(name = "buffer_by_name")]
|
#[pyo3(name = "get_buffer")]
|
||||||
fn pybuffer_by_name(&self, path: String) -> Option<BufferController> {
|
fn pyget_buffer(&self, path: String) -> Option<BufferController> {
|
||||||
self.buffer_by_name(path.as_str())
|
self.get_buffer(path.as_str())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyo3(name = "active_buffers")]
|
#[pyo3(name = "active_buffers")]
|
||||||
|
|
Loading…
Reference in a new issue