From 9e8d69739f21e5ac85977d57a2a6c961e318c26e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 10 Nov 2021 20:44:51 +0300 Subject: add two helper account access levels: - read only - can't subscribe to more feeds, feed updates are skipped - disabled - can't login define used access levels as UserHelper constants and refactor code to use them instead of hardcoded numbers --- js/CommonDialogs.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'js/CommonDialogs.js') diff --git a/js/CommonDialogs.js b/js/CommonDialogs.js index a68dc8068..4c169b026 100644 --- a/js/CommonDialogs.js +++ b/js/CommonDialogs.js @@ -131,6 +131,9 @@ const CommonDialogs = { console.log(rc); switch (parseInt(rc['code'])) { + case 0: + dialog.show_error(__("You are already subscribed to this feed.")); + break; case 1: dialog.hide(); Notify.info(__("Subscribed to %s").replace("%s", feed_url)); @@ -175,8 +178,11 @@ const CommonDialogs = { case 6: dialog.show_error(__("XML validation failed: %s").replace("%s", rc['message'])); break; - case 0: - dialog.show_error(__("You are already subscribed to this feed.")); + case 7: + dialog.show_error(__("Error while creating feed database entry.")); + break; + case 8: + dialog.show_error(__("You are not allowed to perform this operation.")); break; } @@ -451,6 +457,7 @@ const CommonDialogs = { xhr.json("backend.php", {op: "pref-feeds", method: "editfeed", id: feed_id}, (reply) => { const feed = reply.feed; + const is_readonly = reply.user.access_level == App.UserAccessLevels.ACCESS_LEVEL_READONLY; // for unsub prompt dialog.feed_title = feed.title; @@ -524,7 +531,9 @@ const CommonDialogs = {
- ${App.FormFields.select_hash("update_interval", feed.update_interval, reply.intervals.update)} + ${App.FormFields.select_hash("update_interval", is_readonly ? -1 : feed.update_interval, + reply.intervals.update, + {disabled: is_readonly})}
-- cgit v1.2.3