card 1.98.0 → 1.98.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20190718140126_add_guides.rb +19 -0
  4. data/db/migrate_core_cards/data/cards/Xaccount_setting-Xright-Xstructure +9 -2
  5. data/db/migrate_core_cards/data/cards/anyone_signed_in-dashboard +0 -2
  6. data/db/seed/new/card_actions.yml +858 -842
  7. data/db/seed/new/card_acts.yml +2 -2
  8. data/db/seed/new/card_references.yml +965 -951
  9. data/db/seed/new/cards.yml +3351 -3310
  10. data/db/seed/new/schema_migrations_core_cards.yml +4 -0
  11. data/db/seed/test/fixtures/card_actions.yml +1861 -1845
  12. data/db/seed/test/fixtures/card_acts.yml +489 -489
  13. data/db/seed/test/fixtures/card_changes.yml +66 -66
  14. data/db/seed/test/fixtures/card_references.yml +922 -908
  15. data/db/seed/test/fixtures/cards.yml +3100 -3059
  16. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +4 -0
  17. data/lib/card/act_manager.rb +15 -45
  18. data/lib/card/act_manager/event_delay.rb +48 -0
  19. data/lib/card/act_manager/stage_director.rb +2 -2
  20. data/lib/card/act_manager/stage_director/phases.rb +3 -6
  21. data/lib/card/auth/current.rb +5 -0
  22. data/lib/card/set/event/delayed_event.rb +2 -0
  23. data/mod/account/set/right/account.rb +10 -14
  24. data/mod/account/set/right/token.rb +1 -0
  25. data/mod/account/set/type/signup.rb +2 -4
  26. data/mod/account/spec/set/right/account_spec.rb +1 -2
  27. data/mod/account/spec/set/type/signup_spec.rb +2 -1
  28. data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +1 -6
  29. data/mod/core/set/all/event_conditions.rb +16 -5
  30. data/mod/core/set/all/fetch_helper.rb +4 -1
  31. data/mod/core/set/all/name_events.rb +3 -2
  32. data/mod/core/set/all/references.rb +3 -3
  33. data/mod/core/set/all/rename.rb +3 -2
  34. data/mod/core/set/all/update_read_rules.rb +1 -19
  35. data/mod/core/spec/set/all/event_conditions_spec.rb +36 -38
  36. data/mod/core/spec/set/all/permissions_spec.rb +1 -1
  37. data/mod/date/set/all/calendar.rb +1 -1
  38. data/mod/date/vendor/moment/CHANGELOG.md +8 -0
  39. data/mod/date/vendor/moment/Moment.js.nuspec +5 -5
  40. data/mod/date/vendor/moment/component.json +1 -1
  41. data/mod/date/vendor/moment/locale/az.js +1 -1
  42. data/mod/date/vendor/moment/locale/be.js +1 -1
  43. data/mod/date/vendor/moment/locale/pa-in.js +1 -1
  44. data/mod/date/vendor/moment/meteor/package.js +1 -1
  45. data/mod/date/vendor/moment/min/locales.js +28 -28
  46. data/mod/date/vendor/moment/min/locales.min.js +1 -1
  47. data/mod/date/vendor/moment/min/moment-with-locales.js +33 -33
  48. data/mod/date/vendor/moment/min/moment-with-locales.min.js +1 -1
  49. data/mod/date/vendor/moment/min/moment.min.js +1 -1
  50. data/mod/date/vendor/moment/min/tests.js +48 -11
  51. data/mod/date/vendor/moment/moment.js +5 -5
  52. data/mod/date/vendor/moment/package.json +2 -2
  53. data/mod/date/vendor/moment/src/lib/create/from-string.js +1 -1
  54. data/mod/date/vendor/moment/src/lib/units/day-of-week.js +3 -3
  55. data/mod/date/vendor/moment/src/locale/az.js +1 -1
  56. data/mod/date/vendor/moment/src/locale/be.js +1 -1
  57. data/mod/date/vendor/moment/src/locale/pa-in.js +1 -1
  58. data/mod/date/vendor/moment/src/moment.js +2 -2
  59. data/mod/date/vendor/moment/src/test/locale/az.js +5 -5
  60. data/mod/date/vendor/moment/src/test/locale/be.js +3 -0
  61. data/mod/date/vendor/moment/src/test/locale/pa-in.js +3 -3
  62. data/mod/date/vendor/moment/src/test/moment/locale.js +33 -0
  63. data/mod/date/vendor/moment/src/test/moment/start_end_of.js +1 -1
  64. data/mod/date/vendor/moment/src/test/moment/weeks.js +2 -2
  65. data/mod/date/vendor/tempusdominus/Gruntfile.js +7 -49
  66. data/mod/date/vendor/tempusdominus/build/css/tempusdominus-bootstrap-4.css +3 -1
  67. data/mod/date/vendor/tempusdominus/build/css/tempusdominus-bootstrap-4.min.css +3 -1
  68. data/mod/date/vendor/tempusdominus/build/js/tempusdominus-bootstrap-4.js +128 -116
  69. data/mod/date/vendor/tempusdominus/build/js/tempusdominus-bootstrap-4.min.js +3 -3
  70. data/mod/date/vendor/tempusdominus/composer.json +3 -3
  71. data/mod/date/vendor/tempusdominus/docs/Changelog/index.html +20 -36
  72. data/mod/date/vendor/tempusdominus/docs/ContributorsGuide/index.html +20 -36
  73. data/mod/date/vendor/tempusdominus/docs/Events/index.html +20 -36
  74. data/mod/date/vendor/tempusdominus/docs/Extras/index.html +20 -36
  75. data/mod/date/vendor/tempusdominus/docs/FAQ/index.html +20 -36
  76. data/mod/date/vendor/tempusdominus/docs/Functions/index.html +20 -36
  77. data/mod/date/vendor/tempusdominus/docs/Installing/index.html +30 -50
  78. data/mod/date/vendor/tempusdominus/docs/Options/index.html +21 -37
  79. data/mod/date/vendor/tempusdominus/docs/Usage/index.html +20 -40
  80. data/mod/date/vendor/tempusdominus/docs/css/base.css +1682 -0
  81. data/mod/date/vendor/tempusdominus/docs/css/tempusdominus-bootstrap-4.css +3 -1
  82. data/mod/date/vendor/tempusdominus/docs/index.html +26 -41
  83. data/mod/date/vendor/tempusdominus/docs/js/tempusdominus-bootstrap-4.js +127 -115
  84. data/mod/date/vendor/tempusdominus/docs/search/search_index.json +11 -16
  85. data/mod/date/vendor/tempusdominus/docs/sitemap.xml +10 -10
  86. data/mod/date/vendor/tempusdominus/docs/theme/base.html +11 -12
  87. data/mod/date/vendor/tempusdominus/docs/theme/css/base.css +1682 -0
  88. data/mod/date/vendor/tempusdominus/docs/theme/css/tempusdominus-bootstrap-4.css +3 -1
  89. data/mod/date/vendor/tempusdominus/docs/theme/js/tempusdominus-bootstrap-4.js +127 -115
  90. data/mod/date/vendor/tempusdominus/docs/theme/toc.html +1 -0
  91. data/mod/date/vendor/tempusdominus/package-lock.json +4085 -8197
  92. data/mod/date/vendor/tempusdominus/package.json +17 -19
  93. data/mod/date/vendor/tempusdominus/src/docs/Installing.md +12 -18
  94. data/mod/date/vendor/tempusdominus/src/docs/Options.md +1 -1
  95. data/mod/date/vendor/tempusdominus/src/docs/Usage.md +0 -2
  96. data/mod/date/vendor/tempusdominus/src/docs/index.md +7 -5
  97. data/mod/date/vendor/tempusdominus/src/docs/theme/base.html +11 -12
  98. data/mod/date/vendor/tempusdominus/src/docs/theme/css/base.css +1682 -0
  99. data/mod/date/vendor/tempusdominus/src/docs/theme/css/tempusdominus-bootstrap-4.css +3 -1
  100. data/mod/date/vendor/tempusdominus/src/docs/theme/js/tempusdominus-bootstrap-4.js +127 -115
  101. data/mod/date/vendor/tempusdominus/src/docs/theme/toc.html +1 -0
  102. data/mod/date/vendor/tempusdominus/src/js/tempusdominus-bootstrap-4.js +32 -12
  103. data/mod/date/vendor/tempusdominus/src/sass/_tempusdominus-bootstrap-4.scss +4 -0
  104. data/mod/date/vendor/tempusdominus/src/sass/tempusdominus-bootstrap-4-build.scss +2 -2
  105. data/mod/edit/set/all/bridge.rb +4 -1
  106. data/mod/edit/set/all/bridge/tab_views.rb +4 -0
  107. data/mod/edit/set/all/bridge/tab_visibility.rb +4 -0
  108. data/mod/edit/set/all/edit_content.rb +9 -0
  109. data/mod/edit/set/all/edit_inline.rb +0 -4
  110. data/mod/edit/set/all/edit_type.rb +83 -12
  111. data/mod/edit/set/all/editing.rb +2 -2
  112. data/mod/edit/set/all/form.rb +1 -62
  113. data/mod/edit/set/all/form_buttons.rb +1 -1
  114. data/mod/edit/set/all/new.rb +52 -7
  115. data/mod/edit/spec/set/all/nest_editor_spec.rb +1 -1
  116. data/mod/follow/set/all/notify/base_views.rb +1 -3
  117. data/mod/machines/file/all_script_machine_output/file.js +72 -38108
  118. data/mod/machines/file/all_style_machine_output/file.css +3 -3
  119. data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
  120. data/mod/machines/lib/javascript/decko/decko.js.coffee +12 -3
  121. data/mod/machines/lib/javascript/decko/overlay.js.coffee +3 -0
  122. data/mod/machines/lib/javascript/decko/slotter.js.coffee +8 -0
  123. data/mod/machines/lib/stylesheets/style_cards.scss +15 -0
  124. data/mod/machines/spec/set/type/css_spec.rb +14 -14
  125. data/mod/machines/spec/shared_examples/machine_input.rb +6 -10
  126. data/mod/navbar/set/abstract/{roles_dropdown.rb → account_dropdown.rb} +8 -2
  127. data/mod/navbar/set/right/enabled_roles.rb +6 -8
  128. data/mod/navbar/set/self/account_links.rb +2 -2
  129. data/mod/navbar/spec/set/self/account_links_spec.rb +31 -0
  130. data/mod/pointer/set/abstract/02_pointer/html_views.rb +1 -1
  131. data/mod/rules/set/rule/editor.rb +1 -1
  132. data/mod/rules/set/type/set/setting_lists.rb +1 -1
  133. data/mod/search/set/self/search.rb +2 -0
  134. data/mod/settings/set/right/guide.rb +8 -0
  135. data/mod/settings/set/right/read.rb +1 -1
  136. data/mod/settings/set/self/guide.rb +3 -0
  137. data/mod/standard/set/all/rich_html/content.rb +0 -6
  138. data/mod/standard/set/all/rich_html/error.rb +3 -3
  139. data/mod/standard/set/all/rich_html/html_views/guide.rb +51 -0
  140. data/mod/standard/set/all/rich_html/html_views/help.rb +6 -0
  141. data/mod/standard/set/all/rich_html/overlay.rb +1 -1
  142. data/mod/standard/set/type/cardtype.rb +1 -1
  143. data/mod/tinymce_editor/lib/javascript/script_tinymce.js +2 -2
  144. data/mod/tinymce_editor/public/assets/tinymce/jquery.tinymce.min.js +1 -1
  145. data/mod/tinymce_editor/public/assets/tinymce/plugins/advlist/plugin.min.js +2 -2
  146. data/mod/tinymce_editor/public/assets/tinymce/plugins/anchor/plugin.min.js +2 -2
  147. data/mod/tinymce_editor/public/assets/tinymce/plugins/autolink/plugin.min.js +2 -2
  148. data/mod/tinymce_editor/public/assets/tinymce/plugins/autoresize/plugin.min.js +2 -2
  149. data/mod/tinymce_editor/public/assets/tinymce/plugins/autosave/plugin.min.js +2 -2
  150. data/mod/tinymce_editor/public/assets/tinymce/plugins/bbcode/plugin.min.js +2 -2
  151. data/mod/tinymce_editor/public/assets/tinymce/plugins/charmap/plugin.min.js +2 -2
  152. data/mod/tinymce_editor/public/assets/tinymce/plugins/code/plugin.min.js +2 -2
  153. data/mod/tinymce_editor/public/assets/tinymce/plugins/codesample/plugin.min.js +2 -2
  154. data/mod/tinymce_editor/public/assets/tinymce/plugins/colorpicker/plugin.min.js +2 -2
  155. data/mod/tinymce_editor/public/assets/tinymce/plugins/contextmenu/plugin.min.js +2 -2
  156. data/mod/tinymce_editor/public/assets/tinymce/plugins/directionality/plugin.min.js +2 -2
  157. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/js/emojis.js +8941 -8941
  158. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/plugin.min.js +2 -2
  159. data/mod/tinymce_editor/public/assets/tinymce/plugins/fullpage/plugin.min.js +2 -2
  160. data/mod/tinymce_editor/public/assets/tinymce/plugins/fullscreen/plugin.min.js +2 -2
  161. data/mod/tinymce_editor/public/assets/tinymce/plugins/help/plugin.min.js +2 -2
  162. data/mod/tinymce_editor/public/assets/tinymce/plugins/hr/plugin.min.js +2 -2
  163. data/mod/tinymce_editor/public/assets/tinymce/plugins/image/plugin.min.js +2 -2
  164. data/mod/tinymce_editor/public/assets/tinymce/plugins/imagetools/plugin.min.js +2 -2
  165. data/mod/tinymce_editor/public/assets/tinymce/plugins/importcss/plugin.min.js +2 -2
  166. data/mod/tinymce_editor/public/assets/tinymce/plugins/insertdatetime/plugin.min.js +2 -2
  167. data/mod/tinymce_editor/public/assets/tinymce/plugins/legacyoutput/plugin.min.js +2 -2
  168. data/mod/tinymce_editor/public/assets/tinymce/plugins/link/plugin.min.js +2 -2
  169. data/mod/tinymce_editor/public/assets/tinymce/plugins/lists/plugin.min.js +2 -2
  170. data/mod/tinymce_editor/public/assets/tinymce/plugins/media/plugin.min.js +2 -2
  171. data/mod/tinymce_editor/public/assets/tinymce/plugins/nonbreaking/plugin.min.js +2 -2
  172. data/mod/tinymce_editor/public/assets/tinymce/plugins/noneditable/plugin.min.js +2 -2
  173. data/mod/tinymce_editor/public/assets/tinymce/plugins/pagebreak/plugin.min.js +2 -2
  174. data/mod/tinymce_editor/public/assets/tinymce/plugins/paste/plugin.min.js +2 -2
  175. data/mod/tinymce_editor/public/assets/tinymce/plugins/preview/plugin.min.js +2 -2
  176. data/mod/tinymce_editor/public/assets/tinymce/plugins/print/plugin.min.js +2 -2
  177. data/mod/tinymce_editor/public/assets/tinymce/plugins/quickbars/plugin.min.js +2 -2
  178. data/mod/tinymce_editor/public/assets/tinymce/plugins/save/plugin.min.js +2 -2
  179. data/mod/tinymce_editor/public/assets/tinymce/plugins/searchreplace/plugin.min.js +2 -2
  180. data/mod/tinymce_editor/public/assets/tinymce/plugins/spellchecker/plugin.min.js +2 -2
  181. data/mod/tinymce_editor/public/assets/tinymce/plugins/tabfocus/plugin.min.js +2 -2
  182. data/mod/tinymce_editor/public/assets/tinymce/plugins/table/plugin.min.js +2 -2
  183. data/mod/tinymce_editor/public/assets/tinymce/plugins/template/plugin.min.js +2 -2
  184. data/mod/tinymce_editor/public/assets/tinymce/plugins/textcolor/plugin.min.js +2 -2
  185. data/mod/tinymce_editor/public/assets/tinymce/plugins/textpattern/plugin.min.js +2 -2
  186. data/mod/tinymce_editor/public/assets/tinymce/plugins/toc/plugin.min.js +2 -2
  187. data/mod/tinymce_editor/public/assets/tinymce/plugins/visualblocks/plugin.min.js +2 -2
  188. data/mod/tinymce_editor/public/assets/tinymce/plugins/visualchars/plugin.min.js +2 -2
  189. data/mod/tinymce_editor/public/assets/tinymce/plugins/wordcount/plugin.min.js +2 -2
  190. data/mod/tinymce_editor/public/assets/tinymce/skins/content/default/content.min.css +1 -1
  191. data/mod/tinymce_editor/public/assets/tinymce/skins/content/document/content.min.css +1 -1
  192. data/mod/tinymce_editor/public/assets/tinymce/skins/content/writer/content.min.css +1 -1
  193. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  194. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  195. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  196. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  197. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/content.min.css +1 -1
  198. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/content.mobile.min.css +7 -1
  199. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/skin.min.css +1 -1
  200. data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/skin.mobile.min.css +7 -1
  201. data/mod/tinymce_editor/public/assets/tinymce/themes/mobile/theme.min.js +2 -2
  202. data/mod/tinymce_editor/public/assets/tinymce/themes/silver/theme.min.js +2 -2
  203. data/mod/tinymce_editor/public/assets/tinymce/tinymce.min.js +2 -2
  204. metadata +10 -47
  205. data/mod/date/vendor/tempusdominus/src/nuget/NuGet.exe +0 -0
  206. data/mod/date/vendor/tempusdominus/src/nuget/Tempus.Dominus.Bootstrap.4.nuspec +0 -29
  207. data/mod/tinymce_editor/public/assets/tinymce/plugins/codesample/css/prism.css +0 -138
  208. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
  209. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
  210. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  211. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  212. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
  213. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
  214. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
  215. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
  216. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  217. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
  218. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
  219. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
  220. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  221. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
  222. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
  223. data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
  224. data/mod/tinymce_editor/public/assets/tinymce/plugins/help/img/logo.png +0 -0
  225. data/mod/tinymce_editor/public/assets/tinymce/plugins/visualblocks/css/visualblocks.css +0 -154
  226. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/content.inline.min.css +0 -1
  227. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/content.min.css +0 -1
  228. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/content.mobile.min.css +0 -1
  229. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
  230. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
  231. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce-small.svg +0 -63
  232. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  233. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
  234. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  235. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce.svg +0 -131
  236. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  237. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  238. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/img/anchor.gif +0 -0
  239. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/img/loader.gif +0 -0
  240. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/img/object.gif +0 -0
  241. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/img/trans.gif +0 -0
  242. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/skin.min.css +0 -1
  243. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/skin.min.css.map +0 -0
  244. data/mod/tinymce_editor/public/assets/tinymce/skins/lightgray/skin.mobile.min.css +0 -2
  245. data/mod/tinymce_editor/public/assets/tinymce/themes/inlite/theme.min.js +0 -1
  246. data/mod/tinymce_editor/public/assets/tinymce/themes/modern/theme.min.js +0 -1
