Removed useless prints.

This commit is contained in:
retoor 2025-03-27 17:28:54 +01:00
parent 877ef7970d
commit 87c189b3fe
7 changed files with 10 additions and 7 deletions

View File

@ -5,6 +5,13 @@ class ChannelMemberService(BaseService):
mapper_name = "channel_member" mapper_name = "channel_member"
async def mark_as_read(self, channel_uid, user_uid):
channel_member = await self.get(
channel_uid=channel_uid,
user_uid=user_uid
)
channel_member["new_count"] = 0
return await self.save(channel_member)
async def create( async def create(
self, self,

View File

@ -43,7 +43,6 @@ class NotificationService(BaseService):
usr = await self.services.user.get(uid=channel_member["user_uid"]) usr = await self.services.user.get(uid=channel_member["user_uid"])
if not usr: if not usr:
continue continue
print("INSERTED FOR ",usr["username"],flush=True)
await self.services.channel_member.save(channel_member) await self.services.channel_member.save(channel_member)
model = await self.new() model = await self.new()

View File

@ -49,7 +49,6 @@ class BaseMapper:
if not model.record.get("uid"): if not model.record.get("uid"):
raise Exception(f"Attempt to save without uid: {model.record}.") raise Exception(f"Attempt to save without uid: {model.record}.")
model.updated_at.update() model.updated_at.update()
print(model.record,flush=True)
return self.table.upsert(model.record, ["uid"]) return self.table.upsert(model.record, ["uid"])
async def find(self, **kwargs) -> typing.AsyncGenerator: async def find(self, **kwargs) -> typing.AsyncGenerator:

View File

@ -70,4 +70,3 @@ class BaseFormView(BaseView):
return await self.json_response(result) return await self.json_response(result)
async def submit(self, model=None): async def submit(self, model=None):
print("Submit sucess")

View File

@ -184,6 +184,7 @@
setTimeout(() => { setTimeout(() => {
updateLayout(doScrollDownBecauseLastMessageIsVisible) updateLayout(doScrollDownBecauseLastMessageIsVisible)
}, 1000); }, 1000);
app.rpc.markAsRead(channelUid);
}); });
initInputField(getInputField()); initInputField(getInputField());

View File

@ -39,9 +39,9 @@ class RPCView(BaseView):
def is_logged_in(self): def is_logged_in(self):
return self.view.session.get("logged_in", False) return self.view.session.get("logged_in", False)
async def mark_as_read(self, message_uid): async def mark_as_read(self, channel_uid):
self._require_login() self._require_login()
await self.services.notification.mark_as_read(self.user_uid, message_uid) await self.services.channel_member.mark_as_read(channel_uid, self.user_uid)
return True return True
async def login(self, username, password): async def login(self, username, password):
@ -167,7 +167,6 @@ class RPCView(BaseView):
await self._send_json({"callId": call_id, "success": False, "data": str(ex)}) await self._send_json({"callId": call_id, "success": False, "data": str(ex)})
async def _send_json(self, obj): async def _send_json(self, obj):
print(obj, flush=True)
await self.ws.send_str(json.dumps(obj, default=str)) await self.ws.send_str(json.dumps(obj, default=str))

View File

@ -31,7 +31,6 @@ class TerminalSocketView(BaseView):
root = await self.prepare_drive() root = await self.prepare_drive()
command = f"docker run -v ./{root}/:/root --rm -it --memory 512M --cpus=0.5 -w /root ubuntu:latest /bin/bash" command = f"docker run -v ./{root}/:/root --rm -it --memory 512M --cpus=0.5 -w /root ubuntu:latest /bin/bash"
print(command)
session = self.user_sessions.get(user["uid"]) session = self.user_sessions.get(user["uid"])
if not session: if not session: