Add initial translation of InviteStore.js

This commit is contained in:
Danila Fedorin 2021-08-11 12:03:06 -07:00
parent 8ad2857c6a
commit 29c87b7c01
2 changed files with 29 additions and 5 deletions

View file

@ -19,7 +19,7 @@ import {StorageError} from "../common";
import {Store} from "./Store"; import {Store} from "./Store";
import {SessionStore} from "./stores/SessionStore"; import {SessionStore} from "./stores/SessionStore";
import {RoomSummaryStore} from "./stores/RoomSummaryStore"; import {RoomSummaryStore} from "./stores/RoomSummaryStore";
import {InviteStore} from "./stores/InviteStore.js"; import {InviteStore} from "./stores/InviteStore";
import {TimelineEventStore} from "./stores/TimelineEventStore.js"; import {TimelineEventStore} from "./stores/TimelineEventStore.js";
import {TimelineRelationStore} from "./stores/TimelineRelationStore.js"; import {TimelineRelationStore} from "./stores/TimelineRelationStore.js";
import {RoomStateStore} from "./stores/RoomStateStore.js"; import {RoomStateStore} from "./stores/RoomStateStore.js";

View file

@ -13,21 +13,45 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import {Store} from "../Store"
// TODO: Move to Invite when that's TypeScript.
interface InviteData {
roomId: string
isEncrypted: boolean
isDirectMessage: boolean
name?: string
avatarUrl?: string
avatarColorId: number
canonicalAlias?: string
timestamp: number
joinRule: string
inviter?: MemberData
}
// TODO: Move to RoomMember when that's TypeScript.
interface MemberData {
roomId: string
userId: string
membership: "join" | "leave" | "invite" | "ban"
}
export class InviteStore { export class InviteStore {
constructor(inviteStore) { private _inviteStore: Store<InviteData>
constructor(inviteStore: Store<InviteData>) {
this._inviteStore = inviteStore; this._inviteStore = inviteStore;
} }
getAll() { getAll(): Promise<InviteData[]> {
return this._inviteStore.selectAll(); return this._inviteStore.selectAll();
} }
set(invite) { set(invite: InviteData): void {
return this._inviteStore.put(invite); return this._inviteStore.put(invite);
} }
remove(roomId) { remove(roomId: string): void {
this._inviteStore.delete(roomId); this._inviteStore.delete(roomId);
} }
} }