@@ -263,3 +263,7 @@ schema_migrations_core_cards_131:
263
263
  version: '20190710090205'
264
264
  schema_migrations_core_cards_132:
265
265
  version: '20190710090207'
266
+ schema_migrations_core_cards_133:
267
+ version: '20190718140125'
268
+ schema_migrations_core_cards_134:
269
+ version: '20190718140126'
@@ -76,9 +76,11 @@ class Card
76
76
  # everything will rollback. If the integration phase fails the db changes
77
77
  # of the other two phases will remain persistent.
78
78
  class ActManager
79
- cattr_accessor :act, :act_card
79
+ extend EventDelay
80
80
 
81
81
  class << self
82
+ attr_accessor :act, :act_card
83
+
82
84
  def act_director
83
85
  return unless act_card
84
86
 
@@ -105,11 +107,22 @@ class Card
105
107
  self.act_card = nil
106
108
  self.act = nil
107
109
  directors.each_pair do |card, _dir|
110
+ card.expire
108
111
  card.director = nil
109
112
  end
113
+ expire
110
114
  @directors = nil
111
115
  end
112
116
 
117
+ def expire
118
+ expirees.each { |expiree| Card.expire expiree }
119
+ @expirees = []
120
+ end
121
+
122
+ def expirees
123
+ @expirees ||= []
124
+ end
125
+
113
126
  # FIXME: use "parent" instead of opts (it's the only option)
