Skip to content

Commit

Permalink
fix #1176
Browse files Browse the repository at this point in the history
  • Loading branch information
alainm23 committed Mar 4, 2024
1 parent 69804b9 commit 87c565a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions core/Objects/Item.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1383,19 +1383,19 @@ public class Objects.Item : Objects.BaseObject {
}
}

public void move (Objects.Project project, string section_id) {
public void move (Objects.Project project, string _section_id) {
show_item = false;

if (project.backend_type == BackendType.LOCAL) {
_move (project.id, section_id);
} else if (project.backend_type == BackendType.TODOIST) {
loading = true;

string move_id = project_id;
string move_id = project.id;
string move_type = "project_id";
if (section_id != "") {
if (_section_id != "") {
move_type = "section_id";
move_id = section_id;
move_id = _section_id;
}

Services.Todoist.get_default ().move_item.begin (this, move_type, move_id, (obj, res) => {
Expand All @@ -1411,7 +1411,7 @@ public class Objects.Item : Objects.BaseObject {
} else if (project.backend_type == BackendType.CALDAV) {
loading = true;

Services.CalDAV.get_default ().move_task.begin (this, project_id, (obj, res) => {
Services.CalDAV.get_default ().move_task.begin (this, project.id, (obj, res) => {
var response = Services.CalDAV.get_default ().move_task.end (res);
loading = false;

Expand Down
3 changes: 1 addition & 2 deletions core/Services/CalDAV.vala
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ public class Services.CalDAV : GLib.Object {
public async HttpResponse move_task (Objects.Item item, string project_id) {
var server_url = Services.Settings.get_default ().settings.get_string ("caldav-server-url");
var username = Services.Settings.get_default ().settings.get_string ("caldav-username");


var url = "%s/remote.php/dav/calendars/%s/%s/%s".printf (server_url, username, item.project.id, item.ics);
var destination = "/remote.php/dav/calendars/%s/%s/%s".printf (username, project_id, item.ics);
Expand All @@ -943,7 +942,7 @@ public class Services.CalDAV : GLib.Object {
try {
yield session.send_and_read_async (message, GLib.Priority.HIGH, null);

if (message.status_code == 201) {
if (message.status_code == 201 || message.status_code == 204) {
response.status = true;
}
} catch (Error e) {
Expand Down
5 changes: 4 additions & 1 deletion core/Services/Todoist.vala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public class Services.Todoist : GLib.Object {

var network_monitor = GLib.NetworkMonitor.get_default ();
network_monitor.network_changed.connect (() => {
if (GLib.NetworkMonitor.get_default ().network_available && is_logged_in () &&
if (GLib.NetworkMonitor.get_default ().network_available &&
is_logged_in () &&
Services.Settings.get_default ().settings.get_boolean ("todoist-sync-server")) {
sync_async ();
}
Expand Down Expand Up @@ -1211,6 +1212,7 @@ public class Services.Todoist : GLib.Object {
public async HttpResponse move_item (Objects.Item item, string type, string id) {
string uuid = Util.get_default ().generate_string ();
string json = item.get_move_item (uuid, type, id);
print ("%s\n".printf (json));

var message = new Soup.Message ("POST", TODOIST_SYNC_URL);
message.request_headers.append (
Expand All @@ -1223,6 +1225,7 @@ public class Services.Todoist : GLib.Object {

try {
GLib.Bytes stream = yield session.send_and_read_async (message, GLib.Priority.HIGH, null);
print ("%s\n".printf ((string) stream.get_data ()));
parser.load_from_data ((string) stream.get_data ());

print_root (parser.get_root ());
Expand Down
1 change: 0 additions & 1 deletion src/Layouts/ProjectRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ public class Layouts.ProjectRow : Gtk.ListBoxRow {
drop_magic_button_target.drop.connect ((value, x, y) => {
var dialog = new Dialogs.Project.new (project.backend_type, false, project.id);
dialog.show ();

return true;
});

Expand Down

0 comments on commit 87c565a

Please sign in to comment.