mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 06:23:43 +08:00
56524f4bdf
Very similar to move up/down flag problem fixed here - https://github.com/discourse/discourse/pull/28272 Those are the steps to toggle the flag: 1. click toggle - `saving` CSS class is added; 2. request to backend; 3. `saving` CSS class is removed. And check if the flag was toggle was: ```ruby def has_saved_flag?(key) has_css?(".admin-flag-item.#{key}.saving") has_no_css?(".admin-flag-item.#{key}.saving") end ``` If the save action is very fast, then the saving class is removed before the first check. Therefore I decided to invert it, and once action is finished add `saved` CSS class. Then we can have a quick positive check: ```ruby def has_saved_flag?(key) has_css?(".admin-flag-item.#{key}.saved") end ``` |
||
---|---|---|
.. | ||
fabricators | ||
fixtures | ||
generator | ||
helpers | ||
import_export | ||
initializers | ||
integration | ||
integrity | ||
jobs | ||
lib | ||
mailers | ||
migrations | ||
models | ||
multisite | ||
requests | ||
script/import_scripts | ||
serializers | ||
services | ||
support | ||
system | ||
tasks | ||
views | ||
rails_helper.rb | ||
regenerate_swagger_docs | ||
swagger_helper.rb |