114
127
  def fetch card, opts={}
115
128
  return directors[card] if directors[card]
@@ -166,54 +179,11 @@ class Card
166
179
  end
167
180
 
168
181
  def running_act?
169
- (dir = act_director) && dir.running?
170
- end
171
-
172
- # If active jobs (and hence the integrate_with_delay events) don't run
173
- # in a background process then Card::Env.deserialize! decouples the
174
- # controller's params hash and the Card::Env's params hash with the
175
- # effect that params changes in the CardController get lost
176
- # (a crucial example are success params that are processed in
177
- # CardController#soft_redirect)
178
- def contextualize_delayed_event act_id, card, env, auth
179
- if delaying?
180
- contextualize_for_delay(act_id, card, env, auth) { yield }
181
- else
182
- yield
183
- end
184
- end
185
-
186
- def delaying?
187
- const_defined?("Delayed") &&
188
- Delayed::Worker.delay_jobs &&
189
- Card.config.active_job.queue_adapter == :delayed_job
190
- end
191
-
192
- # The whole ActManager setup is gone once we reach a integrate with delay
193
- # event processed by ActiveJob.
194
- # This is the improvised resetup to get subcards working.
195
- def contextualize_for_delay act_id, card, env, auth, &block
196
- self.act = Act.find act_id if act_id
197
- with_env_and_auth env, auth do
198
- return yield unless act
199
-
200
- run_act(act.card || card) do
201
- act_card.director.run_delayed_event act, &block
202
- end
203
- end
204
- end
205
-
206
- def with_env_and_auth env, auth
207
- Card::Auth.with auth do
208
- Card::Env.with env do
209
- yield
210
- end
211
- end
182
+ act_director&.running?
212
183
  end
