mirror of https://github.com/acanas/swad-core.git
Version 20.39.11: Mar 02, 2021 Code refactoring in fav/share timeline.
This commit is contained in:
parent
60be159d57
commit
a83e87d750
|
@ -598,10 +598,11 @@ 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: 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
|
TODO: Salvador Romero Cortés: @acanas opción para editar posts
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.39.10 (2021-03-02)"
|
#define Log_PLATFORM_VERSION "SWAD 20.39.11 (2021-03-02)"
|
||||||
#define CSS_FILE "swad20.33.9.css"
|
#define CSS_FILE "swad20.33.9.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
|
Version 20.39.11: Mar 02, 2021 Code refactoring in fav/share timeline. (305525 lines)
|
||||||
Version 20.39.10: Mar 02, 2021 Code refactoring in timeline. (305576 lines)
|
Version 20.39.10: Mar 02, 2021 Code refactoring in timeline. (305576 lines)
|
||||||
Version 20.39.9: Mar 02, 2021 Code refactoring in timeline. (305580 lines)
|
Version 20.39.9: Mar 02, 2021 Code refactoring in timeline. (305580 lines)
|
||||||
Version 20.39.8: Mar 02, 2021 Code refactoring in timeline. (305573 lines)
|
Version 20.39.8: Mar 02, 2021 Code refactoring in timeline. (305573 lines)
|
||||||
|
|
41
swad_text.c
41
swad_text.c
|
@ -46594,27 +46594,6 @@ const char *Txt_The_centre_X_has_been_renamed_as_Y = // Warning: it is very impo
|
||||||
"O centro <strong>%s</strong> foi renomeado como <strong>%s</strong>.";
|
"O centro <strong>%s</strong> foi renomeado como <strong>%s</strong>.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_The_comment_no_longer_exists =
|
|
||||||
#if L==1 // ca
|
|
||||||
"El comentari ja no existeix.";
|
|
||||||
#elif L==2 // de
|
|
||||||
"Der Kommentar nicht mehr existiert.";
|
|
||||||
#elif L==3 // en
|
|
||||||
"The comment no longer exists.";
|
|
||||||
#elif L==4 // es
|
|
||||||
"El comentario ya no existe.";
|
|
||||||
#elif L==5 // fr
|
|
||||||
"Le commentaire a disparu.";
|
|
||||||
#elif L==6 // gn
|
|
||||||
"El comentario ya no existe."; // Okoteve traducción
|
|
||||||
#elif L==7 // it
|
|
||||||
"Il commento non esiste più.";
|
|
||||||
#elif L==8 // pl
|
|
||||||
"Komentarz już nie istnieje.";
|
|
||||||
#elif L==9 // pt
|
|
||||||
"O comentário não existe mais.";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *Txt_The_configuration_of_the_projects_has_been_updated =
|
const char *Txt_The_configuration_of_the_projects_has_been_updated =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"La configuració dels projectes s'ha actualitzat.";
|
"La configuració dels projectes s'ha actualitzat.";
|
||||||
|
@ -49660,25 +49639,25 @@ const char *Txt_The_photo_no_longer_exists =
|
||||||
"La foto não existe mais.";
|
"La foto não existe mais.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_The_original_post_no_longer_exists =
|
const char *Txt_The_post_no_longer_exists =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"La publicació original ja no existeix.";
|
"La publicació ja no existeix.";
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
"Der ursprüngliche Post nicht mehr existiert.";
|
"Der Post nicht mehr existiert.";
|
||||||
#elif L==3 // en
|
#elif L==3 // en
|
||||||
"The original post no longer exists.";
|
"The post no longer exists.";
|
||||||
#elif L==4 // es
|
#elif L==4 // es
|
||||||
"La publicación original ya no existe.";
|
"La publicación ya no existe.";
|
||||||
#elif L==5 // fr
|
#elif L==5 // fr
|
||||||
"Le post original a disparu.";
|
"Le post a disparu.";
|
||||||
#elif L==6 // gn
|
#elif L==6 // gn
|
||||||
"La publicación original ya no existe."; // Okoteve traducción
|
"La publicación ya no existe."; // Okoteve traducción
|
||||||
#elif L==7 // it
|
#elif L==7 // it
|
||||||
"La pubblicazione originale non esiste più.";
|
"La pubblicazione non esiste più.";
|
||||||
#elif L==8 // pl
|
#elif L==8 // pl
|
||||||
"Oryginalna publikacja już nie istnieje.";
|
"Publikacja już nie istnieje.";
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"A publicação original não existe mais.";
|
"A publicação não existe mais.";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_The_password_can_not_consist_only_of_digits =
|
const char *Txt_The_password_can_not_consist_only_of_digits =
|
||||||
|
|
|
@ -726,7 +726,7 @@ void TL_Com_ReceiveCommGbl (void)
|
||||||
|
|
||||||
static long TL_Com_ReceiveComm (void)
|
static long TL_Com_ReceiveComm (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_post_no_longer_exists;
|
||||||
struct TL_Pst_PostContent Content;
|
struct TL_Pst_PostContent Content;
|
||||||
struct TL_Not_Note Not;
|
struct TL_Not_Note Not;
|
||||||
struct TL_Pub_Publication Pub;
|
struct TL_Pub_Publication Pub;
|
||||||
|
@ -738,7 +738,7 @@ static long TL_Com_ReceiveComm (void)
|
||||||
/***** Trivial check: note code *****/
|
/***** Trivial check: note code *****/
|
||||||
if (Not.NotCod <= 0)
|
if (Not.NotCod <= 0)
|
||||||
{
|
{
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_original_post_no_longer_exists);
|
Ale_ShowAlert (Ale_WARNING,Txt_The_post_no_longer_exists);
|
||||||
return -1L;
|
return -1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ void TL_Com_RequestRemComGbl (void)
|
||||||
|
|
||||||
static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
|
static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_comment_no_longer_exists;
|
extern const char *Txt_The_post_no_longer_exists;
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_comment;
|
extern const char *Txt_Do_you_really_want_to_remove_the_following_comment;
|
||||||
struct TL_Com_Comment Com;
|
struct TL_Com_Comment Com;
|
||||||
|
|
||||||
|
@ -846,7 +846,7 @@ static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
|
||||||
if (Com.PubCod <= 0)
|
if (Com.PubCod <= 0)
|
||||||
{
|
{
|
||||||
Med_MediaDestructor (&Com.Content.Media);
|
Med_MediaDestructor (&Com.Content.Media);
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_comment_no_longer_exists);
|
Ale_ShowAlert (Ale_WARNING,Txt_The_post_no_longer_exists);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +950,7 @@ void TL_Com_RemoveComGbl (void)
|
||||||
|
|
||||||
static void TL_Com_RemoveComm (void)
|
static void TL_Com_RemoveComm (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_comment_no_longer_exists;
|
extern const char *Txt_The_post_no_longer_exists;
|
||||||
extern const char *Txt_Comment_removed;
|
extern const char *Txt_Comment_removed;
|
||||||
struct TL_Com_Comment Com;
|
struct TL_Com_Comment Com;
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ static void TL_Com_RemoveComm (void)
|
||||||
if (Com.PubCod <= 0)
|
if (Com.PubCod <= 0)
|
||||||
{
|
{
|
||||||
Med_MediaDestructor (&Com.Content.Media);
|
Med_MediaDestructor (&Com.Content.Media);
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_comment_no_longer_exists);
|
Ale_ShowAlert (Ale_WARNING,Txt_The_post_no_longer_exists);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,42 +1094,3 @@ static void TL_Com_ResetComm (struct TL_Com_Comment *Com)
|
||||||
Com->Content.Txt[0] = '\0';
|
Com->Content.Txt[0] = '\0';
|
||||||
Com->NumFavs = 0;
|
Com->NumFavs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************* Check if I can fav/share a comment **********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool TL_Com_CheckICanFavShaComm (struct TL_Com_Comment *Com)
|
|
||||||
{
|
|
||||||
extern const char *Txt_The_comment_no_longer_exists;
|
|
||||||
|
|
||||||
/***** Get data of comment *****/
|
|
||||||
Com->PubCod = TL_Pub_GetParamPubCod ();
|
|
||||||
TL_Com_GetDataOfCommByCod (Com);
|
|
||||||
|
|
||||||
/***** Trivial check 1: publication code should be > 0 *****/
|
|
||||||
if (Com->PubCod <= 0)
|
|
||||||
{
|
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_comment_no_longer_exists);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Trivial check 2: I must be logged *****/
|
|
||||||
if (!Gbl.Usrs.Me.Logged)
|
|
||||||
{
|
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
|
||||||
Ale_ShowAlert (Ale_ERROR,"You are not logged.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Trivial check 3: The author can not fav his/her own comments *****/
|
|
||||||
if (Usr_ItsMe (Com->UsrCod))
|
|
||||||
{
|
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
|
||||||
Ale_ShowAlert (Ale_ERROR,"You can not fav/unfav your own comments.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -77,6 +77,4 @@ void TL_Com_RemoveCommMediaAndDBEntries (long PubCod);
|
||||||
|
|
||||||
void TL_Com_GetDataOfCommByCod (struct TL_Com_Comment *Com);
|
void TL_Com_GetDataOfCommByCod (struct TL_Com_Comment *Com);
|
||||||
|
|
||||||
bool TL_Com_CheckICanFavShaComm (struct TL_Com_Comment *Com);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -145,13 +145,16 @@ static void TL_Fav_FavNote (struct TL_Not_Note *Not)
|
||||||
{
|
{
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of note and do some checks *****/
|
/***** Get data of note *****/
|
||||||
if (!TL_Not_CheckICanFavShaNote (Not))
|
Not->NotCod = TL_Not_GetParamNotCod ();
|
||||||
|
TL_Not_GetDataOfNoteByCod (Not);
|
||||||
|
|
||||||
|
/***** Do some checks *****/
|
||||||
|
if (!TL_Usr_CheckICanFavSha (Not->NotCod,Not->UsrCod))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Trivial check: Have I faved this note? *****/
|
/***** Trivial check: Have I faved this note? *****/
|
||||||
if (TL_DB_CheckIfFavedByUsr (TL_Fav_NOTE,Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
if (TL_DB_CheckIfFavedByUsr (TL_Fav_NOTE,Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
// Don't show error message
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Mark note as favourite in database *****/
|
/***** Mark note as favourite in database *****/
|
||||||
|
@ -173,13 +176,16 @@ static void TL_Fav_UnfNote (struct TL_Not_Note *Not)
|
||||||
{
|
{
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of note and do some checks *****/
|
/***** Get data of note *****/
|
||||||
if (!TL_Not_CheckICanFavShaNote (Not))
|
Not->NotCod = TL_Not_GetParamNotCod ();
|
||||||
|
TL_Not_GetDataOfNoteByCod (Not);
|
||||||
|
|
||||||
|
/***** Do some checks *****/
|
||||||
|
if (!TL_Usr_CheckICanFavSha (Not->NotCod,Not->UsrCod))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Trivial check: Have I faved this note? *****/
|
/***** Trivial check: Have I faved this note? *****/
|
||||||
if (!TL_DB_CheckIfFavedByUsr (TL_Fav_NOTE,Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
if (!TL_DB_CheckIfFavedByUsr (TL_Fav_NOTE,Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
// Don't show error message
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Delete the mark as favourite from database *****/
|
/***** Delete the mark as favourite from database *****/
|
||||||
|
@ -270,8 +276,12 @@ static void TL_Fav_FavComm (struct TL_Com_Comment *Com)
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
Med_MediaConstructor (&Com->Content.Media);
|
Med_MediaConstructor (&Com->Content.Media);
|
||||||
|
|
||||||
/***** Get data of comment and do some checks *****/
|
/***** Get data of comment *****/
|
||||||
if (!TL_Com_CheckICanFavShaComm (Com))
|
Com->PubCod = TL_Pub_GetParamPubCod ();
|
||||||
|
TL_Com_GetDataOfCommByCod (Com);
|
||||||
|
|
||||||
|
/***** Do some checks *****/
|
||||||
|
if (!TL_Usr_CheckICanFavSha (Com->PubCod,Com->UsrCod))
|
||||||
{
|
{
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
Med_MediaDestructor (&Com->Content.Media);
|
||||||
return;
|
return;
|
||||||
|
@ -282,7 +292,6 @@ static void TL_Fav_FavComm (struct TL_Com_Comment *Com)
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod))
|
Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
{
|
{
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
Med_MediaDestructor (&Com->Content.Media);
|
||||||
// Don't show error message
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +316,12 @@ static void TL_Fav_UnfComm (struct TL_Com_Comment *Com)
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
Med_MediaConstructor (&Com->Content.Media);
|
Med_MediaConstructor (&Com->Content.Media);
|
||||||
|
|
||||||
/***** Get data of comment and do some checks *****/
|
/***** Get data of comment *****/
|
||||||
if (!TL_Com_CheckICanFavShaComm (Com))
|
Com->PubCod = TL_Pub_GetParamPubCod ();
|
||||||
|
TL_Com_GetDataOfCommByCod (Com);
|
||||||
|
|
||||||
|
/***** Do some checks *****/
|
||||||
|
if (!TL_Usr_CheckICanFavSha (Com->PubCod,Com->UsrCod))
|
||||||
{
|
{
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
Med_MediaDestructor (&Com->Content.Media);
|
||||||
return;
|
return;
|
||||||
|
@ -319,7 +332,6 @@ static void TL_Fav_UnfComm (struct TL_Com_Comment *Com)
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod))
|
Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
{
|
{
|
||||||
Med_MediaDestructor (&Com->Content.Media);
|
Med_MediaDestructor (&Com->Content.Media);
|
||||||
// Don't show error message
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1118,7 +1118,7 @@ void TL_Not_RequestRemNoteGbl (void)
|
||||||
|
|
||||||
static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
|
static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_post_no_longer_exists;
|
||||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_post;
|
extern const char *Txt_Do_you_really_want_to_remove_the_following_post;
|
||||||
struct TL_Not_Note Not;
|
struct TL_Not_Note Not;
|
||||||
|
|
||||||
|
@ -1129,7 +1129,7 @@ static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline)
|
||||||
/***** Trivial check 1: note code should be > 0 *****/
|
/***** Trivial check 1: note code should be > 0 *****/
|
||||||
if (Not.NotCod <= 0)
|
if (Not.NotCod <= 0)
|
||||||
{
|
{
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_original_post_no_longer_exists);
|
Ale_ShowAlert (Ale_WARNING,Txt_The_post_no_longer_exists);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1223,7 +1223,7 @@ void TL_Not_RemoveNoteGbl (void)
|
||||||
|
|
||||||
static void TL_Not_RemoveNote (void)
|
static void TL_Not_RemoveNote (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_post_no_longer_exists;
|
||||||
extern const char *Txt_TIMELINE_Post_removed;
|
extern const char *Txt_TIMELINE_Post_removed;
|
||||||
struct TL_Not_Note Not;
|
struct TL_Not_Note Not;
|
||||||
|
|
||||||
|
@ -1234,7 +1234,7 @@ static void TL_Not_RemoveNote (void)
|
||||||
/***** Trivial check 1: note code should be > 0 *****/
|
/***** Trivial check 1: note code should be > 0 *****/
|
||||||
if (Not.NotCod <= 0)
|
if (Not.NotCod <= 0)
|
||||||
{
|
{
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_original_post_no_longer_exists);
|
Ale_ShowAlert (Ale_WARNING,Txt_The_post_no_longer_exists);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1424,39 +1424,3 @@ void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not)
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************** Check if I can fav/share a note ************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool TL_Not_CheckICanFavShaNote (struct TL_Not_Note *Not)
|
|
||||||
{
|
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
|
||||||
|
|
||||||
/***** Get data of note *****/
|
|
||||||
Not->NotCod = TL_Not_GetParamNotCod ();
|
|
||||||
TL_Not_GetDataOfNoteByCod (Not);
|
|
||||||
|
|
||||||
/***** Trivial check 1: note code should be > 0 *****/
|
|
||||||
if (Not->NotCod <= 0)
|
|
||||||
{
|
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_The_original_post_no_longer_exists);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Trivial check 2: I must be logged *****/
|
|
||||||
if (!Gbl.Usrs.Me.Logged)
|
|
||||||
{
|
|
||||||
Ale_ShowAlert (Ale_ERROR,"You are not logged.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Trivial check 3: The author can not unfav his/her own notes *****/
|
|
||||||
if (Usr_ItsMe (Not->UsrCod))
|
|
||||||
{
|
|
||||||
Ale_ShowAlert (Ale_ERROR,"You can not fav/share your own posts.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -113,6 +113,4 @@ void TL_Not_RemoveNoteGbl (void);
|
||||||
|
|
||||||
void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not);
|
void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not);
|
||||||
|
|
||||||
bool TL_Not_CheckICanFavShaNote (struct TL_Not_Note *Not);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,13 +118,16 @@ static void TL_Sha_ShaNote (struct TL_Not_Note *Not)
|
||||||
struct TL_Pub_Publication Pub;
|
struct TL_Pub_Publication Pub;
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of note and do some checks *****/
|
/***** Get data of note *****/
|
||||||
if (!TL_Not_CheckICanFavShaNote (Not))
|
Not->NotCod = TL_Not_GetParamNotCod ();
|
||||||
|
TL_Not_GetDataOfNoteByCod (Not);
|
||||||
|
|
||||||
|
/***** Do some checks *****/
|
||||||
|
if (!TL_Usr_CheckICanFavSha (Not->NotCod,Not->UsrCod))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Trivial check: Is note already shared by me? *****/
|
/***** Trivial check: Is note already shared by me? *****/
|
||||||
if (TL_DB_CheckIfNoteIsSharedByUsr (Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
if (TL_DB_CheckIfNoteIsSharedByUsr (Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
||||||
// Don't show error message
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Share (publish note in timeline) *****/
|
/***** Share (publish note in timeline) *****/
|
||||||
|
@ -172,13 +175,12 @@ static void TL_Sha_UnsNote (struct TL_Not_Note *Not)
|
||||||
{
|
{
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of note and do some checks *****/
|
/***** Get data of note *****/
|
||||||
if (!TL_Not_CheckICanFavShaNote (Not))
|
Not->NotCod = TL_Not_GetParamNotCod ();
|
||||||
return;
|
TL_Not_GetDataOfNoteByCod (Not);
|
||||||
|
|
||||||
/***** Trivial check: Is note already shared by me? *****/
|
/***** Do some checks *****/
|
||||||
if (!TL_DB_CheckIfNoteIsSharedByUsr (Not->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
|
if (!TL_Usr_CheckICanFavSha (Not->NotCod,Not->UsrCod))
|
||||||
// Don't show error message
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/***** Delete publication from database *****/
|
/***** Delete publication from database *****/
|
||||||
|
|
|
@ -162,3 +162,29 @@ void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res,
|
||||||
/***** Free memory used for user's data *****/
|
/***** Free memory used for user's data *****/
|
||||||
Usr_UsrDataDestructor (&UsrDat);
|
Usr_UsrDataDestructor (&UsrDat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************** Check if I can fav/share a note/comment *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool TL_Usr_CheckICanFavSha (long Cod,long UsrCod)
|
||||||
|
{
|
||||||
|
extern const char *Txt_The_post_no_longer_exists;
|
||||||
|
|
||||||
|
/***** Trivial check 1: note/comment code should be > 0 *****/
|
||||||
|
if (Cod <= 0)
|
||||||
|
{
|
||||||
|
Ale_ShowAlert (Ale_WARNING,Txt_The_post_no_longer_exists);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Trivial check 2: I must be logged
|
||||||
|
I can not fav/share my own notes/comments *****/
|
||||||
|
if (!Gbl.Usrs.Me.Logged || Usr_ItsMe (UsrCod))
|
||||||
|
{
|
||||||
|
Lay_NoPermissionExit ();
|
||||||
|
return false; // Not reached
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -64,5 +64,6 @@ void TL_Usr_RemoveUsrContent (long UsrCod);
|
||||||
void TL_Usr_ShowNumSharersOrFavers (unsigned NumUsrs);
|
void TL_Usr_ShowNumSharersOrFavers (unsigned NumUsrs);
|
||||||
void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res,
|
void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res,
|
||||||
unsigned NumUsrs,unsigned NumFirstUsrs);
|
unsigned NumUsrs,unsigned NumFirstUsrs);
|
||||||
|
bool TL_Usr_CheckICanFavSha (long Cod,long UsrCod);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue