popovers: Add a clear status option in user popover.

Accomplished by adding a function to clear the status message with
an empty string. The html is then updated to reflect changes without a
refresh.

Currently, it's a small hassle to clear a status message.  This option
makes things a bit easier.

Fixes #11630.
This commit is contained in:
Wyatt Hoodes
2019-02-22 13:46:51 -10:00
committed by Tim Abbott
parent 3697add70c
commit 5231b27dea
3 changed files with 18 additions and 1 deletions

View File

@@ -771,6 +771,18 @@ exports.register_click_handlers = function () {
e.preventDefault(); e.preventDefault();
}); });
$('body').on('click', '.info_popover_actions .clear_status', function (e) {
e.preventDefault();
var me = $(e.target).parents('ul').attr('data-user-id');
user_status.server_update({
user_id: me,
status_text: '',
success: function () {
$('.info_popover_actions #status_message').html('');
},
});
});
$('body').on('click', '#user-profile-modal #name #edit-button', function () { $('body').on('click', '#user-profile-modal #name #edit-button', function () {
exports.hide_user_profile(); exports.hide_user_profile();
}); });

View File

@@ -62,7 +62,10 @@
{{#if status_text}} {{#if status_text}}
{{#unless is_me}}<hr />{{/unless}} {{#unless is_me}}<hr />{{/unless}}
<li class="user_info_status_text"> <li class="user_info_status_text">
{{status_text}} <span id="status_message">
{{status_text}}
{{#if is_me}}(<a href="#" class="clear_status">{{#tr this}}clear{{/tr}}</a>){{/if}}
</span>
</li> </li>
{{/if}} {{/if}}

View File

@@ -126,6 +126,8 @@ IGNORED_PHRASES = [
r"^new_emoji$", r"^new_emoji$",
# Used to refer custom time limits # Used to refer custom time limits
r"\bN\b", r"\bN\b",
# Capital c feels obtrusive in clear status option
r"clear",
r"group private messages with __recipient__", r"group private messages with __recipient__",
r"private messages with __recipient__", r"private messages with __recipient__",