213
184
 
214
185
  def to_s
215
186
  act_director.to_s
216
- # directors.values.map(&:to_s).join "\n"
217
187
  end
218
188
  end
219
189
  end
@@ -0,0 +1,48 @@
1
+ class Card
2
+ class ActManager
3
+ # methods for handling delayed events
4
+ module EventDelay
5
+ # If active jobs (and hence the integrate_with_delay events) don't run
6
+ # in a background process then Card::Env.deserialize! decouples the
7
+ # controller's params hash and the Card::Env's params hash with the
8
+ # effect that params changes in the CardController get lost
9
+ # (a crucial example are success params that are processed in
10
+ # CardController#soft_redirect)
11
+ def contextualize_delayed_event act_id, card, env, auth
12
+ if delaying?
13
+ contextualize_for_delay(act_id, card, env, auth) { yield }
14
+ else
15
+ yield
16
+ end
17
+ end
18
+
19
+ def delaying?
20
+ const_defined?("Delayed") &&
21
+ Delayed::Worker.delay_jobs &&
22
+ Card.config.active_job.queue_adapter == :delayed_job
23
+ end
24
+
25
+ # The whole ActManager setup is gone once we reach a integrate with delay
26
+ # event processed by ActiveJob.
27
+ # This is the improvised resetup to get subcards working.
28
+ def contextualize_for_delay act_id, card, env, auth, &block
29
+ self.act = Act.find act_id if act_id
30
+ with_env_and_auth env, auth do
31
+ return yield unless act
32
+
33
+ run_act(act.card || card) do
34
+ act_card.director.run_delayed_event act, &block
35
+ end
36
+ end
37
+ end
38
+
39
+ def with_env_and_auth env, auth
40
+ Card::Auth.with auth do
41
+ Card::Env.with env do
42
+ yield
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -10,8 +10,8 @@ class Card
10
10
 
