js: replace <meta> tags with <body> data attributes.
Refactor things to store information about the current user as data attributes on the <body> tag rather than as <meta> tags. These <meta> tags are now deprecated and will be eventually removed. * Store all of the current user's API attributes as data attributes on the <body> tag. * Add `CurrentUser.data` for getting data from the <body> tag, and use it instead of `Utility.meta`. * Add `CurrentUser.update` for updating the current user's settings. * Fix a bug with the user named "Anonymous" not being able to edit notes.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Cookie from './cookie'
|
||||
import Utility from './utility'
|
||||
import CurrentUser from './current_user'
|
||||
|
||||
$(function() {
|
||||
$("#hide-upgrade-account-notice").on("click.danbooru", function(e) {
|
||||
@@ -21,16 +21,10 @@ $(function() {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$("#desktop-version-link a").on("click.danbooru", function(e) {
|
||||
$("#desktop-version-link a").on("click.danbooru", async function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax("/users/" + Utility.meta("current-user-id") + ".json", {
|
||||
method: "PUT",
|
||||
data: {
|
||||
"user[disable_responsive_mode]": "true"
|
||||
}
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
await CurrentUser.update({ disable_responsive_mode: true });
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user