todo lists: Make lists sharable.

We no longer restrict who can add tasks or check
them off.

Fixes #10440
This commit is contained in:
Steve Howell 2018-09-08 17:34:48 +00:00 committed by Tim Abbott
parent e9f889d57e
commit d8c454b097
1 changed files with 4 additions and 13 deletions

View File

@ -2,7 +2,7 @@ var todo_widget = (function () {
var exports = {}; var exports = {};
exports.task_data_holder = function (is_my_task_list) { exports.task_data_holder = function () {
var self = {}; var self = {};
var all_tasks = []; var all_tasks = [];
@ -40,7 +40,7 @@ exports.task_data_holder = function (is_my_task_list) {
}; };
my_idx += 1; my_idx += 1;
if (is_my_task_list && !self.check_task.task_exists(task)) { if (!self.check_task.task_exists(task)) {
return event; return event;
} }
return; return;
@ -76,10 +76,7 @@ exports.task_data_holder = function (is_my_task_list) {
key: key, key: key,
}; };
if (is_my_task_list) { return event;
return event;
}
return;
}, },
inbound: function (sender_id, data) { inbound: function (sender_id, data) {
@ -122,8 +119,7 @@ exports.activate = function (opts) {
var elem = opts.elem; var elem = opts.elem;
var callback = opts.callback; var callback = opts.callback;
var is_my_task_list = people.is_my_user_id(opts.message.sender_id); var task_data = exports.task_data_holder();
var task_data = exports.task_data_holder(is_my_task_list);
function render() { function render() {
var html = templates.render('todo-widget'); var html = templates.render('todo-widget');
@ -157,11 +153,6 @@ exports.activate = function (opts) {
elem.find('ul.todo-widget').html(html); elem.find('ul.todo-widget').html(html);
elem.find(".widget-error").text(''); elem.find(".widget-error").text('');
if (!is_my_task_list) {
elem.find(".add-task-bar").hide();
elem.find("button.task").attr('disabled', true);
}
elem.find("button.task").on('click', function (e) { elem.find("button.task").on('click', function (e) {
e.stopPropagation(); e.stopPropagation();
var key = $(e.target).attr('data-key'); var key = $(e.target).attr('data-key');