11
11
  def clean_after_stage_fail
12
12
  @action = nil
13
- expire_pieces
14
- subcards.each(&:expire_pieces)
13
+ # expire_pieces
14
+ # subcards.each(&:expire_pieces)
15
15
  end
16
16
 
17
17
  class ActManager
@@ -6,7 +6,8 @@ class Card
6
6
  run_single_stage :initialize
7
7
  run_single_stage :prepare_to_validate
8
8
  run_single_stage :validate
9
- @card.expire_pieces if @card.errors.any?
9
+ ensure
10
+ # @card.expire_pieces if @card.errors.any?
10
11
  @card.errors.empty?
11
12
  end
12
13
 
@@ -14,11 +15,7 @@ class Card
14
15
  catch_up_to_stage :prepare_to_store
15
16
  run_single_stage :store, &block
16
17
  run_single_stage :finalize
17
- if @card.errors.any?
18
- @card.expire_pieces
19
- raise ActiveRecord::Rollback,
20
- "errors added in storage phase: #{@card.errors.full_messages * ','}"
21
- end
18
+ raise ActiveRecord::RecordInvalid, @card if @card.errors.any?
22
19
  ensure
23
20
  @from_trash = nil
24
21
  end
@@ -54,6 +54,11 @@ class Card
54
54
  current.fetch(trait: :roles)&.item_names].flatten.compact
