forked from janek/mostr
feat(tasks): add task author to default columns
This commit is contained in:
parent
721c200b97
commit
c64a1fa051
2 changed files with 18 additions and 16 deletions
|
@ -30,7 +30,7 @@ Immutable:
|
||||||
- `parentid` - unique task id of the parent, if any
|
- `parentid` - unique task id of the parent, if any
|
||||||
- `name` - initial name of the task
|
- `name` - initial name of the task
|
||||||
- `created` - task creation timestamp
|
- `created` - task creation timestamp
|
||||||
- `author` - name of the task creator
|
- `author` - name or abbreviated key of the task creator
|
||||||
Task:
|
Task:
|
||||||
- `status` - pure task status
|
- `status` - pure task status
|
||||||
- `hashtags` - list of hashtags set for the task
|
- `hashtags` - list of hashtags set for the task
|
||||||
|
|
30
src/tasks.rs
30
src/tasks.rs
|
@ -119,19 +119,21 @@ impl Tasks {
|
||||||
tasks: Default::default(),
|
tasks: Default::default(),
|
||||||
history: Default::default(),
|
history: Default::default(),
|
||||||
users: Default::default(),
|
users: Default::default(),
|
||||||
properties: vec![
|
properties: [
|
||||||
"state".into(),
|
"author",
|
||||||
"rtime".into(),
|
"state",
|
||||||
"hashtags".into(),
|
"rtime",
|
||||||
"rpath".into(),
|
"hashtags",
|
||||||
"desc".into(),
|
"rpath",
|
||||||
],
|
"desc",
|
||||||
sorting: VecDeque::from([
|
].into_iter().map(|s| s.to_string()).collect(),
|
||||||
"state".into(),
|
sorting: [
|
||||||
"hashtags".into(),
|
"author",
|
||||||
"rtime".into(),
|
"state",
|
||||||
"name".into(),
|
"hashtags",
|
||||||
]),
|
"rtime",
|
||||||
|
"name",
|
||||||
|
].into_iter().map(|s| s.to_string()).collect(),
|
||||||
view: Default::default(),
|
view: Default::default(),
|
||||||
tags: Default::default(),
|
tags: Default::default(),
|
||||||
tags_excluded: Default::default(),
|
tags_excluded: Default::default(),
|
||||||
|
@ -502,7 +504,7 @@ impl Tasks {
|
||||||
pub(crate) fn get_author(&self, pubkey: &PublicKey) -> String {
|
pub(crate) fn get_author(&self, pubkey: &PublicKey) -> String {
|
||||||
self.users.get(pubkey)
|
self.users.get(pubkey)
|
||||||
.and_then(|m| m.name.clone())
|
.and_then(|m| m.name.clone())
|
||||||
.unwrap_or_else(|| pubkey.to_string())
|
.unwrap_or_else(|| format!("{:.6}", pubkey.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Movement and Selection
|
// Movement and Selection
|
||||||
|
|
Loading…
Add table
Reference in a new issue