1
0
mirror of https://github.com/haiwen/ccnet-server.git synced 2025-09-17 23:38:54 +00:00

Use transaction when creating a new group.

De-duplicate in getting groups with ancestors.
This commit is contained in:
cuihaikuo
2018-04-04 16:12:12 +08:00
parent b98c73ba23
commit 3a8f175fa8
4 changed files with 125 additions and 59 deletions

View File

@@ -834,7 +834,7 @@ ccnet_db_rollback (CcnetDBTrans *trans)
DBConnection *conn = trans->conn;
GError *error = NULL;
if (!db_connection_commit (conn, &error)) {
if (!db_connection_rollback(conn, &error)) {
ccnet_warning ("Rollback failed: %s.\n", error->message);
g_clear_error (&error);
return -1;

View File

@@ -1145,7 +1145,7 @@ ccnet_rpc_quit_group (int group_id, const char *user_name, GError **error)
}
GList *
ccnet_rpc_get_groups (const char *username, gboolean return_ancestors, GError **error)
ccnet_rpc_get_groups (const char *username, int return_ancestors, GError **error)
{
CcnetGroupManager *group_mgr =
((CcnetServerSession *)session)->group_mgr;
@@ -1157,7 +1157,8 @@ ccnet_rpc_get_groups (const char *username, gboolean return_ancestors, GError **
return NULL;
}
ret = ccnet_group_manager_get_groups_by_user (group_mgr, username, return_ancestors, error);
ret = ccnet_group_manager_get_groups_by_user (group_mgr, username,
return_ancestors ? TRUE : FALSE, error);
return ret;
}

View File

@@ -213,7 +213,7 @@ int
ccnet_rpc_quit_group (int group_id, const char *user_name, GError **error);
GList *
ccnet_rpc_get_groups (const char *username, gboolean return_ancestors, GError **error);
ccnet_rpc_get_groups (const char *username, int return_ancestors, GError **error);
GList *
ccnet_rpc_get_all_groups (int start, int limit, const char *source, GError **error);