Report using eventId for now

Just grab a random one (latest)
This commit is contained in:
N-Pex 2025-03-24 15:29:12 +01:00
parent c0f41f44e9
commit 21c5842f71

View file

@ -40,7 +40,6 @@
</template>
<script>
import roomInfoMixin from "./roomInfoMixin";
import * as utils from 'matrix-js-sdk/lib/utils';
export default {
name: "ReportRoomDialog",
@ -74,16 +73,21 @@ export default {
methods: {
onReport() {
const path = utils.encodeUri("/rooms/$roomId/report", {
$roomId: this.room.roomId,
});
this.$matrix.matrixClient.http.authedRequest("POST", path, undefined, { reason: this.reason }, { prefix: "/_matrix/client/v3"})
const events = this.room.getLiveTimeline().getEvents();
if (events && events.length > 0) {
const eventId = events[events.length - 1].getId();
// const path = utils.encodeUri("/rooms/$roomId/report", {
// $roomId: this.room.roomId,
// });
// this.$matrix.matrixClient.http.authedRequest("POST", path, undefined, { reason: this.reason }, { prefix: "/_matrix/client/v3"})
this.$matrix.matrixClient.reportEvent(this.room.roomId, eventId, -100, this.reason)
.then(() => {
this.showDialog = false;
})
.catch((err) => {
console.log("Error reporting", err);
});
}
},
},
};