Commit 24ddbefb authored by JC Brand's avatar JC Brand

Pass model's whole JSON to nickname form

Not strictly necessary for vanilla Converse, but makes life easier
downstream
parent 8ef3b10d
...@@ -1103,14 +1103,14 @@ export const ChatRoomView = ChatBoxView.extend({ ...@@ -1103,14 +1103,14 @@ export const ChatRoomView = ChatBoxView.extend({
* @method _converse.ChatRoomView#renderNicknameForm * @method _converse.ChatRoomView#renderNicknameForm
*/ */
renderNicknameForm () { renderNicknameForm () {
const tmp_result = tpl_muc_nickname_form(this.model.get('nick')); const tpl_result = tpl_muc_nickname_form(this.model.toJSON());
if (api.settings.get('muc_show_logs_before_join')) { if (api.settings.get('muc_show_logs_before_join')) {
const container = this.el.querySelector('.muc-bottom-panel'); const container = this.el.querySelector('.muc-bottom-panel');
render(tmp_result, container); render(tpl_result, container);
u.addClass('muc-bottom-panel--nickname', container); u.addClass('muc-bottom-panel--nickname', container);
} else { } else {
const form = this.el.querySelector('.muc-nickname-form'); const form = this.el.querySelector('.muc-nickname-form');
const form_el = u.getElementFromTemplateResult(tmp_result); const form_el = u.getElementFromTemplateResult(tpl_result);
if (form) { if (form) {
sizzle('.spinner', this.el).forEach(u.removeElement); sizzle('.spinner', this.el).forEach(u.removeElement);
form.outerHTML = form_el.outerHTML; form.outerHTML = form_el.outerHTML;
......
...@@ -3,7 +3,7 @@ import { api } from "@converse/headless/converse-core"; ...@@ -3,7 +3,7 @@ import { api } from "@converse/headless/converse-core";
import { html } from "lit-html"; import { html } from "lit-html";
export default (nickname) => { export default (o) => {
const i18n_nickname = __('Nickname'); const i18n_nickname = __('Nickname');
const i18n_join = __('Enter groupchat'); const i18n_join = __('Enter groupchat');
const i18n_heading = api.settings.get('muc_show_logs_before_join') ? const i18n_heading = api.settings.get('muc_show_logs_before_join') ?
...@@ -15,7 +15,7 @@ export default (nickname) => { ...@@ -15,7 +15,7 @@ export default (nickname) => {
<form class="converse-form chatroom-form converse-centered-form"> <form class="converse-form chatroom-form converse-centered-form">
<fieldset class="form-group"> <fieldset class="form-group">
<label>${i18n_heading}</label> <label>${i18n_heading}</label>
<input type="text" required="required" name="nick" value="${nickname || ''}" <input type="text" required="required" name="nick" value="${o.nick || ''}"
class="form-control" placeholder="${i18n_nickname}"/> class="form-control" placeholder="${i18n_nickname}"/>
</fieldset> </fieldset>
<fieldset class="form-group"> <fieldset class="form-group">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment