Fixed a bug related to editing public tasks

pull/14/head
Sam Bosley 13 years ago
parent 7b997f36cd
commit 100085c6da

@ -454,6 +454,11 @@ public final class Task extends RemoteModel {
return hasDueTime(getValue(Task.DUE_DATE)); return hasDueTime(getValue(Task.DUE_DATE));
} }
public boolean isEditable() {
return !getFlag(Task.FLAGS, Task.FLAG_IS_READONLY) &&
!(getFlag(Task.FLAGS, Task.FLAG_PUBLIC) && getValue(Task.USER_ID) != Task.USER_ID_SELF);
}
/** /**
* Checks whether provided due date has a due time or only a date * Checks whether provided due date has a due time or only a date
*/ */

@ -352,7 +352,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
if(task.isDeleted()) if(task.isDeleted())
return; return;
if (!task.getFlag(Task.FLAGS, Task.FLAG_IS_READONLY)) { if (task.isEditable()) {
onTaskListItemClicked(id); onTaskListItemClicked(id);
} }
} }

@ -1048,8 +1048,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
return; return;
long taskId = viewHolder.task.getId(); long taskId = viewHolder.task.getId();
if (!viewHolder.task.getFlag(Task.FLAGS, Task.FLAG_IS_READONLY) && if (viewHolder.task.isEditable()) {
!(viewHolder.task.getFlag(Task.FLAGS, Task.FLAG_PUBLIC) && viewHolder.task.getValue(Task.USER_ID) != Task.USER_ID_SELF)) {
editTask(taskId); editTask(taskId);
} }
} }

Loading…
Cancel
Save