Commit Graph

93 Commits

Author SHA1 Message Date
Steve Howell bc20692a91 Prevent tracebacks when admin screens aren't loaded.
Various server events can be passed into admin.js before
the initial widgets have been set up.  This code short
circuits live update code when these events happen.

Note that live updates don't consistently work for the
admin pages before this fix (and after it), since don't
store data changes when the widgets aren't built.
2017-01-31 10:34:06 -08:00
Harshit Bansal b4186fdfdd views/realm_aliases.py: Use domain instead of id as handle for RealmAlias.
We need to make the change for the API, and the next commit introduces a
unique_together constraint on (realm, domain) anyway.
2017-01-26 17:24:25 -08:00
Harshit Bansal 06cc306d00 Add stricter domain validation and improve error messages. 2017-01-26 17:24:25 -08:00
Harshit Bansal f0e5380ff1 handlebar templates: Rename admin_alias_list to admin-alias-list. 2017-01-26 17:24:25 -08:00
Harshit Bansal 38c50a81ad admin settings: Restyle realm alias modal. 2017-01-26 17:24:25 -08:00
Harshit Bansal ec02599336 admin.js: Simplify wording around the restricted to domain setting.
Remove stringify_list_with_conjunction, which would have been tough for
i18n, and make it clear that the setting only affects new users.
2017-01-26 17:24:25 -08:00
Raghav Jajodia fc965eb5f6 admin: Add No-change-made message.
A 'no changes made' message is displayed whenever save-changes button
is clicked, albeit no changes are made in the admin page.
2017-01-25 23:10:14 -08:00
Tim Abbott 9bb390133b admin: Fix emoji creation.
f3b9abee14 apparently failed to update
the frontend.
2017-01-17 00:21:32 -08:00
Rafid Aslam d3ee53bdef Move endpoints to use stream_id instead of stream_name in their URLs
- Change `stream_name` into `stream_id` on some API endpoints that use
`stream_name` in their URLs to prevent confusion of `views` selection.

For example:
If the stream name is "foo/members", the URL would be trigger
"^streams/(?P<stream_name>.*)/members$" and it would be confusing because
we intend to use the endpoint with "^streams/(?P<stream_name>.*)$" regex.

All stream-related endpoints now use stream id instead of stream name,
except for a single endpoint that lets you convert stream names to stream ids.

See https://github.com/zulip/zulip/issues/2930#issuecomment-269576231

- Add `get_stream_id()` method to Zulip API client, and change
`get_subscribers()` method to comply with the new stream API
(replace `stream_name` with `stream_id`).

Fixes #2930.
2017-01-12 15:23:31 -08:00
Rafid Aslam ead32b179c Add missing `encodeURIComponent()` on some API uses
Fixes #2930.
2017-01-12 15:23:31 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Harshit Bansal ceb636dbd9 Manage allowed domains from admin settings.
Fixes: #1867.
2017-01-06 12:03:31 -08:00
Jackson 6ec8abab86 Clean PUT /default_streams to POST /default_streams. 2017-01-03 15:40:00 -08:00
paxapy 8e7fa6b2de emoji: Add add_emoji_by_admins_only realm setting.
This setting controls whether normal users can add realm emoji.

Fixes #978.
2016-12-27 15:46:14 -08:00
Igor Tokarev 3cb7d665da emoji: Display emoji author in admin interface.
Fixes: #984.
2016-12-27 15:45:55 -08:00
Tim Abbott e538d7ef03 admin: Fix waiting period status UI not hiding. 2016-12-21 13:19:40 -08:00
Tim Abbott 7cd3a5873d admin: Remove unnecessary set_up_deactivate_user_modal. 2016-12-15 18:18:26 -08:00
Brock Whittaker d20e643c59 admin: Fix Deactivate/Reactivate User Buttons.
This fixes the behavior to be consistent and remove the “Working…” bug.
2016-12-15 18:17:07 -08:00
vaibhav 75bf501553 Add optional waiting period for users to create streams.
This adds support for only allowing normal users with account age
equal or greater than a "waiting period" threshold to create streams;
this is useful for open organizations that want new members to
understand the community before creating streams.

If create_stream_by_admins_only setting is set to True, only admin users
were able to create streams. Now normal users with account age greater
or equal than waiting period threshold can also create streams.

Account age is defined as number of days passed since the user had
created his account.

Fixes: #2308.

Tweaked by tabbott to clean up the actual can_create_streams logic and
the tests.
2016-12-15 16:54:30 -08:00
Rafid Aslam 45f39be37f lint: Fix many no-unused-vars eslint rule violations.
These have been carefully audited by tabbott to ensure they are
unlikely to cause regressions.
2016-12-14 21:34:51 -08:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
lonerz abde152d9c eslint: change array-callback-return from warning to error. 2016-12-05 21:21:19 -08:00
lonerz dc6849952b eslint: change space-before-function-paren from warning to error.
Also fix violations.
2016-12-05 09:50:37 -08:00
AZtheAsian 5e9918135b eslint: change quote-props from off to error and fix violations. 2016-12-02 18:35:53 -08:00
Krzysztof Zbudniewek b8fc3f0e65 eslint: change space-before-blocks from warning to error and fix violations 2016-12-02 17:40:09 -08:00
AZtheAsian 9c0ebc7359 eslint: change no-else-return to error and fix violations 2016-12-02 14:43:09 -08:00
Tommy Ip b3f4feb996 eslint: change max-len from warning to error and fix violations. 2016-12-02 14:16:33 +00:00
kevv87 e6369fc29b eslint: change no-plusplus from warning to 2 and fix violations. 2016-12-01 14:27:17 -08:00
Vladislav Manchev d7e1e4a2c0 Add initial implementation of custom realm filters.
This PR was abandoned by Vladislav and then substantially modified by
Igor Tokarev and Tim Abbott to complete it and fix a number of bugs.

