Skip to content

Commit

Permalink
Small cleanups and todos
Browse files Browse the repository at this point in the history
  • Loading branch information
estellecomment committed Apr 9, 2024
1 parent a9d226b commit 6c5d6cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/tchap/components/views/dialogs/ExpiredAccountDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TchapUtils from "../../../util/TchapUtils";
interface IProps {
onFinished(): void;
onRequestNewEmail(): Promise<any>;
emailDelay?: number; //delay betwenn 2 emails in seconds, by default 30
emailDelay?: number; //delay between 2 emails in seconds, by default 30
}

interface IState {
Expand All @@ -33,7 +33,7 @@ enum ProcessState {
*/
export default class ExpiredAccountDialog extends React.Component<IProps, IState> {
constructor(props) {
constructor(props: IProps) {
super(props);
this.state = {
isAccountExpired: false,
Expand Down
19 changes: 10 additions & 9 deletions src/tchap/lib/ExpiredAccountHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ class ExpiredAccountHandler {
}

/**
* register the listener after the Matrix Client has been initialized but before it is started
* Register to listen to expired account event.
* Registration is done after the Matrix Client has been initialized but before it is started.
*/
public register() {
const expiredRegistrationId = this.dispatcher.register((payload: ActionPayload) => {
if (payload.action === "will_start_client") {
console.log(":tchap: register a listener for HttpApiEvent.ORG_MATRIX_EXPIRED_ACCOUNT events");
console.log(":tchap: register a listener for HttpApiEvent.ORG_MATRIX_EXPIRED_ACCOUNT events"); // todo(estelle) logger
const cli = MatrixClientPeg.get();
cli.on(HttpApiEvent.ORG_MATRIX_EXPIRED_ACCOUNT, this.boundOnExpiredAccountEvent);
//unregister callback once the work is done
Expand All @@ -46,14 +47,14 @@ class ExpiredAccountHandler {
* When account expired account happens, display the panel if not open yet.
*/
private onExpiredAccountError() {
console.log(":tchap: Expired Account Error received");
console.log(":tchap: Expired Account Error received"); // todo(estelle) reuse logger class

if (this.isPanelOpen) {
return;
}
//shutdown all matrix react services, but without unsetting the client
stopMatrixClient(false);
console.log(":tchap: matrix react services have been shutdown");
console.log(":tchap: matrix react services have been shutdown"); // todo(estelle) reuse logger class

//should we sent the email directly? Normally they should have received already an email 7 days earlier
this.showExpirationPanel();
Expand All @@ -63,7 +64,7 @@ class ExpiredAccountHandler {
private async showExpirationPanel() {
Modal.createDialog(
ExpiredAccountDialog,
{
{ /* props */
onRequestNewEmail: () => {
return TchapUtils.requestNewExpiredAccountEmail();
},
Expand All @@ -74,10 +75,10 @@ class ExpiredAccountHandler {
},
//todo: define which static/dynamic settings are needed for this dialog
},
null,
false,
true,
{
undefined /* className */,
false /* isPriorityModal */,
true /* isStaticModal */,
{ /* options */
//close panel only if account is not expired
onBeforeClose: async () => {
//verify that the account is not expired anymore
Expand Down

0 comments on commit 6c5d6cb

Please sign in to comment.