-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Service Room component #408
base: develop
Are you sure you want to change the base?
Conversation
* a new notice with the same ID can be sent (to avoid room spam). | ||
* Defaults to a hour. | ||
*/ | ||
minimumUpdatePeriodMs?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about making this non-optional and setting it to a default value in the constructor?
This would also ensure that callers won't have to handle falling back to a default value when checking this.
/** | ||
* Any metadata to be included in all notice events. | ||
*/ | ||
metadata: Record<string, unknown> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it help to define a type alias for this? It could be shared by both this and NotificationEventContent.metadata
.
resolved: boolean; | ||
} | ||
|
||
const STATE_KEY_TYPE = "org.matrix.service-notice"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named EVENT_TYPE
instead?
if (ex.body.errcode !== "M_NOT_FOUND") { | ||
throw ex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spaces -> tabs
); | ||
} | ||
catch (ex) { | ||
if (ex.body.errcode !== "M_NOT_FOUND") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can getRoomStateEvent
ever throw an object without a body
?
public async clearServiceNotice(noticeId: string): Promise<boolean> { | ||
const serviceNotice = await this.getServiceNotification(noticeId); | ||
if (!serviceNotice || 'resolved' in serviceNotice) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about if serviceNotice.resolved
is false?
(The code currently prevents that from ever happening, but maybe a future change will allow it.)
This component allows bridges to report issues with their configuration, service outages or other high level issues to a Matrix room which can then be used by other services to report issues to end users. This is intended strictly for server admins.