55
55
  end
56
56
 
57
+ def no_special_roles?
58
+ Auth.current_roles.size == 1 # &&
59
+ # Auth.current_roles.first == Card.fetch_name(:anyone_signed_in)
60
+ end
61
+
57
62
  def clear_current_roles
58
63
  @current_roles = nil
59
64
  end
@@ -41,6 +41,8 @@ class Card
41
41
  ActManager.contextualize_delayed_event act_id, card, env, auth do
42
42
  card.send method_name
43
43
  end
44
+ ensure
45
+ ActManager.expire
44
46
  end
45
47
  end
46
48
  end
@@ -64,9 +64,7 @@ event :send_welcome_email do
64
64
  end
65
65
 
66
66
  event :send_reset_password_token do
67
- Auth.as_bot do
68
- token_card.update! content: generate_token
69
- end
67
+ reset_token
70
68
  Card[:password_reset_email].deliver self, to: email
71
69
  end
72
70
 
@@ -87,10 +85,7 @@ def pending?
87
85
  end
88
86
 
89
87
  def validate_token! test_token
90
- tcard = token_card
91
- tcard.validate! test_token
92
- copy_errors tcard
93
- errors.empty?
88
+ token_card.validate! test_token
94
89
  end
95
90
 
96
91
  def reset_password_with_token token
