├── .editorconfig ├── .eslintrc ├── .flake8 ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .pre-commit-config.yaml ├── .semgrepignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── comment.png ├── frappe_comment_xt ├── __init__.py ├── config │ └── __init__.py ├── fixtures │ └── custom_field.json ├── frappe_comment_xt │ └── __init__.py ├── helpers │ └── comment.py ├── hooks.py ├── modules.txt ├── overrides │ ├── notification_log_override.py │ └── whitelist │ │ └── comment.py ├── patches.txt ├── public │ ├── .gitkeep │ ├── css │ │ ├── frappe_comment_xt.css │ │ └── replies.css │ └── js │ │ ├── controls │ │ ├── comment.js │ │ ├── replies.js │ │ └── timeline.js │ │ ├── footer.bundle.js │ │ └── frappe_comment_xt.js └── templates │ ├── __init__.py │ └── pages │ └── __init__.py └── pyproject.toml /.editorconfig: -------------------------------------------------------------------------------- 1 | # Root editor config file 2 | root = true 3 | 4 | # Common settings 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | charset = utf-8 10 | 11 | # pythonindentation settings 12 | [{*.py}] 13 | indent_style = space 14 | indent_size = 4 15 | max_line_length = 120 16 | 17 | [{*.js,*.vue,*.css,*.scss,*.html}] 18 | indent_style = space 19 | indent_size = 2 20 | max_line_length = 120 21 | 22 | # JSON files - mostly doctype schema files 23 | [{*.json}] 24 | insert_final_newline = false 25 | indent_style = space 26 | indent_size = 1 27 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": "latest", 4 | "sourceType": "module" 5 | }, 6 | 7 | "env": { 8 | "es6": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = 3 | "B017", # assertRaises(Exception) - should be more specific 4 | "B018", # useless expression, not assigned to anything 5 | "B023", # function doesn't bind loop variable - will have last iteration's value 6 | "B904", # raise inside except without from 7 | "E402", # module level import not at top of file 8 | "E501", # line too long 9 | "E741", # ambiguous variable name 10 | "F403", # can't detect undefined names from * import 11 | "F405", # can't detect undefined names from * import 12 | "F722", # syntax error in forward type annotation 13 | "W191", # indentation contains tabs 14 | "RUF001", # string contains ambiguous unicode character 15 | "UP032", # Use f-string instead of `format` call (translations) 16 | "UP030", 17 | 18 | max-line-length = 120 19 | exclude=,test_*.py 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | # 🐛 Bug Report 11 | 12 | ## **Description** 13 | [Provide a clear and concise description of the bug.] 14 | 15 | ## **Steps to Reproduce** 16 | 1. Go to [specific page]. 17 | 2. Click on [specific action]. 18 | 3. Observe [unexpected behavior]. 19 | 20 | ## **Expected Behavior** 21 | [Describe what you expected to happen.] 22 | 23 | ## **Actual Behavior** 24 | [Describe what actually happened.] 25 | 26 | ## **Screenshots/Screencasts** 27 | [Attach screenshots or screencasts, if applicable.] 28 | 29 | ## **Environment** 30 | - OS: [e.g., Windows 10, macOS 13] 31 | - Browser: [e.g., Chrome 109, Firefox 90] 32 | 33 | ## **Additional Context** 34 | [Add any other context about the problem here.] 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest a new idea or feature for ERP 4 | labels: Feature-Request 5 | --- 6 | 7 | # 🚀 Feature Request 8 | 9 | ## **Description** 10 | [Provide a clear and concise description of the feature you would like to request.] 11 | 12 | ## **Motivation** 13 | [Explain why this feature is important and what problem it solves.] 14 | 15 | ## **Mockups or References** 16 | [Include screenshots, diagrams, or links to similar features, if applicable.] 17 | 18 | ## **Acceptance Criteria:** 19 | [Define acceptance criteria with specific conditions and requirements that must be met to complete this request.] 20 | - [ ] [Condition 1] 21 | - [ ] [Condition 2] 22 | - [ ] [Condition 3] 23 | 24 | ## **Additional Context** 25 | [Add any other context, links, or references that would help explain this feature request.] 26 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | 5 | ## Relevant Technical Choices 6 | 7 | 8 | 9 | ## Testing Instructions 10 | 11 | 12 | 13 | ## Additional Information: 14 | 15 | 16 | 17 | ## Screenshot/Screencast 18 | 19 | 20 | 21 | 22 | ## Checklist 23 | 24 | 25 | 26 | - [ ] I have carefully reviewed the code before submitting it for review. 27 | - [ ] This code is adequately covered by unit tests to validate its functionality. 28 | - [ ] I have conducted thorough testing to ensure it functions as intended. 29 | - [ ] A member of the QA team has reviewed and tested this PR (To be checked by QA or code reviewer) 30 | 31 | 38 | 39 | Fixes # 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | *.egg-info 4 | *.swp 5 | tags 6 | node_modules 7 | __pycache__ 8 | dist/ 9 | .frappe-semgrep -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | exclude: 'node_modules|.git' 2 | default_stages: [pre-commit] 3 | fail_fast: false 4 | 5 | repos: 6 | - repo: https://github.com/pre-commit/pre-commit-hooks 7 | rev: v4.3.0 8 | hooks: 9 | - id: trailing-whitespace 10 | files: "frappe_comment_xt.*" 11 | exclude: ".*json$|.*txt$|.*csv|.*md|.*svg" 12 | - id: check-yaml 13 | - id: check-merge-conflict 14 | - id: check-ast 15 | - id: check-json 16 | - id: check-toml 17 | - id: check-yaml 18 | - id: debug-statements 19 | 20 | - repo: https://github.com/astral-sh/ruff-pre-commit 21 | rev: v0.2.0 22 | hooks: 23 | - id: ruff 24 | name: "Run ruff import sorter" 25 | args: ["--select=I", "--fix"] 26 | 27 | - id: ruff 28 | name: "Run ruff linter" 29 | 30 | - id: ruff-format 31 | name: "Run ruff formatter" 32 | 33 | - repo: local 34 | hooks: 35 | - id: clone-local-repo 36 | name: clone-local-repo 37 | entry: bash -c 'TARGET_DIR=".frappe-semgrep" && [ ! -d "$TARGET_DIR" ] && git clone "https://github.com/frappe/semgrep-rules" "$TARGET_DIR" || true' 38 | language: system 39 | always_run: true 40 | 41 | - repo: https://github.com/semgrep/pre-commit 42 | rev: 'v1.91.0' 43 | hooks: 44 | - id: semgrep-ci 45 | args: ['--config', './.frappe-semgrep/rules', '--config','r/python.lang.correctness','--error', '--skip-unknown-extensions', '--metrics','off'] 46 | 47 | - repo: https://github.com/pre-commit/mirrors-prettier 48 | rev: v2.7.1 49 | hooks: 50 | - id: prettier 51 | types_or: [javascript, vue, scss] 52 | # Ignore any files that might contain jinja / bundles 53 | exclude: | 54 | (?x)^( 55 | frappe_comment_xt/public/dist/.*| 56 | .*node_modules.*| 57 | .*boilerplate.*| 58 | frappe_comment_xt/templates/includes/.*| 59 | frappe_comment_xt/public/js/lib/.* 60 | )$ 61 | 62 | 63 | - repo: https://github.com/pre-commit/mirrors-eslint 64 | rev: v8.44.0 65 | hooks: 66 | - id: eslint 67 | types_or: [javascript] 68 | args: ['--quiet'] 69 | # Ignore any files that might contain jinja / bundles 70 | exclude: | 71 | (?x)^( 72 | frappe_comment_xt/public/dist/.*| 73 | cypress/.*| 74 | .*node_modules.*| 75 | .*boilerplate.*| 76 | frappe_comment_xt/templates/includes/.*| 77 | frappe_comment_xt/public/js/lib/.* 78 | )$ 79 | 80 | ci: 81 | autoupdate_schedule: weekly 82 | skip: [] 83 | submodules: false 84 | -------------------------------------------------------------------------------- /.semgrepignore: -------------------------------------------------------------------------------- 1 | # Common large paths 2 | node_modules/ 3 | build/ 4 | dist/ 5 | vendor/ 6 | .env/ 7 | .venv/ 8 | .tox/ 9 | *.min.js 10 | .npm/ 11 | .yarn/ 12 | 13 | # Common test paths 14 | test/ 15 | tests/ 16 | testsuite/ 17 | *_test.go 18 | test*.py 19 | 20 | # Semgrep rules folder 21 | .frappe-semgrep 22 | 23 | # Semgrep-action log folder 24 | .semgrep_logs/ 25 | 26 | # Github Actions 27 | .github/ 28 | 29 | # Markdown files 30 | *.md 31 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contribution Guide 2 | 3 | 1. Create a new Frappe site with [Frappe Manager](https://github.com/rtCamp/frappe-manager). 4 | 5 | 2. Install the app on the site. 6 | 7 | ```bash 8 | bench get-app https://github.com/rtCamp/frappe-comment-xt 9 | bench --site [site-name] install-app frappe_comment_xt 10 | ``` 11 | 12 | 2. Set up [pre-commit](https://pre-commit.com/) in the app. 13 | 14 | ```bash 15 | pre-commit install 16 | ``` 17 | 18 | 3. Push the code to the given branch. 19 | 20 | ```bash 21 | git pull origin main # Make sure to pull the latest changes before making the PR 22 | 23 | git checkout -b "new/branch" 24 | git add --all 25 | git commit -m ".." 26 | git push origin "new/branch" 27 | ``` 28 | 29 | For branch names and commit messages, follow the guidelines at: https://www.conventionalcommits.org/en/v1.0.0/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | Frappe Slack Connector - A Frappe App to connect with Slack 633 | Copyright (C) 2024 rtCamp Solutions Pvt. Ltd. 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | Logo 5 |

