Commit Graph

31 Commits

Author SHA1 Message Date
evazion
a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00
evazion
00ca7526bb docs: add remaining docs for classes in app/logical. 2021-06-24 01:31:41 -05:00
evazion
921dde6522 users: don't set inviter field; clear inviter field for most users.
* Don't set the inviter field for newly promoted users, or for Gold/Plat
  upgrades.

* Clear the inviter field for paid Gold/Plat upgrades, and for users who
  have a feedback or a modaction listing who invited them. This leaves
  about 600 remaining users with an inviter field with no other record
  of who invited them.

See #4750.
2021-03-08 03:16:34 -06:00
evazion
058d71aa30 user upgrades: send dmail to purchaser for gifted upgrades.
* Refactor to move upgrade logic from UserPromotion to UserUpgrade.
* Send the recipient and the purchaser of a gifted upgrade separate
  dmail notifications.
2020-12-25 00:43:58 -06:00
evazion
dbb66ace90 routes: replace hardcoded routes in models with route helpers.
Add a Routes module that gives models access to route helpers outside of
views, and use it to replace various hardcoded routes.
2020-12-24 00:17:19 -06:00
evazion
d8b51e3f02 users: don't allow gifting upgrades to demote privileged users.
Don't allow gifting Gold or Platinum upgrades to users above Platinum
level. Fixes an exploit where you could demote Builders and above by
gifting them an upgrade.
2020-12-13 21:21:08 -06:00
evazion
c82e05d828 users: add stricter checks for user promotions.
New rules for user promotions:

* Moderators can no longer promote other users to moderator level. Only
  Admins can promote users to Mod level. Mods can only promote up to Builder level.
* Admins can no longer promote other users to Admin level. Only Owners
  can promote users to Admin. Admins can only promote up to Mod level.
* Admins can no longer demote themselves or other admins.

These rules are being changed to account for the new Owner user level.

Also change it so that when a user upgrades their account, the promotion
is done by DanbooruBot. This means that the inviter and the mod action
will show DanbooruBot as the promoter instead of the user themselves.
2020-12-13 21:21:08 -06:00
evazion
85f464df83 Fix #4540: Demotion sends "You have been promoted" dmail.
Change message to "Your account has been updated". It's possible for a
user to both gain and lose permissions at the same time, so just say
their account has been updated to make it easier.
2020-07-13 19:25:29 -05:00
evazion
b4ce2d83a6 models: remove belongs_to_creator macro.
The belongs_to_creator macro was used to initialize the creator_id field
to the CurrentUser. This made tests complicated because it meant you had
to create and set the current user every time you wanted to create an
object, when lead to the current user being set over and over again. It
also meant you had to constantly be aware of what the CurrentUser was in
many different contexts, which was often confusing. Setting creators
explicitly simplifies everything greatly.
2020-01-21 00:09:38 -06:00
evazion
7694be9cb3 users: remove no_flagging and no_feedback permissions. 2019-12-24 10:24:15 -06:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
Albert Yi
4706cae114 Add user permissions for flagging and for giving user feedback 2018-12-11 17:08:31 -08:00
evazion
6ff70c5002 mod actions: separate account upgrades from promotions (fix #3841) 2018-08-26 11:12:04 -05:00
BrokenEagle
3c45273694 Add category for mod actions 2018-01-13 20:55:52 -08:00
r888888888
3c30e30dc8 fix listbooru reference 2017-03-17 16:44:02 -07:00
evazion
b1af644f67 dmails: send automated dmails from Danbooru.config.system_user.
Sends automated dmails from `Danbooru.config.system_user`, rather than
whichever user is performing the action happens to be (usually User.admins.first).

Also adds a notice in the view that the dmail was automated.
2017-02-23 22:51:17 -06:00
r888888888
6ca83a2f3c fixes #2890: Danbooru account upgrades reset permissions 2017-02-21 12:39:45 -08:00
r888888888
f374eec4a1 fixes #2869: Add way to differentiate Pool Descriptions from Pool History 2017-02-14 16:03:19 -08:00
r888888888
aa41c41572 fixes #2876: Changing approver/contributor privileges should log mod action 2017-02-14 12:46:54 -08:00
Albert Yi
5a1ac41450 eliminate transaction log items table 2016-12-21 15:00:59 -08:00
r888888888
3829dc6a11 further level-gate saved search updates on listbooru 2015-12-30 11:54:26 -08:00
Toks
5ded553a8b #2470 keep track of what was gained/lost 2015-10-28 10:35:17 -04:00
r888888888
b695a7980f unify user notifications for permission/level changes #2470 2015-10-27 11:12:05 -07:00
r888888888
3a81f1ee8e fixes #2470: Neutral records to keep track of permissions 2015-10-26 14:27:34 -07:00
r888888888
5a853bcedb tweaks to new can_upload_free flag #2469 2015-10-15 16:23:30 -07:00
Toks
27101cf5d9 #2408 create feedback on promotion; don't send duplicate dmails 2015-06-13 10:31:12 -04:00
r888888888
cbf48ad948 add stripe integration for safebooru 2014-11-06 17:03:17 -08:00
Toks
055d0eecd3 Remove redundant promoter name from user feedback
Feedbacks already keep track of who created them so it doesn't need to
be in the body too
2014-04-30 21:18:18 -04:00
r888888888
89a59b1b01 fix bug with user promotions 2014-03-10 17:16:50 -07:00
r888888888
37d75e4a88 Fixes #1266 2014-03-05 17:53:26 -08:00
r888888888
56ae78f963 refactored user promotion code, related to #1257 2014-03-05 17:44:07 -08:00