@@ -98,7 +93,10 @@ def reset_password_with_token token
98
93
  if !token
99
94
  errors.add :token, "is required"
100
95
  elsif !validate_token!(token)
101
- # FIXME: isn't this an error??
96
+ # FIXME: This should be an error.
97
+ # However, an error abort will trigger a rollback, so the
98
+ # token reset won't work. That may be an argument for
99
+ # handling the token update in a separate request?
102
100
  success << reset_password_try_again
103
101
  else
104
102
  success << reset_password_success
@@ -123,17 +121,15 @@ def ok_to_read
123
121
  end
124
122
 
125
123
  def reset_password_success
126
- token_card.used!
124
+ # token_card.used!
127
125
  Auth.signin left_id
128
- { id: name,
129
- view: :edit }
126
+ { id: name, view: :edit }
130
127
  end
131
128
 
132
129
  def reset_password_try_again
130
+ message = tr :sorry_email_reset, error_msg: token_card.errors.first.last
133
131
  send_reset_password_token
134
- { id: "_self",
135
- view: "message",
136
- message: tr(:sorry_email_reset, error_msg: errors.first.last) }
132
+ { id: "_self", view: "message", message: message }
137
133
  end
138
134
 
139
135
  # FIXME: explain or remove.
@@ -20,6 +20,7 @@ def validate! token
20
20
  when content != token then [:incorrect_token, tr(:error_incorrect_token)]
21
21
  end
22
22
  errors.add *error if error
23
+ error.nil?
23
24
  end
24
25
 
25
26
  def expired?
@@ -115,10 +115,8 @@ event :activate_by_token, :validate, on: :update,
115
115
  # necessary because this performs actions as Wagn Bot
116
116
  abort :failure, "no account associated with #{name}" unless account
117
117
 
118
- account.validate_token! @env_token
119
-
120
- if account.errors.empty?
121
- account.token_card.used!
118
+ if account.validate_token! @env_token
119
+ # account.token_card.used!
122
120
  activate_account
123
121
  Auth.signin id
124
122
  Auth.as_bot # use admin permissions for rest of action
@@ -149,7 +149,6 @@ RSpec.describe Card::Set::Right::Account do
149
149
  trigger_reset
150
150
  expect(Card::Auth.current_id).to eq(@account.left_id)
151
151
  @account = @account.refresh true
152
- # expect(@account.fetch(trait: :token)).to be_nil
153
152
  end
154
153
 
155
154
  it "does not work if token is expired" do
@@ -169,7 +168,7 @@ RSpec.describe Card::Set::Right::Account do
169
168
  it "does not work if token is wrong" do
170
169
  Card::Env.params[:token] = @token + "xxx"
171
170
  trigger_reset
172
- expect(@account.errors[:incorrect_token].first).to match(/mismatch/)
171
+ expect(Card::Env.success[:message]).to match(/mismatch/)
173
172
  end
174
173
  end
175
174
  end
@@ -103,7 +103,8 @@ RSpec.describe Card::Set::Type::Signup do
103
103
  # token gets updated
104
104
  expect(@account.token).not_to eq(@token)
105
105
  # user notified of expired token
106
- expect(Card::Env.success.message).to match(/expired/)
106
+ expect(Card::Env.success.message)
107
+ .to match(/Please check your email for a new password reset link\./)
107
108
  end
108
109
  end
109
110
 
