Adding configurable url history changing
This commit is contained in:
parent
4870d41aae
commit
1cb2b1f7a9
|
@ -7,6 +7,7 @@
|
||||||
- #2348: `auto_join_room` not showing the room in `fullscreen` `view_mode`.
|
- #2348: `auto_join_room` not showing the room in `fullscreen` `view_mode`.
|
||||||
- #2400: Fixes infinite loop bug when appending .png to allowed image urls
|
- #2400: Fixes infinite loop bug when appending .png to allowed image urls
|
||||||
- #2409: Integrate App Badging API for unread messages
|
- #2409: Integrate App Badging API for unread messages
|
||||||
|
- #2464: New configuration setting [allow-url-history-change](https://conversejs.org/docs/html/configuration.html#allow-url-history-change)
|
||||||
- Add support for XEP-0437 Room Activity Indicators see [muc-subscribe-to-rai](https://conversejs.org/docs/html/configuration.html#muc-subscribe-to-rai)
|
- Add support for XEP-0437 Room Activity Indicators see [muc-subscribe-to-rai](https://conversejs.org/docs/html/configuration.html#muc-subscribe-to-rai)
|
||||||
- Bugfix: Use real JID in XEP-0372 references only when the MUC is non-anonymous
|
- Bugfix: Use real JID in XEP-0372 references only when the MUC is non-anonymous
|
||||||
- Bugfix: Connection protocol not updated based on XEP-0156 connection methods
|
- Bugfix: Connection protocol not updated based on XEP-0156 connection methods
|
||||||
|
|
|
@ -250,6 +250,12 @@ Support for `XEP-0077: In band registration <https://xmpp.org/extensions/xep-007
|
||||||
|
|
||||||
Allow XMPP account registration showing the corresponding UI register form interface.
|
Allow XMPP account registration showing the corresponding UI register form interface.
|
||||||
|
|
||||||
|
allow_url_history_change
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
* Default: ``true``
|
||||||
|
|
||||||
|
Allow Converse to change the browser url bar through the History API <https://developer.mozilla.org/en-US/docs/Web/API/History_API>.
|
||||||
|
|
||||||
allow_user_trust_override
|
allow_user_trust_override
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
|
@ -15,6 +15,7 @@ let user_settings; // User settings, populated via api.users.settings
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
export const DEFAULT_SETTINGS = {
|
export const DEFAULT_SETTINGS = {
|
||||||
allow_non_roster_messaging: false,
|
allow_non_roster_messaging: false,
|
||||||
|
allow_url_history_change: true,
|
||||||
assets_path: '/dist',
|
assets_path: '/dist',
|
||||||
authentication: 'login', // Available values are "login", "prebind", "anonymous" and "external".
|
authentication: 'login', // Available values are "login", "prebind", "anonymous" and "external".
|
||||||
auto_login: false, // Currently only used in connection with anonymous login
|
auto_login: false, // Currently only used in connection with anonymous login
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { fetchArchivedMessages } from '@converse/headless/plugins/mam/utils';
|
import { fetchArchivedMessages } from '@converse/headless/plugins/mam/utils';
|
||||||
import { _converse } from '@converse/headless/core';
|
import { _converse, api } from '@converse/headless/core';
|
||||||
|
|
||||||
export async function fetchMessagesOnScrollUp (view) {
|
export async function fetchMessagesOnScrollUp (view) {
|
||||||
if (view.model.messages.length) {
|
if (view.model.messages.length) {
|
||||||
|
@ -15,7 +15,9 @@ export async function fetchMessagesOnScrollUp (view) {
|
||||||
await fetchArchivedMessages(view.model, { 'end': oldest_message.get('time') });
|
await fetchArchivedMessages(view.model, { 'end': oldest_message.get('time') });
|
||||||
}
|
}
|
||||||
view.clearSpinner();
|
view.clearSpinner();
|
||||||
|
if (api.settings.get('allow_url_history_change')) {
|
||||||
_converse.router.history.navigate(`#${oldest_message.get('msgid')}`);
|
_converse.router.history.navigate(`#${oldest_message.get('msgid')}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -120,10 +120,12 @@ export default class MUCChatArea extends CustomElement {
|
||||||
onScrolledDown () {
|
onScrolledDown () {
|
||||||
if (!this.model.isHidden()) {
|
if (!this.model.isHidden()) {
|
||||||
this.model.clearUnreadMsgCounter();
|
this.model.clearUnreadMsgCounter();
|
||||||
|
if (api.settings.get('allow_url_history_change')) {
|
||||||
// Clear location hash if set to one of the messages in our history
|
// Clear location hash if set to one of the messages in our history
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
hash && this.model.messages.get(hash.slice(1)) && _converse.router.history.navigate();
|
hash && this.model.messages.get(hash.slice(1)) && _converse.router.history.navigate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Triggered once the chat's message area has been scrolled down to the bottom.
|
* Triggered once the chat's message area has been scrolled down to the bottom.
|
||||||
* @event _converse#chatBoxScrolledDown
|
* @event _converse#chatBoxScrolledDown
|
||||||
|
|
|
@ -209,10 +209,12 @@ export default class BaseChatView extends ElementView {
|
||||||
this.hideNewMessagesIndicator();
|
this.hideNewMessagesIndicator();
|
||||||
if (!this.model.isHidden()) {
|
if (!this.model.isHidden()) {
|
||||||
this.model.clearUnreadMsgCounter();
|
this.model.clearUnreadMsgCounter();
|
||||||
|
if (api.settings.get('allow_url_history_change')) {
|
||||||
// Clear location hash if set to one of the messages in our history
|
// Clear location hash if set to one of the messages in our history
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
hash && this.model.messages.get(hash.slice(1)) && _converse.router.history.navigate();
|
hash && this.model.messages.get(hash.slice(1)) && _converse.router.history.navigate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Triggered once the chat's message area has been scrolled down to the bottom.
|
* Triggered once the chat's message area has been scrolled down to the bottom.
|
||||||
* @event _converse#chatBoxScrolledDown
|
* @event _converse#chatBoxScrolledDown
|
||||||
|
|
Loading…
Reference in New Issue
Block a user