Version 20.36.12: Feb 27, 2021 Queries moved to module swad_timeline_database.

This commit is contained in:
acanas 2021-02-27 16:16:46 +01:00
parent 70bd31cf91
commit ad76b62131
4 changed files with 65 additions and 21 deletions

View File

@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 20.36.11 (2021-02-07)"
#define Log_PLATFORM_VERSION "SWAD 20.36.12 (2021-02-07)"
#define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js"
/*
@ -601,6 +601,7 @@ TODO: DNI de un estudiante sale err
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
TODO: Salvador Romero Cortés: @acanas opción para editar posts
Version 20.36.12: Feb 27, 2021 Queries moved to module swad_timeline_database. (305282 lines)
Version 20.36.11: Feb 27, 2021 Query moved to module swad_timeline_database. (305246 lines)
Version 20.36.10: Feb 27, 2021 Query moved to module swad_timeline_database. (305243 lines)
Version 20.36.9: Feb 27, 2021 Query moved to module swad_timeline_database. (305233 lines)

View File

@ -130,6 +130,47 @@ void TL_DB_InsertNoteInVisibleTimeline (long NotCod)
NotCod);
}
/*****************************************************************************/
/*************************** Remove favs for a note **************************/
/*****************************************************************************/
void TL_DB_RemoveNoteFavs (long NotCod)
{
/***** Remove favs for note *****/
DB_QueryDELETE ("can not remove favs for note",
"DELETE FROM tl_notes_fav"
" WHERE NotCod=%ld",
NotCod);
}
/*****************************************************************************/
/******************** Remove all publications of this note *******************/
/*****************************************************************************/
void TL_DB_RemoveNotePubs (long NotCod)
{
/***** Remove all publications of this note *****/
DB_QueryDELETE ("can not remove a publication",
"DELETE FROM tl_pubs"
" WHERE NotCod=%ld",
NotCod);
}
/*****************************************************************************/
/******************* Remove note publication from database *******************/
/*****************************************************************************/
void TL_DB_RemoveNote (long NotCod,long PublisherCod)
{
/***** Remove note *****/
DB_QueryDELETE ("can not remove a note",
"DELETE FROM tl_notes"
" WHERE NotCod=%ld"
" AND UsrCod=%ld", // Extra check: author
NotCod,
PublisherCod);
}
/*****************************************************************************/
/***************** Get code of media associated to post **********************/
/*****************************************************************************/
@ -139,6 +180,19 @@ long TL_DB_GetMedCodFromPost (long PubCod)
return TL_DB_GetMedCodFromPub (PubCod,"tl_posts");
}
/*****************************************************************************/
/************************* Remove post from database *************************/
/*****************************************************************************/
void TL_DB_RemovePost (long PstCod)
{
/***** Remove post *****/
DB_QueryDELETE ("can not remove a post",
"DELETE FROM tl_posts"
" WHERE PstCod=%ld",
PstCod);
}
/*****************************************************************************/
/********************* Get number of comments in a note **********************/
/*****************************************************************************/

View File

@ -54,9 +54,13 @@ void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType,
const char *Path);
void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod);
void TL_DB_InsertNoteInVisibleTimeline (long NotCod);
void TL_DB_RemoveNoteFavs (long NotCod);
void TL_DB_RemoveNotePubs (long NotCod);
void TL_DB_RemoveNote (long NotCod,long PublisherCod);
/* Posts */
long TL_DB_GetMedCodFromPost (long PubCod);
void TL_DB_RemovePost (long PstCod);
/* Comments */
unsigned TL_DB_GetNumCommentsInNote (long NotCod);

View File

@ -1233,7 +1233,6 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
/***** Mark possible notifications on the publications
of this note as removed *****/
/* Mark notifications of the original note as removed */
PubCod = TL_Not_GetPubCodOfOriginalNote (Not->NotCod);
if (PubCod > 0)
{
@ -1243,31 +1242,17 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
}
/***** Remove favs for this note *****/
DB_QueryDELETE ("can not remove favs for note",
"DELETE FROM tl_notes_fav"
" WHERE NotCod=%ld",
Not->NotCod);
TL_DB_RemoveNoteFavs (Not->NotCod);
/***** Remove all the publications of this note *****/
DB_QueryDELETE ("can not remove a publication",
"DELETE FROM tl_pubs"
" WHERE NotCod=%ld",
Not->NotCod);
/***** Remove all publications of this note *****/
TL_DB_RemoveNotePubs (Not->NotCod);
/***** Remove note *****/
DB_QueryDELETE ("can not remove a note",
"DELETE FROM tl_notes"
" WHERE NotCod=%ld"
" AND UsrCod=%ld", // Extra check: I am the author
Not->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
TL_DB_RemoveNote (Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod);
if (Not->NoteType == TL_NOTE_POST)
/***** Remove post *****/
DB_QueryDELETE ("can not remove a post",
"DELETE FROM tl_posts"
" WHERE PstCod=%ld",
Not->Cod);
TL_DB_RemovePost (Not->Cod);
}
/*****************************************************************************/