Skip to content

Commit

Permalink
fixed major bug in last talk page update time
Browse files Browse the repository at this point in the history
  • Loading branch information
benapetr committed May 2, 2019
1 parent b5a6982 commit def78d0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/huggle_core/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ void Message::Finish()
// write something to talk page in case it was empty
if (this->User->TalkPage_GetContents().isEmpty())
this->User->TalkPage_SetContents(this->Text);
// update last message time
this->User->SetLastMessageTime(QDateTime::currentDateTime());
this->User->Update(true);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/huggle_core/warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ PendingWarning *Warnings::WarnUser(const QString& warning_type, RevertQuery *dep
}

edit->User->IncrementWarningLevel();
edit->User->SetLastMessageTime(QDateTime::currentDateTime());
// This must not be here, many warnings fail due to expired talk page and are re-sent
// if we set last message time here, sending after reparse will fail due to that
//edit->User->SetLastMessageTime(QDateTime::currentDateTime());
// We need to update the user so that new user warning level gets propagated everywhere on interface of huggle
edit->User->Update();

Expand Down
2 changes: 1 addition & 1 deletion src/huggle_core/wikiuser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void WikiUser::SetLastMessageTime(const QDateTime &date_time)
{
if (this->LastMessageTimeKnown && this->LastMessageTime > date_time)
{
HUGGLE_DEBUG1(this->GetSite()->Name + ": user " + this->Username + " had LastWarningTime changed to past");
HUGGLE_DEBUG1(this->GetSite()->Name + ": user " + this->Username + " had LastWarningTime changed to past by " + QString::number(date_time.secsTo(this->LastMessageTime)) + " seconds");
}

this->LastMessageTimeKnown = true;
Expand Down

0 comments on commit def78d0

Please sign in to comment.