@@ -37,7 +37,7 @@ header {
37
37
 
38
38
  label,
39
39
  .navbox-item-label {
40
- color: $label_color;
40
+ // color: $label_color;
41
41
  }
42
42
  table {
43
43
  border-collapse: collapse;
@@ -64,11 +64,6 @@ form {
64
64
  padding: 0px;
65
65
  }
66
66
 
67
- .form-group > label {
68
- color: $dark;
69
- font-weight: bold;
70
- }
71
-
72
67
  .link-muted {
73
68
  color: $text-muted;
74
69
  &:hover {
@@ -6,6 +6,10 @@ def event_applies? event
6
6
  end
7
7
  end
8
8
 
9
+ def skip_event! *events
10
+ forced_skip_events.merge events
11
+ end
12
+
9
13
  private
10
14
 
11
15
  def set_condition_applies? set_module, old_sets
@@ -68,9 +72,9 @@ def when_condition_applies? _event, block
68
72
  end
69
73
 
70
74
  def skip_condition_applies? event, allowed
71
- return true if skip_events.empty?
72
- event = event.name.to_s
73
- !(standard_skip_event?(event, allowed) || force_skip_event?(event))
75
+ return true if never_skip?
76
+
77
+ !(standard_skip_event?(event.name, allowed) || force_skip_event?(event.name))
74
78
  end
75
79
 
76
80
  def trigger_condition_applies? event, required
@@ -103,17 +107,24 @@ def wrong_action action
103
107
  "on: #{action} method #{method} called on #{@action}"
104
108
  end
105
109
 
110
+ def never_skip?
111
+ return @never_skip unless @never_skip.nil?
112
+
113
+ @never_skip = skip_events.empty? && forced_skip_events.empty?
114
+ end
115
+
106
116
  def standard_skip_event? event, allowed
107
117
  return false unless allowed == :allowed
108
- skip_events.include? event
118
+ skip_events.include? event.to_s
109
119
  end
110
120
 
111
121
  def force_skip_event? event
112
122
  forced_skip_events.include? event
113
123
  end
114
124
 
125
+ # holder for skip_event! (with bang) events
115
126
  def forced_skip_events
116
- @forced_skip_events ||= ::Set.new(skip_events.find_all { |e| e.last == "!" })
127
+ @forced_skip_events ||= ::Set.new([])
117
128
  end
118
129
 
119
130
  def skip_events
@@ -27,8 +27,11 @@ module ClassMethods
27
27
 
28
28
  def standard_controller_fetch args, card_opts
29
29
  mark = args[:mark] || card_opts[:name]
30
- card = Card.fetch mark, look_in_trash: args[:look_in_trash], new: card_opts
30
+ card = Card.fetch mark, skip_modules: true,
31
+ look_in_trash: args[:look_in_trash],
32
+ new: card_opts
31
33
  card.assign_attributes card_opts if args[:assign] && card&.real?
34
+ card&.include_set_modules
32
35
  card
33
36
  end
34
37
 
@@ -14,6 +14,7 @@ end
14
14
  event :validate_name, :validate, on: :save, changed: :name do
15
15
  validate_legality_of_name
16
16
  return if errors.any?
17
+ Card.write_to_soft_cache self
17
18
  validate_uniqueness_of_name
18
19
  end
19
20
 
@@ -50,8 +51,8 @@ end
50
51
 
51
52
  # STAGE: store
52
53
 
53
- event :set_name, :store, changed: :name do
54
- expire
54
+ event :expire_old_name, :store, changed: :name, on: :update do
55
+ ActManager.expirees << name_before_act
55
56
  end
56
57
 
57
58
  event :set_left_and_right, :store,
@@ -166,9 +166,9 @@ event :update_referer_content, :finalize,
166
166
  on: :update, after: :name_change_finalized, when: :update_referers do
167
167
  referers.each do |card|
168
168
  next if card.structure
169
- card.skip_in_action = %i[validate_renaming check_permissions!]
170
- attach_subcard card.name,
171
- content: card.replace_reference_syntax(name_before_last_save, name)
169
+ card.skip_event! :validate_renaming, :check_permissions
170
+ card.content = card.replace_reference_syntax name_before_last_save, name
171
+ attach_subcard card
172
172
  end
173
173
  end
174
174
 
@@ -1,4 +1,4 @@
1
- event :rename_in_trash, after: :set_name, on: :update do
1
+ event :rename_in_trash, after: :expire_old_name, on: :update do
2
2
  existing_card = Card.find_by_key_and_trash name.key, true
3
3
  return if !existing_card || existing_card == self
4
4
  existing_card.name = existing_card.name + "*trash"
@@ -28,7 +28,8 @@ event :cascade_name_changes, :finalize, on: :update, changed: :name,
28
28
  newname = child.name.swap name_before_last_save, name
29
29
  # not sure if this is still needed since we attach the children as subcards
30
30
  # (it used to be resolved right here without adding subcards)
31
- Card.expire child.name
31
+ ActManager.expirees << child.name
32
+ child.skip_event! :check_permissions
32
33
 
33
34
  # superleft has to be the first argument. Otherwise the call of `name=` in
34
35
  # `assign_attributes` can cause problems because `left` doesn't find the new left.