From fd98366f3a91c307492bebd964dfb38c848a662a Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Thu, 20 Aug 2015 14:03:10 -0400 Subject: [PATCH 1/4] send only to correct audience --- ape/work.hoon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ape/work.hoon b/ape/work.hoon index b03e69aa7b..f894263346 100644 --- a/ape/work.hoon +++ b/ape/work.hoon @@ -48,7 +48,9 @@ |- ^- (list thought) :_ ~ :+ (shaf %task eny) - [[[%& our (main our)] [*envelope %pending]] ~ ~] + %- mo ^- (list ,[partner envelope delivery]:talk) + %+ turn (~(tap in audience)) + |=(sat=station:talk [[%& sat] [*envelope %pending]]) [now *bouquet [%tax action]] == == From d0b3d5956a975328de0901e4565edc7409e14eb5 Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Thu, 20 Aug 2015 11:31:53 -0700 Subject: [PATCH 2/4] basic sorting / filtering --- pub/work/fab/hymn.hook | 2 +- pub/work/src/css/main.css | 48 +++++- pub/work/src/css/main.styl | 46 +++++- .../src/js/components/FilterComponent.coffee | 24 ++- .../src/js/components/ItemComponent.coffee | 2 +- .../src/js/components/ListComponent.coffee | 4 +- .../js/components/ListeningComponent.coffee | 4 +- .../src/js/components/SortComponent.coffee | 28 +++- pub/work/src/js/main.js | 137 +++++++++++++----- pub/work/src/js/stores/WorkStore.coffee | 35 +++-- 10 files changed, 259 insertions(+), 71 deletions(-) diff --git a/pub/work/fab/hymn.hook b/pub/work/fab/hymn.hook index 34ecd25df2..5165d47b08 100644 --- a/pub/work/fab/hymn.hook +++ b/pub/work/fab/hymn.hook @@ -25,7 +25,7 @@ ;meta(name "viewport", content "width=device-width, height=device-height, ". "initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"); ;link(type "text/css", rel "stylesheet", href "/home/pub/work/src/css/main.css"); - ;title: Talk + ;title: Work == ;body ;div#c; diff --git a/pub/work/src/css/main.css b/pub/work/src/css/main.css index d7f8d2dc27..7804b343b3 100644 --- a/pub/work/src/css/main.css +++ b/pub/work/src/css/main.css @@ -83,7 +83,10 @@ font-style: normal; } html, -body { +body, +input, +label, +button { font-family: "bau"; font-size: 18px; } @@ -98,11 +101,38 @@ body { h1 { font-weight: 500; } +.ctrl { + margin-top: 2rem; +} .ctrl h1 { font-size: 1rem; } +.ctrl .sort label, +.ctrl .filter label { + text-transform: uppercase; + font-size: 0.7rem; + line-height: 2rem; + letter-spacing: 0.07rem; +} +.ctrl .filter { + line-height: 2rem; + margin-right: 1rem; +} +.ctrl .sort { + border: 3px solid transparent; + background-color: transparent; + outline: none; +} +.ctrl .sort.s-1, +.ctrl .sort.s--1 { + border: 3px solid #ccc; +} +.ctrl .sort.s-1 label, +.ctrl .sort.s--1 label { + margin-right: 1rem; +} .items { - margin-top: 4rem; + margin-top: 2rem; } .item { display: block; @@ -257,6 +287,20 @@ h1 { border-bottom: 6px solid transparent; margin-top: 0.4rem; } +.s-1 .caret, +.caret.down { + border-left: 6px solid transparent; + border-top: 6px solid #000; + border-right: 6px solid transparent; + border-bottom: 6px solid transparent; +} +.s--1 .caret, +.caret.up { + border-left: 6px solid transparent; + border-top: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #000; +} .hr1 { height: 0.2rem; width: 6rem; diff --git a/pub/work/src/css/main.styl b/pub/work/src/css/main.styl index dd5531f6f3..ed5bc6ecbf 100644 --- a/pub/work/src/css/main.styl +++ b/pub/work/src/css/main.styl @@ -6,6 +6,9 @@ html body +input +label +button font-family "bau" font-size 18px @@ -21,11 +24,38 @@ h1 font-weight 500 .ctrl + margin-top 2rem + h1 font-size 1rem + + .sort label + .filter label + text-transform uppercase + font-size .7rem + line-height 2rem + letter-spacing .07rem + + .filter + line-height 2rem + margin-right 1rem + + .sort + border 3px solid transparent + background-color transparent + outline none + + .sort.s-1 + .sort.s--1 + border 3px solid #ccc + + label + margin-right 1rem + + .items - margin-top 4rem + margin-top 2rem .item display block @@ -180,6 +210,20 @@ h1 border-bottom 6px solid transparent margin-top .4rem +.s-1 .caret +.caret.down + border-left 6px solid transparent + border-top 6px solid #000 + border-right 6px solid transparent + border-bottom 6px solid transparent + +.s--1 .caret +.caret.up + border-left 6px solid transparent + border-top 6px solid transparent + border-right 6px solid transparent + border-bottom 6px solid #000 + .hr1 height .2rem width 6rem diff --git a/pub/work/src/js/components/FilterComponent.coffee b/pub/work/src/js/components/FilterComponent.coffee index 13d3fa5217..61abe8cf1a 100644 --- a/pub/work/src/js/components/FilterComponent.coffee +++ b/pub/work/src/js/components/FilterComponent.coffee @@ -12,13 +12,15 @@ module.exports = recl change: (e) -> $t = $(e.target).closest('.filter') txt = $t.find('.input').text().trim() + key = $t.attr('data-key') if txt.length is 0 then txt = null - @props.onChange $t.attr('data-key'),txt + if key is 'audience' then txt = txt.split " " + if key is 'tags' then txt = [txt] + @props.onChange key,txt render: -> (div {className:'filters'}, [ - (h1 {}, 'Filters:') - (div {className:'owned filter','data-key':'owned'}, [ - (label {}, 'Owened by:') + (div {className:'owned filter ib','data-key':'owner'}, [ + (label {}, 'Owned by:') (div { contentEditable:true className:'input ib' @@ -26,25 +28,31 @@ module.exports = recl onBlur:@_onBlur },@props.filters.owned) ]) - (div {className:'tag filter','data-key':'tag'}, [ + (div {className:'tag filter ib','data-key':'tags'}, [ (label {}, 'Tag:') (div { contentEditable:true className:'input ib' + onKeyDown:@_onKeyDown + onBlur:@_onBlur },@props.filters.tag) ]) - (div {className:'channel filter','data-key':'channel'}, [ - (label {}, 'Channel:') + (div {className:'channel filter ib','data-key':'audience'}, [ + (label {}, 'Audience:') (div { contentEditable:true className:'input ib' + onKeyDown:@_onKeyDown + onBlur:@_onBlur },@props.filters.channel) ]) - (div {className:'status filter','data-key':'status'}, [ + (div {className:'status filter ib','data-key':'status'}, [ (label {}, 'Status:') (div { contentEditable:true className:'input ib' + onKeyDown:@_onKeyDown + onBlur:@_onBlur },@props.filters.status) ]) ]) \ No newline at end of file diff --git a/pub/work/src/js/components/ItemComponent.coffee b/pub/work/src/js/components/ItemComponent.coffee index 39969cbe34..f7e706ec7b 100644 --- a/pub/work/src/js/components/ItemComponent.coffee +++ b/pub/work/src/js/components/ItemComponent.coffee @@ -51,7 +51,7 @@ module.exports = recl 'data-index':@props.index }, [ (div {className:'audience'},@props.item.audience.join(" ")) - (div {className:'sort ib top'},@props.index) + (div {className:'sort ib top'},@props.item.sort) (div {className:'done ib'},'') (div {className:'title ib top'},[ (div { diff --git a/pub/work/src/js/components/ListComponent.coffee b/pub/work/src/js/components/ListComponent.coffee index 95d2b49f4a..4a9e0c32c4 100644 --- a/pub/work/src/js/components/ListComponent.coffee +++ b/pub/work/src/js/components/ListComponent.coffee @@ -93,7 +93,7 @@ module.exports = recl _changeFilter: (key,val) -> WorkActions.setFilter key,val - _changeSorts: -> + _changeSort: (key,val) -> WorkActions.setSort key,val componentDidMount: -> @placeholder = $ "
x
" @@ -130,7 +130,7 @@ module.exports = recl }) rece(SortComponent, { sorts:@state.sorts - onChange:@_changeSorts + onChange:@_changeSort }) ]), ]) diff --git a/pub/work/src/js/components/ListeningComponent.coffee b/pub/work/src/js/components/ListeningComponent.coffee index bd6dfafabd..ce9f6b2c21 100644 --- a/pub/work/src/js/components/ListeningComponent.coffee +++ b/pub/work/src/js/components/ListeningComponent.coffee @@ -4,6 +4,4 @@ rece = React.createElement module.exports = recl render: -> - (div {className:'listening'}, [ - (h1 {}, 'Listening:') - ]) \ No newline at end of file + (div {className:'listening'}, "") \ No newline at end of file diff --git a/pub/work/src/js/components/SortComponent.coffee b/pub/work/src/js/components/SortComponent.coffee index 5c7fa15a13..df9cf242e1 100644 --- a/pub/work/src/js/components/SortComponent.coffee +++ b/pub/work/src/js/components/SortComponent.coffee @@ -1,13 +1,25 @@ recl = React.createClass rece = React.createElement -[div,h1,button] = [React.DOM.div,React.DOM.h1,React.DOM.button] +[div,h1,button,label] = [React.DOM.div,React.DOM.h1,React.DOM.button,React.DOM.label] module.exports = recl + _onClick: (e) -> + $t = $(e.target).closest '.sort' + key = $t.attr('data-key') + sor = Number $t.attr 'data-state' + if sor is 0 then sor = 1 + else if sor is 1 then sor = -1 + else if sor is -1 then sor = 0 + @props.onChange key,sor render: -> - (div {className:'sorts'}, [ - (h1 {}, 'Sorts:') - (button {}, 'Name') - (button {}, 'Owner') - (button {}, 'Date') - (button {}, 'Priority') - ]) \ No newline at end of file + (div {className:'sorts'}, _.map @props.sorts,(s,k) => + (button { + 'data-key':k + 'data-state':s + className:"sort s-#{s}" + onClick:@_onClick + }, [ + (label {}, k) + (div {className:'caret ib'}, '') + ]) + ) \ No newline at end of file diff --git a/pub/work/src/js/main.js b/pub/work/src/js/main.js index 439dbd70c0..11f5654ba5 100644 --- a/pub/work/src/js/main.js +++ b/pub/work/src/js/main.js @@ -68,51 +68,64 @@ module.exports = recl({ return this.change(e); }, change: function(e) { - var $t, txt; + var $t, key, txt; $t = $(e.target).closest('.filter'); txt = $t.find('.input').text().trim(); + key = $t.attr('data-key'); if (txt.length === 0) { txt = null; } - return this.props.onChange($t.attr('data-key'), txt); + if (key === 'audience') { + txt = txt.split(" "); + } + if (key === 'tags') { + txt = [txt]; + } + return this.props.onChange(key, txt); }, render: function() { return div({ className: 'filters' }, [ - h1({}, 'Filters:'), div({ - className: 'owned filter', - 'data-key': 'owned' + div({ + className: 'owned filter ib', + 'data-key': 'owner' }, [ - label({}, 'Owened by:'), div({ + label({}, 'Owned by:'), div({ contentEditable: true, className: 'input ib', onKeyDown: this._onKeyDown, onBlur: this._onBlur }, this.props.filters.owned) ]), div({ - className: 'tag filter', - 'data-key': 'tag' + className: 'tag filter ib', + 'data-key': 'tags' }, [ label({}, 'Tag:'), div({ contentEditable: true, - className: 'input ib' + className: 'input ib', + onKeyDown: this._onKeyDown, + onBlur: this._onBlur }, this.props.filters.tag) ]), div({ - className: 'channel filter', - 'data-key': 'channel' + className: 'channel filter ib', + 'data-key': 'audience' }, [ - label({}, 'Channel:'), div({ + label({}, 'Audience:'), div({ contentEditable: true, - className: 'input ib' + className: 'input ib', + onKeyDown: this._onKeyDown, + onBlur: this._onBlur }, this.props.filters.channel) ]), div({ - className: 'status filter', + className: 'status filter ib', 'data-key': 'status' }, [ label({}, 'Status:'), div({ contentEditable: true, - className: 'input ib' + className: 'input ib', + onKeyDown: this._onKeyDown, + onBlur: this._onBlur }, this.props.filters.status) ]) ]); @@ -191,7 +204,7 @@ module.exports = recl({ className: 'audience' }, this.props.item.audience.join(" ")), div({ className: 'sort ib top' - }, this.props.index), div({ + }, this.props.item.sort), div({ className: 'done ib' }, ''), div({ className: 'title ib top' @@ -421,7 +434,9 @@ module.exports = recl({ _changeFilter: function(key, val) { return WorkActions.setFilter(key, val); }, - _changeSorts: function() {}, + _changeSort: function(key, val) { + return WorkActions.setSort(key, val); + }, componentDidMount: function() { this.placeholder = $("
x
"); WorkStore.addChangeListener(this._onChangeStore); @@ -466,7 +481,7 @@ module.exports = recl({ onChange: this._changeFilter }), rece(SortComponent, { sorts: this.state.sorts, - onChange: this._changeSorts + onChange: this._changeSort }) ]) ]), div({ @@ -504,25 +519,52 @@ module.exports = recl({ render: function() { return div({ className: 'listening' - }, [h1({}, 'Listening:')]); + }, ""); } }); },{}],6:[function(require,module,exports){ -var button, div, h1, rece, recl, ref; +var button, div, h1, label, rece, recl, ref; recl = React.createClass; rece = React.createElement; -ref = [React.DOM.div, React.DOM.h1, React.DOM.button], div = ref[0], h1 = ref[1], button = ref[2]; +ref = [React.DOM.div, React.DOM.h1, React.DOM.button, React.DOM.label], div = ref[0], h1 = ref[1], button = ref[2], label = ref[3]; module.exports = recl({ + _onClick: function(e) { + var $t, key, sor; + $t = $(e.target).closest('.sort'); + key = $t.attr('data-key'); + sor = Number($t.attr('data-state')); + if (sor === 0) { + sor = 1; + } else if (sor === 1) { + sor = -1; + } else if (sor === -1) { + sor = 0; + } + return this.props.onChange(key, sor); + }, render: function() { return div({ className: 'sorts' - }, [h1({}, 'Sorts:'), button({}, 'Name'), button({}, 'Owner'), button({}, 'Date'), button({}, 'Priority')]); + }, _.map(this.props.sorts, (function(_this) { + return function(s, k) { + return button({ + 'data-key': k, + 'data-state': s, + className: "sort s-" + s, + onClick: _this._onClick + }, [ + label({}, k), div({ + className: 'caret ib' + }, '') + ]); + }; + })(this))); } }); @@ -999,17 +1041,17 @@ _list = [ _listening = []; _filters = { - owned: null, - tag: null, - channel: null, + owner: null, + tags: null, + audience: null, status: null }; _sorts = { - name: null, - owner: null, - date: null, - priority: null + title: 0, + owner: 0, + date: 0, + sort: 0 }; WorkStore = assign({}, EventEmitter.prototype, { @@ -1023,20 +1065,43 @@ WorkStore = assign({}, EventEmitter.prototype, { return this.removeListener("change", cb); }, getList: function(key) { - var add, k, list, v; + var _k, _v, add, c, k, list, v; list = []; for (k in _list) { v = _list[k]; add = true; - if (_filters.owned !== null) { - if (v.owner !== _filters.owned) { - add = false; + for (_k in _filters) { + _v = _filters[_k]; + if (_v === null) { + continue; + } + c = v[_k]; + if (typeof c === 'object') { + if (_.intersection(c, _v).length === 0) { + add = false; + } + } else { + if (c !== _v) { + add = false; + } } } if (add === true) { list.push(v); } } + if (_.uniq(_.values(_sorts)).length > 0) { + for (k in _sorts) { + v = _sorts[k]; + if (v !== 0) { + break; + } + } + list = _.sortBy(list, k, k); + if (v === -1) { + list.reverse(); + } + } return list; }, getListening: function() { @@ -1054,8 +1119,12 @@ WorkStore = assign({}, EventEmitter.prototype, { return _sorts; }, setSort: function(arg) { - var key, val; + var k, key, v, val; key = arg.key, val = arg.val; + for (k in _sorts) { + v = _sorts[k]; + _sorts[k] = 0; + } return _sorts[key] = val; }, newItem: function(arg) { diff --git a/pub/work/src/js/stores/WorkStore.coffee b/pub/work/src/js/stores/WorkStore.coffee index 9ada54d959..9e795f5653 100644 --- a/pub/work/src/js/stores/WorkStore.coffee +++ b/pub/work/src/js/stores/WorkStore.coffee @@ -50,15 +50,15 @@ _list = [ ] _listening = [] _filters = - owned:null - tag:null - channel:null + owner:null + tags:null + audience:null status:null _sorts = - name:null - owner:null - date:null - priority:null + title:0 + owner:0 + date:0 + sort:0 WorkStore = assign {},EventEmitter.prototype,{ emitChange: -> @emit 'change' @@ -69,11 +69,21 @@ WorkStore = assign {},EventEmitter.prototype,{ list = [] for k,v of _list add = true - if _filters.owned isnt null - if v.owner isnt _filters.owned - add = false + for _k,_v of _filters + if _v is null then continue + c = v[_k] + if typeof(c) is 'object' + if _.intersection(c,_v).length is 0 then add = false + else + if c isnt _v then add = false if add is true list.push v + if _.uniq(_.values(_sorts)).length > 0 + for k,v of _sorts + if v isnt 0 + break + list = _.sortBy list,k,k + if v is -1 then list.reverse() list getListening: -> _listening @@ -84,7 +94,10 @@ WorkStore = assign {},EventEmitter.prototype,{ getSorts: -> _sorts - setSort: ({key,val}) -> _sorts[key] = val + setSort: ({key,val}) -> + for k,v of _sorts + _sorts[k] = 0 + _sorts[key] = val newItem: ({index}) -> item = From 29340a3b305d2d0971d51914201d23bc07c7ca5e Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Thu, 20 Aug 2015 15:04:52 -0400 Subject: [PATCH 3/4] claiming works without sanity checks --- ape/work.hoon | 57 ++++++++++++++++++++++++++++++++++++--------------- sur/talk.hoon | 15 +++++++------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/ape/work.hoon b/ape/work.hoon index f894263346..a403cea8f2 100644 --- a/ape/work.hoon +++ b/ape/work.hoon @@ -54,10 +54,29 @@ [now *bouquet [%tax action]] == == + ++ claim + %_ . + eny (sham eny %direct) + moves + :_ ~ + ^- move + :* ost %poke + /claiming/(scot %uw id) + [our %talk] + %talk-command + ^- command:talk + :- %publish + |- ^- (list thought) + :_ ~ + :+ (shaf %task eny) + [[[%& owner (main owner)] [*envelope %pending]] ~ ~] + [now *bouquet [%tax %claim id]] + == + == ++ create (send `duty:work-stuff:talk`[%create `task`tax]) ++ send-update |*(* (send %update id +(version) +<)) ++ announce (send-update %announce ~) - ++ release (cury send-update %announce) + ++ release (cury send-update %release) ++ accept (send-update %accept ~) ++ delete (send-update %delete ~) ++ set-date-due (cury send-update %set-date-due) @@ -67,7 +86,6 @@ ++ set-done (cury send-update %set-done) ++ add-comment (cury send-update %add-comment) ++ set-audience ~|(%not-implemented !!) - ++ claim ~|(%not-implemented !!) ++ process-update |= up=update ^+ +> @@ -98,9 +116,11 @@ ++ process-duty |= [when=@da her=ship from=(set station:talk) action=duty:work-stuff:talk] ^- [(list move) _+>.$] - =< mirror-to-web + =- =^ mof con mirror-to-web:con + [(welp mos mof) con] + ^- [mos=(list move) con=_+>.$] ?- -.action - %create + %create :: XX should verify ownership =+ existing-task=(~(get by tasks) id.p.action) ~? ?& ?=(^ existing-task) !=(p.action task.u.existing-task) @@ -116,7 +136,10 @@ ?~ existing-task from (~(uni in audience.u.existing-task) from) =. sort ?~(existing-task sort [id.p.action sort]) - +>.$ + [~ +>.$] + :: + %claim + abet:(release:(at (~(got by tasks) id.action)) her) :: %update =+ tax=(~(get by tasks) id.action) @@ -126,7 +149,7 @@ from=from action=action == - +>.$ + [~ +>.$] ?. =(version.action +(version.task.u.tax)) ~& :* %update-bad-version her @@ -134,7 +157,7 @@ action=action tax=tax == - +>.$ + [~ +>.$] =. tasks %^ ~(put by tasks) id.action ?: ?& ?=(?(%announce %release %accept) -.meat.action) @@ -149,21 +172,23 @@ task.u.tax ?- -.meat.action %announce task.u.tax(status %announced) - %release task.u.tax(owner p.meat.action, status %released) + %release task.u.tax(owner her.meat.action, status %released) %accept task.u.tax(status %accepted) - %delete !! - %set-date-due task.u.tax(date-due p.meat.action) - %set-tags task.u.tax(tags p.meat.action) - %set-title task.u.tax(title p.meat.action) - %set-description task.u.tax(description p.meat.action) - %set-done task.u.tax(done `when) + %delete ~|(%not-implemented !!) + %set-date-due task.u.tax(date-due wen.meat.action) + %set-tags task.u.tax(tags tag.meat.action) + %set-title task.u.tax(title til.meat.action) + %set-description task.u.tax(description des.meat.action) + %set-done task.u.tax(done ?.(don.meat.action ~ `when)) %add-comment %= task.u.tax - discussion [[when her p.meat.action] discussion.task.u.tax] + discussion [[when her com.meat.action] discussion.task.u.tax] == == (~(uni in audience.u.tax) from) - +>.$ + ?: =([%release our] meat.action) + abet:accept:(at (~(got by tasks) id.action)) + [~ +>.$] == :: ++ mirror-to-web diff --git a/sur/talk.hoon b/sur/talk.hoon index 57e9a3181a..32d825b24e 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -82,20 +82,21 @@ |% :: ++ duty :: $% [%create p=task] :: create new task + [%claim id=@uvH] :: claim task $: %update :: operate on task id=@uvH :: which task version=@u :: version $= meat :: $% [%announce ~] :: make available - [%release p=ship] :: pass to new owner + [%release her=ship] :: pass to new owner [%accept ~] :: accept pass [%delete ~] :: delete task - [%set-date-due p=(unit ,@da)] :: set due date - [%set-tags p=(set ,@t)] :: set tags - [%set-title p=@t] :: set title - [%set-description p=@t] :: set description - [%set-done p=?] :: set done - [%add-comment p=@t] :: add comment + [%set-date-due wen=(unit ,@da)] :: set due date + [%set-tags tag=(set ,@t)] :: set tags + [%set-title til=@t] :: set title + [%set-description des=@t] :: set description + [%set-done don=?] :: set done + [%add-comment com=@t] :: add comment == :: == :: == :: From c38bc598ba73266be174bae9914a96a754d5465d Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Thu, 20 Aug 2015 15:40:21 -0400 Subject: [PATCH 4/4] uw -> uv --- ape/work.hoon | 30 +++++++++++++++++++++++------- sur/talk.hoon | 2 +- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ape/work.hoon b/ape/work.hoon index a403cea8f2..45818f9eec 100644 --- a/ape/work.hoon +++ b/ape/work.hoon @@ -40,7 +40,7 @@ :_ ~ ^- move :* ost %poke - /sending/(scot %uw id)/(scot %ud version) + /sending/(scot %uv id)/(scot %ud version) [our %talk] %talk-command ^- command:talk @@ -61,7 +61,7 @@ :_ ~ ^- move :* ost %poke - /claiming/(scot %uw id) + /claiming/(scot %uv id) [our %talk] %talk-command ^- command:talk @@ -121,24 +121,40 @@ ^- [mos=(list move) con=_+>.$] ?- -.action %create :: XX should verify ownership - =+ existing-task=(~(get by tasks) id.p.action) + =+ existing-task=(~(get by tasks) id.tax.action) ~? ?& ?=(^ existing-task) - !=(p.action task.u.existing-task) + !=(tax.action task.u.existing-task) == :* %new-task-with-old-id her=her from=from - new-task=p.action + new-task=tax.action existing-task=u.existing-task == + ?. |(=(her owner.tax.action) =(%released status.tax.action)) + ~& :* %created-with-bad-owner + her=her + from=from + new-task=tax.action + existing-task=u.existing-task + == + [~ +>.$] =. tasks - %^ ~(put by tasks) id.p.action p.action + %^ ~(put by tasks) id.tax.action tax.action ?~ existing-task from (~(uni in audience.u.existing-task) from) - =. sort ?~(existing-task sort [id.p.action sort]) + =. sort ?~(existing-task sort [id.action sort]) [~ +>.$] :: %claim + =+ tax=(~(got by tasks) id.action) + ?. &(=(our owner.tax) =(%announced status.tax)) + ~& :* %bad-claim + her=her + from=from + task=tax + == + [~ +>.$] abet:(release:(at (~(got by tasks) id.action)) her) :: %update diff --git a/sur/talk.hoon b/sur/talk.hoon index 32d825b24e..cd63463b19 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -81,7 +81,7 @@ ++ work-stuff :: |% :: ++ duty :: - $% [%create p=task] :: create new task + $% [%create tax=task] :: create new task [%claim id=@uvH] :: claim task $: %update :: operate on task id=@uvH :: which task