Fixes #544.
2016-11-17 17:11:25 -08:00
Steve Howell 26857ac3aa admin: Use helpers when opening user form. 2016-11-15 09:37:47 -08:00
Steve Howell 7656c31769 Extract admin.get_email_for_user_row(). 2016-11-15 09:37:47 -08:00
Steve Howell 33a87492e2 admin: Remove obsolete active_user_row class. 2016-11-15 09:37:47 -08:00
Steve Howell ecfac010fc Extract admin.set_up_deactivate_user_modal().
This sets us up to eliminate the "active_user_row" hacks in
our next commit.
2016-11-15 09:37:47 -08:00
Steve Howell dcfb5c30c6 admin users: Fix real-time-sync for full names.
When an ordinary user changes their name, the admin sees the change
when they open the edit form now.
2016-11-15 09:37:47 -08:00
umkay f4c621ffe3 admin: Enable admins to toggle supported auth methods via UI.
Add a table to the administration page that will allow realm admins to
activate and deactivate the supported authentication methods for that
realm.
2016-11-06 16:29:35 -08:00
Brock Whittaker fd9a3f4609 admin: Remove values from emoji form input on success.
This removes the values after successfully creating a new realm emoji.
2016-10-25 17:01:03 -07:00
Rishi Gupta b6da450b96 admin.js: Use RealmAlias instead of Realm to show the restricted domains.
Passes the allowed domains for a realm to the frontend, via
page_params.domains. Groundwork for allowing users to add and
remove domains via the admin setting page, rather than via the
realm_alias.py management command.
2016-10-25 10:07:20 -07:00
Umair Khan 36c6a5d758 Add support for changing user's name by admin.
Fixes: #1553
2016-10-11 16:36:48 -07:00
Brock Whittaker 3a4fff837f Identify if an emoji URL is invalid and signal an error.
Previously, no error would display in the UI if the link to the emoji
image was invalid. This would happen for instance if you put in
“invalid” for the Emoji URL. No alerts would pop up but it would refuse
to add the emoji.

This catches the error and displays a notification that looks like
“Failed: Enter a valid URL.”

Fixes #1116.
2016-09-26 20:52:45 -07:00
Brock Whittaker 706f422c3a Massively refactor settings page templates and styling.
This restructures the styling for the Zulip settings and
administration pages to minimize use of Bootstrap and use a consistent
styling library for similar elements.

While it is basically a wash in terms of the page's visuals, it will
make our life a lot easier for future work on improving the settings
pages section of the site.
2016-09-19 21:55:06 -07:00
Brock Whittaker e52d618f1b Switching from $.parseJSON to JSON.parse.
There are no modern browsers that do not have built in JSON parsing
abilities. We do not need $.parseJSON as it now just serves as a call
to JSON.parse.
2016-08-25 14:22:48 -07:00
ukhan dced137f6f Fix function formatting in admin.js 2016-08-09 17:52:25 -07:00
Rag Sagar 2fef36f15a Add realm-level default language setting.
Adds a new field default language in the zerver_realm model.
This realm level default language will be used as default language
for newly created users. Realm level default language can be
changed from the administration page.

Fixes #1372.
2016-08-09 17:38:29 -07:00
Tim Abbott 469df75ab7 Fix admin.update_default_streams_table errors if tab not open.
It turns out that our logic for updating the default streams table
crashed in the case where the administration tab was not open.

Fixes: #1540.
2016-08-09 11:59:32 -07:00
Rishi Gupta d529a94e4d Add realm setting to time-limit editing of message content.
This is controlled through the admin tab and a new field in the Realms table.
Notes:
* The admin tab setting takes a value in minutes, whereas the backend stores it
  in seconds.
* This setting is unused when allow_message_editing is false.
* There is some generosity in how the limit is enforced. For instance, if the
  user sees the hovering edit button, we ensure they have at least 5 seconds to
  click it, and if the user gets to the message edit form, we ensure they have
  at least 10 seconds to make the edit, by relaxing the limit.
* This commit also includes a countdown timer in the message edit form.

Resolves #903.
2016-07-15 13:55:49 -07:00
Rishi Gupta 235162e000 admin.js: Rename overloaded variable.
We were using data for both the request and response data in
$(".administration").on("submit", "form.admin-realm-form".
Left the request data as data to be consistent with the rest of the
file, renamed the response data to response_data.
2016-07-12 17:41:48 -07:00
Rishi Gupta 43c2f35776 Add realm setting to disable message editing.
This is controlled through the admin tab and a new field in the Realms
table.  This mirrors the behavior of the old hardcoded setting
feature_flags.disable_message_editing.  Partially resolves #903.
2016-07-10 11:57:24 -07:00
Umair Khan 939ebbbc98 Mark report_error arguments translatable. 2016-06-23 16:23:01 -07:00
Umair Khan 4da1a3ecd6 Mark report_success arguments translatable. 2016-06-23 16:23:01 -07:00
Umair Khan c61a3dfbcc Ensure translations are loaded.
Since i18next loads translations asynchronously we need to make sure
that they are loaded before we call the JS code which depends on them.

Fixes #982
2016-06-20 11:31:28 -07:00