Bug fixed
authorAjay Bura <ajbura@gmail.com>
Sun, 14 Nov 2021 06:01:22 +0000 (11:31 +0530)
committerAjay Bura <ajbura@gmail.com>
Sun, 14 Nov 2021 06:01:22 +0000 (11:31 +0530)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
README.md
src/app/organisms/room/RoomViewContent.jsx
src/app/templates/auth/Auth.jsx
src/client/initMatrix.js
src/index.scss
src/util/matrixUtil.js

index e89b9d67d65a74268a25e151e6f41fa3129985d0..0eeb9c99dd6a44d94c803778fdce5d49d77b625e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ To set default Homeserver on login and register page, place a customized [`confi
 
 ## License
 
-Copyright (c) 2021 Ajay Bura (ajbura) and other contributors
+Copyright (c) 2021 Ajay Bura (ajbura) and contributors
 
 Code licensed under the MIT License: <http://opensource.org/licenses/MIT>
 
index d69a90e592432774ff53382427c5e23a84d0349c..f61a17397cfda921a6836a3b52167c3190bde835 100644 (file)
@@ -8,7 +8,7 @@ import dateFormat from 'dateformat';
 import initMatrix from '../../../client/initMatrix';
 import cons from '../../../client/state/cons';
 import { redactEvent, sendReaction } from '../../../client/action/roomTimeline';
-import { getUsername, getUsernameOfRoomMember, doesRoomHaveUnread } from '../../../util/matrixUtil';
+import { getUsername, getUsernameOfRoomMember } from '../../../util/matrixUtil';
 import colorMXID from '../../../util/colorMXID';
 import { diffMinutes, isNotInSameDay, getEventCords } from '../../../util/common';
 import { openEmojiBoard, openProfileViewer, openReadReceipts } from '../../../client/action/navigation';
@@ -191,6 +191,7 @@ function RoomViewContent({
   const [onPagination, setOnPagination] = useState(null);
   const [editEvent, setEditEvent] = useState(null);
   const mx = initMatrix.matrixClient;
+  const noti = initMatrix.notifications;
 
   function autoLoadTimeline() {
     if (timelineScroll.isScrollable() === true) return;
@@ -199,7 +200,7 @@ function RoomViewContent({
   function trySendingReadReceipt() {
     const { room, timeline } = roomTimeline;
     if (
-      (doesRoomHaveUnread(room) || initMatrix.notifications.hasNoti(roomId))
+      (noti.doesRoomHaveUnread(room) || noti.hasNoti(roomId))
       && timeline.length !== 0) {
       mx.sendReadReceipt(timeline[timeline.length - 1]);
     }
index eae602cf386ad001b15aae3bba60efc6939cebff..9465a86b7d4bdbf7765bdd02ef1dcb213ac901d9 100644 (file)
@@ -333,7 +333,7 @@ function Register({ registerInfo, loginFlow, baseUrl }) {
       }).catch((err) => {
         const msg = err.message || err.error;
         if (['M_USER_IN_USE', 'M_INVALID_USERNAME', 'M_EXCLUSIVE'].indexOf(err.errcode) > -1) {
-          actions.setErrors({ username: err.errCode === 'M_USER_IN_USE' ? 'Username is already taken' : msg });
+          actions.setErrors({ username: err.errcode === 'M_USER_IN_USE' ? 'Username is already taken' : msg });
         } else if (msg) actions.setErrors({ other: msg });
 
         actions.setSubmitting(false);
index 91a41ea47ef39c277416ae938b7863de9827f277..05f499cce7138b4b8f1b57f6234a174ce92b258f 100644 (file)
@@ -31,6 +31,7 @@ class InitMatrix extends EventEmitter {
       sessionStore: new sdk.WebStorageSessionStore(global.localStorage),
       cryptoStore: new sdk.IndexedDBCryptoStore(global.indexedDB, 'crypto-store'),
       deviceId: secret.deviceId,
+      timelineSupport: true,
     });
 
     await this.matrixClient.initCrypto();
index a4f1eaabdb31a37f22f078bf35d57f089a8dc069..387b0cdc4221b3d58037fda9b96634117cb42829 100644 (file)
@@ -290,7 +290,12 @@ button {
   overflow: visible;
   -webkit-appearance: button;
 }
-textarea, input[type="text"] {
+textarea,
+input,
+input[type=text]
+input[type=username]
+input[type=password]
+input[type=email] {
   -webkit-appearance: none;
   -moz-appearance: none;
   appearance: none;
index e0b07100d9b5b40251c1f577b3bb285bad1dbc6d..6f33c46bfcff139e7c5b4bdf1885bc6defb8ce59 100644 (file)
@@ -48,30 +48,6 @@ async function isRoomAliasAvailable(alias) {
   }
 }
 
-function doesRoomHaveUnread(room) {
-  const userId = initMatrix.matrixClient.getUserId();
-  const readUpToId = room.getEventReadUpTo(userId);
-  const supportEvents = ['m.room.message', 'm.room.encrypted', 'm.sticker'];
-
-  if (room.timeline.length
-    && room.timeline[room.timeline.length - 1].sender
-    && room.timeline[room.timeline.length - 1].sender.userId === userId
-    && room.timeline[room.timeline.length - 1].getType() !== 'm.room.member') {
-    return false;
-  }
-
-  for (let i = room.timeline.length - 1; i >= 0; i -= 1) {
-    const event = room.timeline[i];
-
-    if (event.getId() === readUpToId) return false;
-
-    if (supportEvents.includes(event.getType())) {
-      return true;
-    }
-  }
-  return true;
-}
-
 function getPowerLabel(powerLevel) {
   if (powerLevel > 9000) return 'Goku';
   if (powerLevel > 100) return 'Founder';
@@ -82,5 +58,5 @@ function getPowerLabel(powerLevel) {
 
 export {
   getBaseUrl, getUsername, getUsernameOfRoomMember,
-  isRoomAliasAvailable, doesRoomHaveUnread, getPowerLabel,
+  isRoomAliasAvailable, getPowerLabel,
 };