Commit graph

22 commits

Author SHA1 Message Date
Ankush Menat
3414c0d063 refactor!: Merge redis_socketio and redis_queue
- realtime communication uses pub-sub and no storage. So using same
  redis server for both should be just fine.
- This is how FC works since quite a lot of time. We haven't seen any
  problem so far.
2023-06-11 11:40:22 +05:30
Ankush Menat
54ae0c4a21 refactor: move flush_realtime_log to realtime.py
This doesn't have anything to do with databases
2023-06-03 18:44:19 +05:30
Ankush Menat
98e8b6d389
fix: correctly return session usertype (#20787)
`user_type` is under data dict and not on session itself.
2023-04-19 23:56:33 +05:30
Ankush Menat
3f717f2fbd perf: Don't re-initate sessions in realtime.py
Session is already created for all requests in app.py -> init_request -> HTTPRequest()
2023-03-23 16:55:09 +05:30
Gavin D'souza
c960382667 fix(socketio)!: Event list_update > doctype_subscribe 2022-12-28 00:25:58 +05:30
Gavin D'souza
d3250f6504 refactor(whitelisted): Add typing hints to APIs
* Refactor type checks defined in APIs
* Remove dead/deprecated kwargs usages
* Added appropriate hints to APIs and consecutive utils defined in the following modules:
 - frappe.realtime
 - frappe.translate
 - frappe.utils.global_search
 - frappe.www.third_party_apps
 - frappe.www.search
 - frappe.www.printview
2022-12-15 13:47:05 +05:30
Gavin D'souza
40df601a73 fix: Auto-add all users to website room
Keep website room open for all - currently only used for discussions
2022-11-17 17:04:07 +05:30
gavin
862a5a398d fix(socketio): Revert irrelevant & unused changes
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2022-11-17 15:20:00 +05:30
Gavin D'souza
3a8fa6cbd5 refactor(socketio): Use same room for doc & info events
other changes
- Name list room as doctype room for more generic use
- avoid re-setting up listeners for generic events
- discard docinfo_subscribe event
2022-11-15 17:55:53 +05:30
Gavin D'souza
97d2eab3e2 refactor(socketio): docinfo_update
- Rename event from `update_docinfo_for_{}_{}` to docinfo_update
- Separate rooms for separate documents generated on requirement
- Check if user has access to doc before sharing docinfo
2022-11-15 13:15:34 +05:30
Gavin D'souza
9931c3af04 refactor(socketio)!: list_update
- Subscribe to list_update only for the list/report views that are
  opened
- Check if user has read permission for doctype to subscribe to list
  updates
2022-11-15 13:15:34 +05:30
Gavin D'souza
4de9c39bb8 refactor: SocketIO
- Check request data in middleware
- Authenticate each connection before allowing room access
- Allow site room access only to System Users, restrict Website User &
  Guests to their respective user rooms

Note: This doesn't check for roles / permissions
2022-11-15 13:15:30 +05:30
Suraj Shetty
05f416e448 refactor: Removed vendored socketio library
- Removed vendored socketio library
- Add socket.io-client library
- Removed unnecessary code in socketio server
- Remove chat related code
2022-06-29 14:58:13 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Abhishek Saxena
5c8856d66e
refactor: db.sql calls to frappe.qb (#16107)
# Changes

- Introduces `subqry` class to use in where clause when there is a non-column condition. eg.
> .where(subqry(no_of_roles) == 0)
- Convert SQL queries to frappe.qb 

# Testing

Functions with query refactors
- frappe.boot.get_user_pages_or_reports() -> Same output of `get_bootinfo()` as develop
- frappe.boot.get_unseen_notes() -> Forms the same query as develop 
```sql
SELECT `name`,`title`,`content`,`notify_on_every_login`
FROM `tabNote` WHERE `notify_on_every_login`=1
AND `expire_notification_on`>'2022-03-30 01:10:53.393874'
AND (SELECT `nsb`.`user` FROM `tabNote Seen By` `nsb` WHERE `nsb`.`parent`=`tabNote`.`name`) NOT IN ('Administrator')
```
- frappe.installer._delete_doctypes() -> installed and uninsalled a dummy app to drop tables

### Not tested
- frappe.make_property_setter()
- frappe.realtime.get_pending_tasks_for_doc() [whitelist method]
- frappe.sessions.Session.start()
- frappe.twofactor.cache_2fa_data()
2022-04-12 05:07:25 +00:00
phot0n
bebc8058b6 feat: integer primary keys 2022-03-11 23:46:00 +05:30
barredterra
745297a49d refactor: a not in b
Search: if not ([\w\d]*?) in ([\w\d]*?)
Replace: if $1 not in $2
2022-02-21 19:54:34 +01:00
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
393696fa4a chore: Drop dead code
* Don't create task-logs folder during site creation
* Remove old unused async code for tracking tasks
2021-05-06 19:24:12 +05:30
Sagar Vora
c1911a0858 refactor: remove unused parameter, minor cleanup 2021-02-16 14:16:30 +05:30
Walstan Baptista
06f69accca
refactor: Removed unused parameter (#12400) 2021-02-16 12:03:59 +05:30
Aditya Hase
f3b959b1fe frappe: refactor async to realtime (#6015)
* frappe: refactor async to realtime

* frappe: refactor async to is_async
2018-08-28 15:31:20 +05:30
Renamed from frappe/async.py (Browse further)