Frappe Comment xt

6 |
7 | 8 | Frappe app that allows controlling comment visibility for tagged user and support multiple level replies. Helpful to add private comments in a discussion on any doc’s single view. 9 |
10 | Frappe Comment Xt Featured image 11 | Multiple threaded replies 12 |
13 |
14 | 15 | Select visibility for comments from: 16 | 1. Public - Visible to everyone. 17 | 2. Mentioned - Visible to mentioned users and user-groups. 18 | 3. Private - Visible to only the comment owner. 19 | 20 | ## Installation 21 | 22 | 1. Get the app 23 | 24 | ```bash 25 | bench get-app https://github.com/rtCamp/frappe-comment-xt.git 26 | ``` 27 | 28 | 2. Install the app on your site 29 | 30 | ```bash 31 | bench --site [site-name] install-app frappe_comment_xt 32 | ``` 33 | ## Planned Features 34 | 35 | - Emoji reactions to comments 36 | 37 | ## Contribution Guide 38 | 39 | Please read [CONTRIBUTING.md](./CONTRIBUTING.md) for details. 40 | 41 | ## License 42 | 43 | This project is licensed under the [AGPLv3 License](./LICENSE). 44 | -------------------------------------------------------------------------------- /comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rtCamp/frappe-comment-xt/faf39c5345b74bdcb720fc227cc1b4ec480f6537/comment.png -------------------------------------------------------------------------------- /frappe_comment_xt/__init__.py: -------------------------------------------------------------------------------- 1 | # flake8: noqa 2 | 3 | __version__ = "0.0.1" 4 | 5 | 6 | def patch_add_comments_in_timeline(): 7 | import frappe.desk.form.load as frappe_load 8 | 9 | from frappe_comment_xt.helpers.comment import add_comments_in_timeline 10 | 11 | # A monkey patch was written for this function as it is used in many places within Frappe. Care was taken to avoid breaking existing code. 12 | 13 | frappe_load.add_comments = add_comments_in_timeline 14 | 15 | 16 | try: 17 | patch_add_comments_in_timeline() 18 | except Exception: 19 | pass 20 | -------------------------------------------------------------------------------- /frappe_comment_xt/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rtCamp/frappe-comment-xt/faf39c5345b74bdcb720fc227cc1b4ec480f6537/frappe_comment_xt/config/__init__.py -------------------------------------------------------------------------------- /frappe_comment_xt/fixtures/custom_field.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "allow_in_quick_entry": 0, 4 | "allow_on_submit": 0, 5 | "bold": 0, 6 | "collapsible": 0, 7 | "collapsible_depends_on": null, 8 | "columns": 0, 9 | "default": null, 10 | "depends_on": null, 11 | "description": null, 12 | "docstatus": 0, 13 | "doctype": "Custom Field", 14 | "dt": "Comment", 15 | "fetch_from": null, 16 | "fetch_if_empty": 0, 17 | "fieldname": "custom_section_break_kr3ge", 18 | "fieldtype": "Section Break", 19 | "hidden": 0, 20 | "hide_border": 0, 21 | "hide_days": 0, 22 | "hide_seconds": 0, 23 | "ignore_user_permissions": 0, 24 | "ignore_xss_filter": 0, 25 | "in_global_search": 0, 26 | "in_list_view": 0, 27 | "in_preview": 0, 28 | "in_standard_filter": 0, 29 | "insert_after": "ip_address", 30 | "is_system_generated": 0, 31 | "is_virtual": 0, 32 | "label": null, 33 | "length": 0, 34 | "link_filters": null, 35 | "mandatory_depends_on": null, 36 | "modified": "2024-01-31 17:51:19.290367", 37 | "module": null, 38 | "name": "Comment-custom_section_break_kr3ge", 39 | "no_copy": 0, 40 | "non_negative": 0, 41 | "options": null, 42 | "permlevel": 0, 43 | "precision": "", 44 | "print_hide": 0, 45 | "print_hide_if_no_value": 0, 46 | "print_width": null, 47 | "read_only": 0, 48 | "read_only_depends_on": null, 49 | "report_hide": 0, 50 | "reqd": 0, 51 | "search_index": 0, 52 | "show_dashboard": 0, 53 | "sort_options": 0, 54 | "translatable": 0, 55 | "unique": 0, 56 | "width": null 57 | }, 58 | { 59 | "allow_in_quick_entry": 0, 60 | "allow_on_submit": 0, 61 | "bold": 0, 62 | "collapsible": 0, 63 | "collapsible_depends_on": null, 64 | "columns": 0, 65 | "default": "Visible to everyone", 66 | "depends_on": null, 67 | "description": null, 68 | "docstatus": 0, 69 | "doctype": "Custom Field", 70 | "dt": "Comment", 71 | "fetch_from": null, 72 | "fetch_if_empty": 0, 73 | "fieldname": "custom_visibility", 74 | "fieldtype": "Select", 75 | "hidden": 0, 76 | "hide_border": 0, 77 | "hide_days": 0, 78 | "hide_seconds": 0, 79 | "ignore_user_permissions": 0, 80 | "ignore_xss_filter": 0, 81 | "in_global_search": 0, 82 | "in_list_view": 1, 83 | "in_preview": 0, 84 | "in_standard_filter": 0, 85 | "insert_after": "custom_section_break_kr3ge", 86 | "is_system_generated": 0, 87 | "is_virtual": 0, 88 | "label": "Visibility", 89 | "length": 0, 90 | "link_filters": null, 91 | "mandatory_depends_on": null, 92 | "modified": "2024-02-01 11:48:45.276461", 93 | "module": null, 94 | "name": "Comment-custom_visibility", 95 | "no_copy": 0, 96 | "non_negative": 0, 97 | "options": "Visible to everyone\nVisible to only you\nVisible to mentioned", 98 | "permlevel": 0, 99 | "precision": "", 100 | "print_hide": 0, 101 | "print_hide_if_no_value": 0, 102 | "print_width": null, 103 | "read_only": 0, 104 | "read_only_depends_on": null, 105 | "report_hide": 0, 106 | "reqd": 0, 107 | "search_index": 0, 108 | "show_dashboard": 0, 109 | "sort_options": 0, 110 | "translatable": 0, 111 | "unique": 0, 112 | "width": null 113 | }, 114 | { 115 | "allow_in_quick_entry": 0, 116 | "allow_on_submit": 0, 117 | "bold": 0, 118 | "collapsible": 0, 119 | "collapsible_depends_on": null, 120 | "columns": 0, 121 | "default": null, 122 | "depends_on": null, 123 | "description": null, 124 | "docstatus": 0, 125 | "doctype": "Custom Field", 126 | "dt": "Comment", 127 | "fetch_from": null, 128 | "fetch_if_empty": 0, 129 | "fieldname": "custom_mentions", 130 | "fieldtype": "Table MultiSelect", 131 | "hidden": 0, 132 | "hide_border": 0, 133 | "hide_days": 0, 134 | "hide_seconds": 0, 135 | "ignore_user_permissions": 0, 136 | "ignore_xss_filter": 0, 137 | "in_global_search": 0, 138 | "in_list_view": 0, 139 | "in_preview": 0, 140 | "in_standard_filter": 0, 141 | "insert_after": "custom_visibility", 142 | "is_system_generated": 0, 143 | "is_virtual": 0, 144 | "label": "Mentions", 145 | "length": 0, 146 | "link_filters": null, 147 | "mandatory_depends_on": null, 148 | "modified": "2024-01-31 17:51:19.398728", 149 | "module": null, 150 | "name": "Comment-custom_mentions", 151 | "no_copy": 0, 152 | "non_negative": 0, 153 | "options": "User Group Member", 154 | "permlevel": 0, 155 | "precision": "", 156 | "print_hide": 0, 157 | "print_hide_if_no_value": 0, 158 | "print_width": null, 159 | "read_only": 0, 160 | "read_only_depends_on": null, 161 | "report_hide": 0, 162 | "reqd": 0, 163 | "search_index": 0, 164 | "show_dashboard": 0, 165 | "sort_options": 0, 166 | "translatable": 0, 167 | "unique": 0, 168 | "width": null 169 | }, 170 | { 171 | "allow_in_quick_entry": 0, 172 | "allow_on_submit": 0, 173 | "bold": 0, 174 | "collapsible": 0, 175 | "collapsible_depends_on": null, 176 | "columns": 0, 177 | "default": null, 178 | "depends_on": null, 179 | "description": null, 180 | "docstatus": 0, 181 | "doctype": "Custom Field", 182 | "dt": "Comment", 183 | "fetch_from": null, 184 | "fetch_if_empty": 0, 185 | "fieldname": "custom_reply_to", 186 | "fieldtype": "Link", 187 | "hidden": 0, 188 | "hide_border": 0, 189 | "hide_days": 0, 190 | "hide_seconds": 0, 191 | "ignore_user_permissions": 0, 192 | "ignore_xss_filter": 0, 193 | "in_global_search": 0, 194 | "in_list_view": 0, 195 | "in_preview": 0, 196 | "in_standard_filter": 0, 197 | "insert_after": "custom_mentions", 198 | "is_system_generated": 0, 199 | "is_virtual": 0, 200 | "label": "Reply To", 201 | "length": 0, 202 | "link_filters": null, 203 | "mandatory_depends_on": null, 204 | "modified": "2024-12-23 14:04:51.913318", 205 | "module": null, 206 | "name": "Comment-custom_reply_to", 207 | "no_copy": 0, 208 | "non_negative": 0, 209 | "options": "Comment", 210 | "permlevel": 0, 211 | "precision": "", 212 | "print_hide": 0, 213 | "print_hide_if_no_value": 0, 214 | "print_width": null, 215 | "read_only": 1, 216 | "read_only_depends_on": null, 217 | "report_hide": 0, 218 | "reqd": 0, 219 | "search_index": 0, 220 | "show_dashboard": 0, 221 | "sort_options": 0, 222 | "translatable": 0, 223 | "unique": 0, 224 | "width": null 225 | } 226 | ] -------------------------------------------------------------------------------- /frappe_comment_xt/frappe_comment_xt/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rtCamp/frappe-comment-xt/faf39c5345b74bdcb720fc227cc1b4ec480f6537/frappe_comment_xt/frappe_comment_xt/__init__.py -------------------------------------------------------------------------------- /frappe_comment_xt/helpers/comment.py: -------------------------------------------------------------------------------- 1 | import frappe 2 | from frappe.desk.notifications import extract_mentions 3 | 4 | 5 | def get_mention_user(content): 6 | if not content: 7 | return [] 8 | 9 | users = extract_mentions(content) 10 | mention_users = [] 11 | 12 | for user in users: 13 | mention_users.append({"user": user}) 14 | 15 | return mention_users 16 | 17 | 18 | def add_comments_in_timeline(doc, docinfo): 19 | # divide comments into separate lists 20 | docinfo.comments = [] 21 | docinfo.shared = [] 22 | docinfo.assignment_logs = [] 23 | docinfo.attachment_logs = [] 24 | docinfo.info_logs = [] 25 | docinfo.like_logs = [] 26 | docinfo.workflow_logs = [] 27 | 28 | # Get only parent comments 29 | comments = frappe.get_all( 30 | "Comment", 31 | fields="*", 32 | filters={ 33 | "reference_doctype": doc.doctype, 34 | "reference_name": doc.name, 35 | "custom_reply_to": "", 36 | }, 37 | ) 38 | 39 | filtered_comments = filter_comments_by_visibility(comments, frappe.session.user) 40 | 41 | for c in filtered_comments: 42 | match c.comment_type: 43 | case "Comment": 44 | c.content = frappe.utils.markdown(c.content) 45 | docinfo.comments.append(c) 46 | case "Shared" | "Unshared": 47 | docinfo.shared.append(c) 48 | case "Assignment Completed" | "Assigned": 49 | docinfo.assignment_logs.append(c) 50 | case "Attachment" | "Attachment Removed": 51 | docinfo.attachment_logs.append(c) 52 | case "Info" | "Edit" | "Label": 53 | docinfo.info_logs.append(c) 54 | case "Like": 55 | docinfo.like_logs.append(c) 56 | case "Workflow": 57 | docinfo.workflow_logs.append(c) 58 | 59 | return comments 60 | 61 | 62 | def filter_comments_by_visibility(comments, user): 63 | """ 64 | Filter comments based on the visibility settings 65 | Only show comments that the user is allowed to see 66 | """ 67 | filtered_comments = [] 68 | 69 | if user != "Administrator": 70 | for comment in comments: 71 | if comment.custom_visibility == "Visible to only you": 72 | if comment.owner == user: 73 | filtered_comments.append(comment) 74 | 75 | elif comment.custom_visibility == "Visible to mentioned": 76 | member = frappe.db.get_all( 77 | "User Group Member", 78 | filters={ 79 | "user": user, 80 | "parent": comment.name, 81 | "parenttype": "Comment", 82 | }, 83 | ) 84 | 85 | if comment.owner == user or (len(member) > 0): 86 | filtered_comments.append(comment) 87 | 88 | else: 89 | filtered_comments.append(comment) 90 | else: 91 | filtered_comments = comments 92 | return filtered_comments 93 | 94 | 95 | def get_thread_participants(comment_id: str) -> set: 96 | """ 97 | Get the participants in a comment thread 98 | Returns a union of: 99 | - The original commenter 100 | - The mentioned users 101 | - The commenters in the thread 102 | """ 103 | # Get all comments in the thread 104 | original_comment = frappe.get_doc("Comment", comment_id) 105 | thread_comments = frappe.get_all( 106 | "Comment", 107 | filters={ 108 | "custom_reply_to": comment_id, 109 | }, 110 | fields=["comment_email", "custom_mentions.user"], 111 | ) 112 | 113 | mention_users = set() 114 | mention_users.add(original_comment.comment_email) 115 | for comment in thread_comments: 116 | mention_users.add(comment["comment_email"]) 117 | mention_users.add(comment["user"]) 118 | mention_users.update(mention.user for mention in original_comment.custom_mentions) 119 | mention_users.discard(None) 120 | 121 | return mention_users 122 | -------------------------------------------------------------------------------- /frappe_comment_xt/hooks.py: -------------------------------------------------------------------------------- 1 | app_name = "frappe_comment_xt" 2 | app_title = "Frappe Comment Xt" 3 | app_publisher = "rtCamp" 4 | app_description = "Enhancing the default comments function in Frappe" 5 | app_email = "frappe@rtcamp.com" 6 | app_license = "GNU AFFERO GENERAL PUBLIC LICENSE (v3)" 7 | 8 | # required_apps = [] 9 | 10 | # Includes in 11 | # ------------------ 12 | 13 | # include js, css files in header of desk.html 14 | app_include_css = [ 15 | "/assets/frappe_comment_xt/css/frappe_comment_xt.css", 16 | "/assets/frappe_comment_xt/css/replies.css", 17 | ] 18 | app_include_js = [ 19 | "/assets/frappe_comment_xt/js/frappe_comment_xt.js", 20 | "footer.bundle.js", 21 | ] 22 | 23 | # include js, css files in header of web template 24 | # web_include_css = "/assets/frappe_comment_xt/css/frappe_comment_xt.css" 25 | # web_include_js = "/assets/frappe_comment_xt/js/frappe_comment_xt.js" 26 | 27 | # include custom scss in every website theme (without file extension ".scss") 28 | # website_theme_scss = "frappe_comment_xt/public/scss/website" 29 | 30 | # include js, css files in header of web form 31 | # webform_include_js = {"doctype": "public/js/doctype.js"} 32 | # webform_include_css = {"doctype": "public/css/doctype.css"} 33 | 34 | # include js in page 35 | # page_js = {"page" : "public/js/file.js"} 36 | 37 | # include js in doctype views 38 | # doctype_js = {"doctype" : "public/js/doctype.js"} 39 | # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} 40 | # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} 41 | # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} 42 | 43 | # Svg Icons 44 | # ------------------ 45 | # include app icons in desk 46 | # app_include_icons = "frappe_comment_xt/public/icons.svg" 47 | 48 | # Home Pages 49 | # ---------- 50 | 51 | # application home page (will override Website Settings) 52 | # home_page = "login" 53 | 54 | # website user home page (by Role) 55 | # role_home_page = { 56 | # "Role": "home_page" 57 | # } 58 | 59 | # Generators 60 | # ---------- 61 | 62 | # automatically create page for each record of this doctype 63 | # website_generators = ["Web Page"] 64 | 65 | # Jinja 66 | # ---------- 67 | 68 | # add methods and filters to jinja environment 69 | # jinja = { 70 | # "methods": "frappe_comment_xt.utils.jinja_methods", 71 | # "filters": "frappe_comment_xt.utils.jinja_filters" 72 | # } 73 | 74 | # Installation 75 | # ------------ 76 | 77 | # before_install = "frappe_comment_xt.install.before_install" 78 | # after_install = "frappe_comment_xt.install.after_install" 79 | 80 | # Uninstallation 81 | # ------------ 82 | 83 | # before_uninstall = "frappe_comment_xt.uninstall.before_uninstall" 84 | # after_uninstall = "frappe_comment_xt.uninstall.after_uninstall" 85 | 86 | # Integration Setup 87 | # ------------------ 88 | # To set up dependencies/integrations with other apps 89 | # Name of the app being installed is passed as an argument 90 | 91 | # before_app_install = "frappe_comment_xt.utils.before_app_install" 92 | # after_app_install = "frappe_comment_xt.utils.after_app_install" 93 | 94 | # Integration Cleanup 95 | # ------------------- 96 | # To clean up dependencies/integrations with other apps 97 | # Name of the app being uninstalled is passed as an argument 98 | 99 | # before_app_uninstall = "frappe_comment_xt.utils.before_app_uninstall" 100 | # after_app_uninstall = "frappe_comment_xt.utils.after_app_uninstall" 101 | 102 | # Desk Notifications 103 | # ------------------ 104 | # See frappe.core.notifications.get_notification_config 105 | 106 | # notification_config = "frappe_comment_xt.notifications.get_notification_config" 107 | 108 | # Permissions 109 | # ----------- 110 | # Permissions evaluated in scripted ways 111 | 112 | # permission_query_conditions = { 113 | # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", 114 | # } 115 | # 116 | # has_permission = { 117 | # "Event": "frappe.desk.doctype.event.event.has_permission", 118 | # } 119 | 120 | # DocType Class 121 | # --------------- 122 | # Override standard doctype classes 123 | 124 | override_doctype_class = { 125 | "Notification Log": "frappe_comment_xt.overrides.notification_log_override.NotificationLogOverride" 126 | } 127 | 128 | # Document Events 129 | # --------------- 130 | # Hook on document methods and events 131 | 132 | # doc_events = { 133 | # "*": { 134 | # "on_update": "method", 135 | # "on_cancel": "method", 136 | # "on_trash": "method" 137 | # } 138 | # } 139 | 140 | # Scheduled Tasks 141 | # --------------- 142 | 143 | # scheduler_events = { 144 | # "all": [ 145 | # "frappe_comment_xt.tasks.all" 146 | # ], 147 | # "daily": [ 148 | # "frappe_comment_xt.tasks.daily" 149 | # ], 150 | # "hourly": [ 151 | # "frappe_comment_xt.tasks.hourly" 152 | # ], 153 | # "weekly": [ 154 | # "frappe_comment_xt.tasks.weekly" 155 | # ], 156 | # "monthly": [ 157 | # "frappe_comment_xt.tasks.monthly" 158 | # ], 159 | # } 160 | 161 | # Fixtures 162 | # ---------- 163 | fixtures = [ 164 | { 165 | "dt": "Custom Field", 166 | "filters": [ 167 | [ 168 | "dt", 169 | "in", 170 | ["Comment"], 171 | ] 172 | ], 173 | }, 174 | ] 175 | 176 | # Testing 177 | # ------- 178 | 179 | # before_tests = "frappe_comment_xt.install.before_tests" 180 | 181 | # Overriding Methods 182 | # ------------------------------ 183 | # 184 | override_whitelisted_methods = { 185 | "frappe.desk.form.utils.add_comment": "frappe_comment_xt.overrides.whitelist.comment.add_comment_override", 186 | "frappe.desk.form.utils.update_comment": "frappe_comment_xt.overrides.whitelist.comment.update_comment_override", 187 | } 188 | # 189 | # each overriding function accepts a `data` argument; 190 | # generated from the base implementation of the doctype dashboard, 191 | # along with any modifications made in other Frappe apps 192 | # override_doctype_dashboards = { 193 | # } 194 | 195 | # exempt linked doctypes from being automatically cancelled 196 | # 197 | # auto_cancel_exempted_doctypes = ["Auto Repeat"] 198 | 199 | # Ignore links to specified DocTypes when deleting documents 200 | # ----------------------------------------------------------- 201 | 202 | # ignore_links_on_delete = ["Communication", "ToDo"] 203 | 204 | # Request Events 205 | # ---------------- 206 | # before_request = ["frappe_comment_xt.utils.before_request"] 207 | # after_request = ["frappe_comment_xt.utils.after_request"] 208 | 209 | # Job Events 210 | # ---------- 211 | # before_job = ["frappe_comment_xt.utils.before_job"] 212 | # after_job = ["frappe_comment_xt.utils.after_job"] 213 | 214 | # User Data Protection 215 | # -------------------- 216 | 217 | # user_data_fields = [ 218 | # { 219 | # "doctype": "{doctype_1}", 220 | # "filter_by": "{filter_by}", 221 | # "redact_fields": ["{field_1}", "{field_2}"], 222 | # "partial": 1, 223 | # }, 224 | # { 225 | # "doctype": "{doctype_2}", 226 | # "filter_by": "{filter_by}", 227 | # "partial": 1, 228 | # }, 229 | # { 230 | # "doctype": "{doctype_3}", 231 | # "strict": False, 232 | # }, 233 | # { 234 | # "doctype": "{doctype_4}" 235 | # } 236 | # ] 237 | 238 | # Authentication and authorization 239 | # -------------------------------- 240 | 241 | # auth_hooks = [ 242 | # "frappe_comment_xt.auth.validate" 243 | # ] 244 | 245 | # Automatically update python controller files with type annotations for this app. 246 | # export_python_type_annotations = True 247 | 248 | # default_log_clearing_doctypes = { 249 | # "Logging DocType Name": 30 # days to retain logs 250 | # } 251 | -------------------------------------------------------------------------------- /frappe_comment_xt/modules.txt: -------------------------------------------------------------------------------- 1 | Frappe Comment Xt -------------------------------------------------------------------------------- /frappe_comment_xt/overrides/notification_log_override.py: -------------------------------------------------------------------------------- 1 | import frappe 2 | from frappe.desk.doctype.notification_log.notification_log import NotificationLog 3 | from frappe.utils.data import get_url_to_form 4 | 5 | 6 | class NotificationLogOverride(NotificationLog): 7 | def after_insert(self): 8 | if self.type == "Mention": 9 | self.update_comment_link() 10 | self.save() 11 | super().after_insert() 12 | 13 | def update_comment_link(self): 14 | """ 15 | There is no direct link between the comment and the notification log. 16 | We determine the comment id by using the content of the email and the most recently created comment, as the comment is created before the notification log. 17 | """ 18 | comments = frappe.get_all( 19 | "Comment", 20 | filters={ 21 | "reference_doctype": self.document_type, 22 | "reference_name": self.document_name, 23 | }, 24 | fields=["name", "content"], 25 | order_by="creation desc", 26 | limit_page_length=5, 27 | ) 28 | 29 | comment_name = None 30 | 31 | for comment in comments: 32 | if comment.content in self.email_content: 33 | comment_name = comment.name 34 | break 35 | 36 | if comment_name: 37 | self.link = get_url_to_form(self.document_type, self.document_name) + f"#comment-{comment_name}" 38 | self.save() 39 | -------------------------------------------------------------------------------- /frappe_comment_xt/overrides/whitelist/comment.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING 2 | 3 | import frappe 4 | from frappe.core.doctype.file.utils import extract_images_from_html 5 | from frappe.desk.doctype.notification_log.notification_log import enqueue_create_notification 6 | from frappe.desk.form.document_follow import follow_document 7 | from frappe.utils import strip_html_tags 8 | from frappe.utils.html_utils import clean_email_html 9 | 10 | from frappe_comment_xt.helpers.comment import filter_comments_by_visibility, get_mention_user, get_thread_participants 11 | 12 | if TYPE_CHECKING: 13 | from frappe.core.doctype.comment.comment import Comment 14 | 15 | 16 | @frappe.whitelist(methods=["POST", "PUT"]) 17 | def add_comment_override( 18 | reference_doctype: str, 19 | reference_name: str, 20 | content: str, 21 | comment_email: str, 22 | comment_by: str, 23 | custom_visibility: str = "Visible to everyone", 24 | custom_reply_to: str | None = None, 25 | ) -> "Comment": 26 | """Allow logged user with permission to read document to add a comment""" 27 | reference_doc = frappe.get_doc(reference_doctype, reference_name) 28 | reference_doc.check_permission() 29 | 30 | comment = frappe.new_doc("Comment") 31 | mentions = get_mention_user(content) 32 | comment_content = extract_images_from_html(reference_doc, content, is_private=True) 33 | comment.update( 34 | { 35 | "comment_type": "Comment", 36 | "reference_doctype": reference_doctype, 37 | "reference_name": reference_name, 38 | "comment_email": comment_email, 39 | "comment_by": comment_by, 40 | "content": comment_content, 41 | "custom_visibility": custom_visibility, 42 | "custom_mentions": mentions, 43 | "custom_reply_to": custom_reply_to, 44 | } 45 | ) 46 | comment.insert(ignore_permissions=True) 47 | 48 | if frappe.get_cached_value("User", frappe.session.user, "follow_commented_documents"): 49 | follow_document(comment.reference_doctype, comment.reference_name, frappe.session.user) 50 | 51 | try: 52 | # Notify thread participants if the comment is visible to everyone 53 | # and the comment is a reply to another comment 54 | # For 'visible to mentioned' comments, the notification is sent to mentioned by default 55 | if custom_reply_to and custom_visibility == "Visible to everyone": 56 | participants = get_thread_participants(custom_reply_to) 57 | if participants: 58 | notification_doc = { 59 | "type": "Mention", 60 | "document_type": reference_doctype, 61 | "document_name": reference_name, 62 | "subject": f"{frappe.bold(comment_by)} replied in thread: {strip_html_tags(clean_email_html(comment_content))}", 63 | "from_user": frappe.session.user, 64 | "email_content": content, 65 | } 66 | 67 | for mention in mentions: 68 | participants.discard(mention["user"]) 69 | # Remove the current user from notification recipients 70 | participants.discard(frappe.session.user) 71 | enqueue_create_notification(list(participants), notification_doc) 72 | except Exception as e: 73 | frappe.log_error( 74 | "Error sending Comment Thread notification", 75 | frappe.get_traceback() + f"\n\nNotification Error: {e}", 76 | ) 77 | 78 | return comment 79 | 80 | 81 | @frappe.whitelist() 82 | def update_comment_override(name: str, content: str, custom_visibility: str = ""): 83 | """allow only owner to update comment""" 84 | 85 | # We are overriding the default Frappe update call because there's no way to store this information with a JavaScript override. 86 | 87 | if not custom_visibility: 88 | return None 89 | 90 | doc = frappe.get_doc("Comment", name) 91 | 92 | if frappe.session.user not in ["Administrator", doc.owner]: 93 | frappe.throw(frappe._("Comment can only be edited by the owner"), frappe.PermissionError) 94 | 95 | if doc.reference_doctype and doc.reference_name: 96 | reference_doc = frappe.get_doc(doc.reference_doctype, doc.reference_name) 97 | reference_doc.check_permission() 98 | 99 | doc.content = extract_images_from_html(reference_doc, content, is_private=True) 100 | else: 101 | doc.content = content 102 | 103 | doc.set("custom_mentions", get_mention_user(doc.content)) 104 | doc.set("custom_visibility", custom_visibility) 105 | 106 | doc.save(ignore_permissions=True) 107 | 108 | 109 | @frappe.whitelist() 110 | def get_comment_visibility(name: str): 111 | """allow only owner to update comment""" 112 | 113 | doc = frappe.get_doc("Comment", name) 114 | 115 | if frappe.session.user not in ["Administrator", doc.owner]: 116 | return None 117 | 118 | return {"custom_visibility": doc.custom_visibility} 119 | 120 | 121 | @frappe.whitelist() 122 | def get_all_replies(reference_doctype: str, reference_name: str): 123 | """Get all replies for a comment in a structured format""" 124 | replies = frappe.get_all( 125 | "Comment", 126 | filters={ 127 | "reference_doctype": reference_doctype, 128 | "reference_name": reference_name, 129 | }, 130 | fields="*", 131 | order_by="creation DESC", 132 | ) 133 | filtered_replies = filter_comments_by_visibility(replies, frappe.session.user) 134 | 135 | # Create a dictionary to store the structured comments 136 | structured_comments = dict() 137 | 138 | for reply in filtered_replies: 139 | if reply["custom_reply_to"]: 140 | structured_comments.setdefault(reply["custom_reply_to"], []) 141 | structured_comments[reply["custom_reply_to"]].append(reply) 142 | 143 | return structured_comments 144 | -------------------------------------------------------------------------------- /frappe_comment_xt/patches.txt: -------------------------------------------------------------------------------- 1 | [pre_model_sync] 2 | # Patches added in this section will be executed before doctypes are migrated 3 | # Read docs to understand patches: https://frappeframework.com/docs/v14/user/en/database-migrations 4 | 5 | [post_model_sync] 6 | # Patches added in this section will be executed after doctypes are migrated -------------------------------------------------------------------------------- /frappe_comment_xt/public/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rtCamp/frappe-comment-xt/faf39c5345b74bdcb720fc227cc1b4ec480f6537/frappe_comment_xt/public/.gitkeep -------------------------------------------------------------------------------- /frappe_comment_xt/public/css/frappe_comment_xt.css: -------------------------------------------------------------------------------- 1 | .comment-select-group, 2 | .comment-select-group .select-input { 3 | display: flex; 4 | flex-direction: row; 5 | align-items: center; 6 | gap: 0.5rem; 7 | } 8 | .comment-select-group { 9 | width: 100%; 10 | } 11 | 12 | .comment-select-group .select-input { 13 | gap: 0; 14 | position: relative; 15 | background-color: var(--control-bg); 16 | flex: 0 0 16rem; 17 | padding: 0; 18 | } 19 | 20 | .comment-btn-container { 21 | display: flex; 22 | justify-content: space-between; 23 | margin-top: 1.2rem; 24 | align-items: center; 25 | padding-left: 4.5%; 26 | } 27 | 28 | .comment-select-group .visibility-label svg { 29 | transform: scale(0.95); 30 | } 31 | 32 | .comment-select-group .visibility-label .visible-to-all { 33 | transform: scale(1.25); 34 | margin-left: 4.5px; 35 | margin-right: 4.2px; 36 | } 37 | 38 | .visibility-info i { 39 | transform: scale(1.25); 40 | margin-left: 0.2rem; 41 | } 42 | 43 | .visibility-info svg, 44 | .visibility-info i { 45 | cursor: pointer; 46 | margin-bottom: 4px; 47 | margin-right: 0.4rem; 48 | } 49 | 50 | .comment-visibility-input { 51 | margin-bottom: 0; 52 | } 53 | 54 | .comment-btn-container > .form-inline { 55 | flex: 0 0 50%; 56 | } 57 | .comment-submit-btn { 58 | margin: 0 !important; 59 | } 60 | #visibility { 61 | background: transparent; 62 | -webkit-appearance: none; 63 | -moz-appearance: none; 64 | appearance: none; 65 | border: none !important; 66 | width: 100%; 67 | outline: none; 68 | padding: 0 0.5rem; 69 | } 70 | .visibility-info { 71 | margin-left: 0.5rem; 72 | } 73 | 74 | .timeline-comment { 75 | background: white; 76 | padding: 0.75rem 1rem; 77 | margin-bottom: 0; 78 | } 79 | 80 | .comment-select-group .select-icon { 81 | position: absolute; 82 | right: 0.5rem; 83 | } 84 | -------------------------------------------------------------------------------- /frappe_comment_xt/public/css/replies.css: -------------------------------------------------------------------------------- 1 | .reply-btn { 2 | font-size: 12px; 3 | } 4 | 5 | .threaded-reply-container { 6 | margin-left: 90px; 7 | position: relative; 8 | } 9 | 10 | .vertical-line { 11 | position: absolute; 12 | left: -30px; 13 | top: 0; 14 | bottom: 0; 15 | border-right: 1px solid #e0e5e8; 16 | } 17 | 18 | .timeline-badge { 19 | position: absolute; 20 | left: -43px; 21 | top: 10px; 22 | background-color: #F3F3F3; 23 | padding: 5px; 24 | border-radius: 999px; 25 | } 26 | 27 | .timeline-item.frappe-card { 28 | margin-top: 20px; 29 | position: relative; 30 | max-width: 700px; 31 | padding-block: 0 !important; 32 | padding-left: 0 !important; 33 | margin-left: 0px !important; 34 | border: 1px solid #ededed; 35 | margin-bottom: 0px !important; 36 | 37 | .timeline-content { 38 | padding-bottom: 0px !important; 39 | margin-left: 0px !important; 40 | } 41 | 42 | .timeline-message-box { 43 | margin-bottom: 14px !important; 44 | margin: 3.5px !important; 45 | margin-bottom: 0px !important; 46 | } 47 | 48 | .timeline-user { 49 | margin-left: 5px !important; 50 | } 51 | 52 | .avatar { 53 | margin-right: 3px; 54 | } 55 | 56 | hr { 57 | margin-top: 4px; 58 | margin-left: 38px; 59 | } 60 | 61 | .ql-editor.read-mode { 62 | padding-left: 40px; 63 | } 64 | } 65 | 66 | .reply-container { 67 | display: block; 68 | margin-top: 14px; 69 | margin-left: 40px; 70 | margin-right: 20px; 71 | } 72 | 73 | .reply-actions { 74 | margin-top: 3px; 75 | margin-bottom: 12px; 76 | display: inline-block; 77 | } 78 | 79 | .comment-actions { 80 | float: right; 81 | margin-left: auto; 82 | } 83 | 84 | .dropdown { 85 | display: inline-block; 86 | } 87 | 88 | .reply-wrapper { 89 | position: relative; 90 | } 91 | 92 | /* Smaller devicec */ 93 | 94 | @media only screen and (max-width: 600px) { 95 | .timeline-items { 96 | overflow: hidden; 97 | } 98 | 99 | .new-timeline>.timeline-items>.threaded-reply-container { 100 | overflow-x: scroll; 101 | display: flex; 102 | margin-left: 0 !important; 103 | padding-left: 90px; 104 | } 105 | 106 | .new-timeline>.timeline-items>.threaded-reply-container>.vertical-line { 107 | flex-shrink: 0; 108 | left: 60px !important; 109 | } 110 | 111 | .threaded-reply-container { 112 | position: relative; 113 | display: flex; 114 | flex-direction: column; 115 | } 116 | 117 | .vertical-line { 118 | position: relative; 119 | flex-shrink: 0; 120 | position: absolute; 121 | top: 10px; 122 | background-color: #F3F3F3; 123 | border-radius: 999px; 124 | width: 1px !important; 125 | padding: 0px !important; 126 | } 127 | 128 | 129 | .reply-wrapper { 130 | min-width: 600px; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /frappe_comment_xt/public/js/controls/comment.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line 2 | frappe.ui.form.ControlComment = class extends frappe.ui.form.ControlComment { 3 | make_wrapper() { 4 | this.comment_wrapper = !this.no_wrapper 5 | ? $(` 6 |
7 |
8 | ${__("Comments")} 9 |
10 |
11 | ${frappe.avatar(frappe.session.user, "avatar-medium")} 12 |
13 |
14 |
15 |
16 |
17 | 20 |
21 | 29 |
30 | 31 | 32 | 33 |
34 |
35 |
36 |
37 | 40 |
41 |
42 | `) 43 | : $('
'); 44 | 45 | this.comment_wrapper.appendTo(this.parent); 46 | 47 | // wrapper should point to frappe-control 48 | this.$wrapper = !this.no_wrapper ? this.comment_wrapper.find(".frappe-control") : this.comment_wrapper; 49 | 50 | this.wrapper = this.$wrapper; 51 | 52 | this.button = this.comment_wrapper.find(".btn-comment"); 53 | 54 | this.mention_wrapper = this.comment_wrapper.find(".checkbox"); 55 | 56 | this.comment_visibility = this.comment_wrapper.find("#visibility"); 57 | 58 | this.comment_visibility.on("change", () => { 59 | document.querySelector(".visibility-label").innerHTML = get_comment_visibility_icons( 60 | this.comment_visibility.prop("value") 61 | ); 62 | }); 63 | } 64 | 65 | submit() { 66 | this.on_submit && this.on_submit(this.get_value(), this.comment_visibility.prop("value")); 67 | } 68 | 69 | update_state() { 70 | const value = this.get_value(); 71 | if (strip_html(value).trim() != "" || value.includes("img")) { 72 | this.button.removeClass("disabled"); 73 | } else { 74 | this.button.addClass("disabled"); 75 | } 76 | } 77 | }; 78 | -------------------------------------------------------------------------------- /frappe_comment_xt/public/js/controls/replies.js: -------------------------------------------------------------------------------- 1 | // Maximum limit of nested threads allowed 2 | const REPLY_LEVEL_LIMIT = 7; 3 | 4 | function add_reply_button(time_line_item) { 5 | /* Add reply button to the parent comment */ 6 | if ($(time_line_item).find(".custom-actions .reply-btn").length) { 7 | return; 8 | } 9 | const replyButton = $(" 249 | 250 | 251 | `).appendTo(replyContainer); 252 | 253 | actionButtons.find(".submit-reply").on("click", () => { 254 | const replyContent = replyControl.get_value(); 255 | const visibility = visibilitySelect.find("select").val(); 256 | if (strip_html(replyContent).trim() != "" || replyContent.includes("img")) { 257 | submit_reply($timeLineItem, replyContent, visibility); 258 | } 259 | }); 260 | 261 | actionButtons.find(".cancel-reply").on("click", () => { 262 | replyContainer.remove(); 263 | }); 264 | 265 | // Scroll to the reply container and focus on the input 266 | $("html, body").animate( 267 | { 268 | scrollTop: replyContainer.offset().top - $(window).height() / 2, 269 | }, 270 | 1000 271 | ); 272 | replyContainer.find(".ql-editor.ql-blank").focus(); 273 | } 274 | 275 | function submit_reply(time_line_item, content, visibility) { 276 | /* 277 | * Submit the reply to the server and update the comments tree for the comment 278 | */ 279 | frappe.call({ 280 | method: "frappe.desk.form.utils.add_comment", 281 | args: { 282 | reference_doctype: this.cur_frm.doctype, 283 | reference_name: this.cur_frm.docname, 284 | custom_reply_to: $(time_line_item).data("name") || null, 285 | content: content, 286 | custom_visibility: visibility, 287 | comment_email: frappe.session.user, 288 | comment_by: frappe.session.user_fullname, 289 | }, 290 | callback: (r) => { 291 | if (r.message) { 292 | $(time_line_item).find(".reply-container").remove(); 293 | frappe.utils.play_sound("click"); 294 | update_comments_timeline(); 295 | addThreadedReply(time_line_item, this.cur_frm.doctype, this.cur_frm.docname); 296 | } 297 | }, 298 | }); 299 | } 300 | 301 | function handle_reply_copy(commentSelector) { 302 | /* 303 | * Copy the comment URL to the clipboard 304 | */ 305 | const $comment = $(commentSelector); 306 | const commentId = $comment.data("name"); 307 | const currentUrl = 308 | frappe.urllib.get_base_url() + frappe.utils.get_form_link(this.cur_frm.doctype, this.cur_frm.docname); 309 | const commentUrl = `${currentUrl}#comment-${commentId}`; 310 | frappe.utils.copy_to_clipboard(commentUrl); 311 | } 312 | 313 | function handle_reply_delete(commentSelector) { 314 | /* 315 | * Delete the comment 316 | */ 317 | const $comment = $(commentSelector); 318 | const commentId = $comment.data("name"); 319 | 320 | frappe.confirm(__("Are you sure you want to delete this comment?"), () => { 321 | frappe.call({ 322 | method: "frappe.client.delete", 323 | args: { 324 | doctype: "Comment", 325 | name: commentId, 326 | }, 327 | callback: (r) => { 328 | if (r.exc) { 329 | frappe.msgprint(__("There was an error deleting the comment")); 330 | } else { 331 | frappe.show_alert({ 332 | message: __("Comment deleted"), 333 | indicator: "green", 334 | }); 335 | } 336 | }, 337 | }); 338 | }); 339 | } 340 | 341 | function handle_reply_edit(parentComment, commentSelector) { 342 | /* 343 | * Edit the comment, prepare the edit mode and hide the read mode 344 | * Also handle the save and dismiss actions for the edit mode 345 | */ 346 | const replyContainer = $(commentSelector).find(".reply-container"); 347 | if (replyContainer) { 348 | replyContainer.remove(); 349 | } 350 | const $comment = $(commentSelector); 351 | const $readMode = $comment.find(".read-mode"); 352 | const $editMode = $comment.find(".edit-mode"); 353 | const commentId = $comment.data("name"); 354 | const doctype = this.cur_frm.doctype; 355 | const docname = this.cur_frm.docname; 356 | 357 | $readMode.hide(); 358 | $editMode.show().empty(); 359 | 360 | const editControl = frappe.ui.form.make_control({ 361 | parent: $editMode, 362 | df: { 363 | fieldtype: "Comment", 364 | fieldname: "edit_comment", 365 | placeholder: __("Edit your reply..."), 366 | }, 367 | render_input: true, 368 | enable_mentions: true, 369 | only_input: true, 370 | no_wrapper: true, 371 | }); 372 | 373 | editControl.set_value($readMode.find(".ql-editor.read-mode").html()); 374 | // make the background color white 375 | $editMode.find(".ql-editor").focus(); 376 | editControl.refresh(); 377 | 378 | const visibilitySelect = $(` 379 |
380 |
381 | Comment Visibility: 382 | 385 |
386 | 397 |
398 | 399 | 400 | 401 |
402 |
403 |
404 |
405 | `).appendTo($editMode); 406 | 407 | visibilitySelect.find("select").on("change", function () { 408 | const selectedValue = $(this).val(); 409 | const newIcon = get_comment_visibility_icons(selectedValue); 410 | visibilitySelect.find(".visibility-label").html(newIcon); 411 | }); 412 | 413 | const $actionButtons = $(` 414 |
415 | 416 | 417 |
418 | `); 419 | if ($comment.find(".reply-actions").length === 0) { 420 | $actionButtons.prependTo($comment.find(".comment-actions")); 421 | } 422 | 423 | $actionButtons.find(".save-edit").on("click", function () { 424 | const newContent = editControl.get_value(); 425 | frappe.call({ 426 | method: "frappe.desk.form.utils.update_comment", 427 | args: { 428 | name: commentId, 429 | content: newContent, 430 | custom_visibility: visibilitySelect.find("select").val(), 431 | }, 432 | callback: function (r) { 433 | if (!r.exc) { 434 | $comment.find(".comment-content").html(newContent); 435 | $editMode.hide(); 436 | $readMode.show(); 437 | 438 | addThreadedReply(parentComment, doctype, docname); 439 | frappe.show_alert({ 440 | message: __("Comment updated"), 441 | indicator: "green", 442 | }); 443 | } else { 444 | frappe.msgprint(__("There was an error updating the comment")); 445 | } 446 | }, 447 | }); 448 | }); 449 | 450 | $actionButtons.find(".cancel-edit").on("click", function () { 451 | $editMode.hide(); 452 | $readMode.show(); 453 | $actionButtons.remove(); 454 | }); 455 | } 456 | -------------------------------------------------------------------------------- /frappe_comment_xt/public/js/controls/timeline.js: -------------------------------------------------------------------------------- 1 | frappe.require(["/assets/frappe_comment_xt/js/controls/replies.js"]); 2 | 3 | /**Enable the HTML Editor field preview mode by default using the provided function */ 4 | const time_line_interval_loop = setInterval(() => { 5 | let html_time_line_item = document.querySelectorAll(".new-timeline > .timeline-items .timeline-item"); 6 | 7 | if (html_time_line_item.length != 0) { 8 | update_comments_timeline(); 9 | } 10 | }, 300); 11 | 12 | function get_comment_visibility_icons(visibility) { 13 | if (visibility == "Visible to everyone") { 14 | return ` 15 | `; 16 | } 17 | 18 | if (visibility == "Visible to mentioned") { 19 | return ` 20 | 21 | `; 22 | } 23 | 24 | return ` 25 | 26 | `; 27 | } 28 | 29 | function update_the_comment_visibility(visibility) { 30 | if (visibility) { 31 | return ` 32 | 33 | 34 | ${get_comment_visibility_icons(visibility)} 35 | 36 | `; 37 | } 38 | 39 | return ` 40 | 41 | `; 42 | } 43 | 44 | function add_visibility_icons(time_line_item, visibility) { 45 | if (time_line_item.querySelector(".visibility-container")) { 46 | time_line_item.querySelector(".visibility-container").remove(); 47 | } 48 | 49 | time_line_item.querySelector(".timeline-message-box > span > span > span").innerHTML += 50 | update_the_comment_visibility(visibility); 51 | } 52 | 53 | function update_comments_timeline() { 54 | // Select all the timeline comments and replies 55 | let html_time_line_items = document.querySelectorAll(".new-timeline > .timeline-items > .timeline-item"); 56 | 57 | // Add the visibility icons to the comments 58 | for (let index = 0; index < html_time_line_items.length; index++) { 59 | // if the comment visibility are already added, skip 60 | if (html_time_line_items[index].querySelector(".visibility-info")) { 61 | break; 62 | } 63 | update_time_line(html_time_line_items[index]); 64 | } 65 | 66 | let replies_loaded = true; 67 | // Add the reply button to the comments 68 | for (let index = 0; index < html_time_line_items.length; index++) { 69 | // if the reply button is already added, skip 70 | if (html_time_line_items[index].querySelector(".reply-btn")) { 71 | break; 72 | } 73 | if (html_time_line_items[index].dataset.doctype == "Comment") { 74 | add_reply_button(html_time_line_items[index]); 75 | replies_loaded = false; 76 | } 77 | } 78 | 79 | if (!replies_loaded) { 80 | this.cur_frm.footer.setup_replies(); 81 | } 82 | } 83 | 84 | function button_handle(event) { 85 | let html_time_line_items = document.querySelectorAll(".new-timeline > .timeline-items .timeline-item"); 86 | 87 | for (let index = 0; index < html_time_line_items.length; index++) { 88 | if (html_time_line_items[index].dataset.name == event.target.dataset.name) { 89 | return button_override(html_time_line_items[index], event.target); 90 | } 91 | } 92 | } 93 | 94 | function update_time_line(time_line_item) { 95 | if (!("doctype" in time_line_item.dataset)) { 96 | return; 97 | } 98 | 99 | if (time_line_item.dataset.doctype != "Comment") { 100 | return; 101 | } 102 | 103 | frappe.call({ 104 | method: "frappe_comment_xt.overrides.whitelist.comment.get_comment_visibility", 105 | args: { 106 | name: time_line_item.dataset.name, 107 | }, 108 | callback: (res) => { 109 | add_visibility_icons(time_line_item, res?.message?.custom_visibility); 110 | }, 111 | }); 112 | 113 | let button = time_line_item.querySelector(".custom-actions button"); 114 | 115 | if (!button) { 116 | return; 117 | } 118 | button.dataset.name = time_line_item.dataset.name; 119 | 120 | // Remove the event listener 121 | button.removeEventListener("click", button_handle, true); 122 | 123 | // Add the event listener 124 | button.addEventListener("click", button_handle, true); 125 | 126 | time_line_item.querySelector(".custom-actions").lastChild.addEventListener("click", () => { 127 | time_line_item.querySelector(".timeline-comment").remove(); 128 | time_line_item.querySelector(".custom-actions").classList.remove("save-open"); 129 | }); 130 | } 131 | 132 | function button_override(time_line_item, button) { 133 | if (time_line_item.querySelector(".custom-actions").classList.contains("save-open")) { 134 | handle_save(time_line_item, button); 135 | } else { 136 | handle_edit(time_line_item, button); 137 | } 138 | } 139 | 140 | function handle_save(time_line_item, button) { 141 | frappe.call({ 142 | method: "frappe.desk.form.utils.update_comment", 143 | args: { 144 | name: time_line_item.dataset.name, 145 | content: time_line_item.querySelector(".comment-edit-box .ql-editor").innerHTML, 146 | custom_visibility: time_line_item.querySelector("#visibility").value, 147 | }, 148 | callback: () => { 149 | time_line_item.querySelector(".timeline-comment").remove(); 150 | time_line_item.querySelector(".custom-actions").classList.remove("save-open"); 151 | update_time_line(time_line_item); 152 | }, 153 | }); 154 | } 155 | 156 | function handle_edit(time_line_item, button) { 157 | const replyContainer = time_line_item.querySelector(".reply-container"); 158 | if (replyContainer) { 159 | replyContainer.remove(); 160 | } 161 | time_line_item.querySelector(".timeline-message-box").append(get_input_html(time_line_item)); 162 | time_line_item.querySelector("#visibility").value = 163 | time_line_item.querySelector(".visibility-info").dataset.visibility; 164 | time_line_item.querySelector(".custom-actions").classList.add("save-open"); 165 | } 166 | 167 | function get_input_html(time_line_item) { 168 | const div = document.createElement("div"); 169 | div.className = "checkbox timeline-comment form-inline form-group"; 170 | div.innerHTML = ` 171 |
172 | 173 |
174 | 182 |
183 | 184 | 185 | 186 |
187 |
188 |
189 | `; 190 | 191 | div.querySelector("#visibility").addEventListener("change", (event) => { 192 | add_visibility_icons(time_line_item, event.target.value); 193 | }); 194 | 195 | return div; 196 | } 197 | -------------------------------------------------------------------------------- /frappe_comment_xt/public/js/footer.bundle.js: -------------------------------------------------------------------------------- 1 | // NOTE: run `bench build` after making changes to this file 2 | // alternatively, run `bench watch` to automatically build on file changes 3 | // This is done this way in order to import and override the default Frappe FormTimeline class 4 | import FormTimeline from "frappe/public/js/frappe/form/footer/form_timeline.js"; 5 | 6 | class CustomFormTimeline extends FormTimeline { 7 | get_comment_timeline_contents() { 8 | let comment_timeline_contents = []; 9 | (this.doc_info.comments || []).forEach((comment) => { 10 | // NOTE: The comment was being added on the timeline even if it was a reply on refresh 11 | // if the comment is a reply, don't add it to the timeline 12 | if (comment.custom_reply_to !== null) { 13 | return; 14 | } 15 | comment_timeline_contents.push(this.get_comment_timeline_item(comment)); 16 | }); 17 | return comment_timeline_contents; 18 | } 19 | } 20 | 21 | frappe.ui.form.Footer = class extends frappe.ui.form.Footer { 22 | constructor(opts) { 23 | super(opts); 24 | // Once the timeline is rendered, setup the replies 25 | $(this.frm.wrapper).on("render_complete", () => { 26 | this.setup_replies(); 27 | }); 28 | } 29 | 30 | make_timeline() { 31 | this.frm.timeline = new CustomFormTimeline({ 32 | parent: this.wrapper.find(".timeline"), 33 | frm: this.frm, 34 | }); 35 | } 36 | 37 | make_comment_box() { 38 | this.frm.comment_box = frappe.ui.form.make_control({ 39 | parent: this.wrapper.find(".comment-box"), 40 | render_input: true, 41 | only_input: true, 42 | enable_mentions: true, 43 | df: { 44 | fieldtype: "Comment", 45 | fieldname: "comment", 46 | }, 47 | on_submit: (comment, custom_visibility) => { 48 | if (strip_html(comment).trim() != "" || comment.includes("img")) { 49 | this.frm.comment_box.disable(); 50 | frappe 51 | .xcall("frappe.desk.form.utils.add_comment", { 52 | reference_doctype: this.frm.doctype, 53 | reference_name: this.frm.docname, 54 | content: comment, 55 | comment_email: frappe.session.user, 56 | comment_by: frappe.session.user_fullname, 57 | custom_visibility: custom_visibility, 58 | }) 59 | .then((comment) => { 60 | let comment_item = this.frm.timeline.get_comment_timeline_item(comment); 61 | this.frm.comment_box.set_value(""); 62 | frappe.utils.play_sound("click"); 63 | this.frm.timeline.add_timeline_item(comment_item); 64 | this.frm.sidebar.refresh_comments_count && this.frm.sidebar.refresh_comments_count(); 65 | }) 66 | .finally(() => { 67 | this.frm.comment_box.enable(); 68 | update_comments_timeline(); 69 | }); 70 | this.refresh(); 71 | } 72 | }, 73 | }); 74 | } 75 | 76 | setup_replies() { 77 | // A public interface to the footer to render threaded replies 78 | const docname = this.frm.docname; 79 | const doctype = this.frm.doctype; 80 | const $timelineItems = $("div.new-timeline > div.timeline-items"); 81 | 82 | frappe.call({ 83 | method: "frappe_comment_xt.overrides.whitelist.comment.get_all_replies", 84 | args: { 85 | reference_name: docname, 86 | reference_doctype: doctype, 87 | }, 88 | callback: (res) => { 89 | if (res.exc) { 90 | console.error(res.exc); 91 | return; 92 | } 93 | // No replies found 94 | if (!res.message || Object.keys(res.message).length === 0) return; 95 | 96 | $timelineItems.find('.timeline-item[data-doctype="Comment"]').each(function () { 97 | const $item = $(this); 98 | const commentId = $item.data("name"); 99 | render_replies($item, commentId, res.message); 100 | }); 101 | }, 102 | }); 103 | } 104 | }; 105 | -------------------------------------------------------------------------------- /frappe_comment_xt/public/js/frappe_comment_xt.js: -------------------------------------------------------------------------------- 1 | frappe.require(["/assets/frappe_comment_xt/js/controls/replies.js"]); 2 | frappe.require(["/assets/frappe_comment_xt/js/controls/timeline.js"]); 3 | frappe.require(["/assets/frappe_comment_xt/js/controls/comment.js"]); 4 | -------------------------------------------------------------------------------- /frappe_comment_xt/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rtCamp/frappe-comment-xt/faf39c5345b74bdcb720fc227cc1b4ec480f6537/frappe_comment_xt/templates/__init__.py -------------------------------------------------------------------------------- /frappe_comment_xt/templates/pages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rtCamp/frappe-comment-xt/faf39c5345b74bdcb720fc227cc1b4ec480f6537/frappe_comment_xt/templates/pages/__init__.py -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "frappe_comment_xt" 3 | authors = [ 4 | { name = "rtCamp", email = "frappe@rtcamp.com"} 5 | ] 6 | description = "Enhancing the default comments function in Frappe" 7 | requires-python = ">=3.10" 8 | readme = "README.md" 9 | dynamic = ["version"] 10 | dependencies = [ 11 | # "frappe~=15.0.0" # Installed and managed by bench. 12 | ] 13 | 14 | [build-system] 15 | requires = ["flit_core >=3.4,<4"] 16 | build-backend = "flit_core.buildapi" 17 | 18 | # These dependencies are only installed when developer mode is enabled 19 | [tool.bench.dev-dependencies] 20 | # package_name = "~=1.1.0" 21 | 22 | [tool.black] 23 | line-length = 120 24 | 25 | [tool.ruff] 26 | line-length = 120 27 | target-version = "py310" 28 | exclude = [ 29 | "**/doctype/*/boilerplate/*.py" # boilerplate are template strings, not valid python 30 | ] 31 | 32 | [tool.ruff.lint] 33 | select = [ 34 | "F", 35 | "E", 36 | "W", 37 | "I", 38 | "UP", 39 | "B", 40 | "RUF", 41 | ] 42 | ignore = [ 43 | "B017", # assertRaises(Exception) - should be more specific 44 | "B018", # useless expression, not assigned to anything 45 | "B023", # function doesn't bind loop variable - will have last iteration's value 46 | "B904", # raise inside except without from 47 | "E402", # module level import not at top of file 48 | "E501", # line too long 49 | "E741", # ambiguous variable name 50 | "F403", # can't detect undefined names from * import 51 | "F405", # can't detect undefined names from * import 52 | "F722", # syntax error in forward type annotation 53 | "W191", # indentation contains tabs 54 | "RUF001", # string contains ambiguous unicode character 55 | "UP032", # Use f-string instead of `format` call (translations) 56 | "UP030", # Use implicit references for positional format fields (translations) 57 | ] 58 | typing-modules = ["frappe.types.DF"] 59 | 60 | [tool.ruff.format] 61 | quote-style = "double" 62 | indent-style = "space" 63 | docstring-code-format = true 64 | --------------------------------------------------------------------------------