Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

todo_widget: Fix bug where new todos sometimes replaced old todos.

N-Shar-ma6d2de28bf076
diff --git a/static/js/todo_widget.js b/static/js/todo_widget.js
index 4b42fa500cd..442fff50faa 100644
--- a/static/js/todo_widget.js
+++ b/static/js/todo_widget.js
@@ -6,6 +6,7 @@ import render_widgets_todo_widget_tasks from "../templates/widgets/todo_widget_t
import * as blueslip from "./blueslip";
import {$t} from "./i18n";
import {page_params} from "./page_params";
+import * as people from "./people";
import * as util from "./util";
// Any single user should send add a finite number of tasks
@@ -16,6 +17,10 @@ export class TaskData {
task_map = new Map();
my_idx = 1;
+ constructor({current_user_id}) {
+ this.me = current_user_id;
+ }
+
get_widget_data() {
const all_tasks = Array.from(this.task_map.values());
all_tasks.sort((a, b) => util.strcmp(a.task, b.task));
@@ -156,7 +161,9 @@ export function activate(opts) {
const elem = opts.elem;
const callback = opts.callback;
- const task_data = new TaskData();
+ const task_data = new TaskData({
+ current_user_id: people.my_current_user_id(),
+ });
function render() {
const html = render_widgets_todo_widget();