Improve/add notifications for location and poll events (#7552)
* Add getSenderName() Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Handle location and poll event notifications Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * i18n Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * pollQuestions -> pollQuestion Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Make lookup safe and remove poll end event lookup as it wouldn't work Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * i18n Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
aac5964121
commit
1d45921d14
4 changed files with 81 additions and 12 deletions
|
@ -21,6 +21,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { MsgType } from "matrix-js-sdk/src/@types/event";
|
||||
import { LOCATION_EVENT_TYPE } from "matrix-js-sdk/src/@types/location";
|
||||
|
||||
import { MatrixClientPeg } from './MatrixClientPeg';
|
||||
import SdkConfig from './SdkConfig';
|
||||
|
@ -56,10 +57,16 @@ This is useful when the content body contains fallback text that would explain t
|
|||
type of tile.
|
||||
*/
|
||||
const msgTypeHandlers = {
|
||||
[MsgType.KeyVerificationRequest]: (event) => {
|
||||
[MsgType.KeyVerificationRequest]: (event: MatrixEvent) => {
|
||||
const name = (event.sender || {}).name;
|
||||
return _t("%(name)s is requesting verification", { name });
|
||||
},
|
||||
[LOCATION_EVENT_TYPE.name]: (event: MatrixEvent) => {
|
||||
return TextForEvent.textForLocationEvent(event)();
|
||||
},
|
||||
[LOCATION_EVENT_TYPE.altName]: (event: MatrixEvent) => {
|
||||
return TextForEvent.textForLocationEvent(event)();
|
||||
},
|
||||
};
|
||||
|
||||
export const Notifier = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue