based-a-tron 2 tahun lalu
induk
melakukan
2ff9ad4aba

+ 0 - 1
src/headless/plugins/blocking/api.js

@@ -1,6 +1,5 @@
 import log from '@converse/headless/log.js';
 import { _converse, api, converse } from "@converse/headless/core.js";
-import { setLastStanzaDate } from './utils.js';
 
 const { Strophe, $iq, sizzle, u } = converse.env;
 

+ 2 - 1
src/headless/plugins/chat/model.js

@@ -1102,7 +1102,8 @@ const ChatBox = ModelWithContact.extend({
             } else if ( this.isHidden() ||
                         ( _converse.pluggable.plugins['converse.blocking'] &&
                           api.blockedUsers()?.has(message?.get('from_real_jid'))
-                        ) {
+                        )
+                      ) {
                 this.incrementUnreadMsgsCounter(message);
             } else {
                 this.sendMarkerForMessage(message);

+ 3 - 3
src/plugins/muc-views/modals/templates/occupant.js

@@ -4,7 +4,7 @@ import { html } from "lit";
 import { until } from 'lit/directives/until.js';
 import { setRole, verifyAndSetAffiliation } from "../../utils.js"
 import { showOccupantModal } from '../../utils.js';
-import { _converse, api, converse } from "@converse/headless/core";
+import { _converse, api } from "@converse/headless/core";
 
 export const tpl_footer = (el) => {
     const model = el.model ?? el.message;
@@ -18,7 +18,6 @@ export const tpl_footer = (el) => {
     const role = model.get('role') ?? 'none';
     const affiliation = model.get('affiliation');
 
-    const ownRole = muc.getOwnRole();
     const ownAffiliation = muc.getOwnAffiliation();
 
     let handleBlock = (ev) => {
@@ -80,7 +79,8 @@ export const tpl_footer = (el) => {
     const adminButton = html`<button class='btn btn-primary' @click=${handleAdmin}>Make Admin</button>`
     const ownerButton = html`<button class='btn btn-primary' @click=${handleOwner}>Make Owner</button>`
 
-    // The following table stores a map from Affiliation x Role -> Button
+    // The following table stores a map from
+    // OwnAffiliation x { Target User's Role x Target User's Affiliation } -> Button
     // Mapping to a button rather than a boolean provides us with a bit more
     // flexibility in how we determine the names for certain actions. See
     // the "Add to Chat" button vs the "Unban" button. They both represent

+ 2 - 2
src/plugins/muc-views/utils.js

@@ -133,7 +133,7 @@ export async function getAutoCompleteList () {
     return jids;
 }
 
-function setRole (muc, command, args, required_affiliations = [], required_roles = []) {
+export function setRole (muc, command, args, required_affiliations = [], required_roles = []) {
     const role = COMMAND_TO_ROLE[command];
     if (!role) {
         throw Error(`ChatRoomView#setRole called with invalid command: ${command}`);
@@ -156,7 +156,7 @@ function setRole (muc, command, args, required_affiliations = [], required_roles
 }
 
 
-function verifyAndSetAffiliation (muc, command, args, required_affiliations) {
+export function verifyAndSetAffiliation (muc, command, args, required_affiliations) {
     const affiliation = COMMAND_TO_AFFILIATION[command];
     if (!affiliation) {
         throw Error(`verifyAffiliations called with invalid command: ${command}`);

+ 1 - 1
src/plugins/notifications/utils.js

@@ -67,7 +67,7 @@ export async function shouldNotifyOfGroupMessage (attrs) {
     let is_mentioned = false;
     const nick = room.get('nick');
 
-    if { _converse.pluggable.plugins['converse-blocking']?.enabled(_converse) } {
+    if ( _converse.pluggable.plugins['converse-blocking']?.enabled(_converse) ) {
         // Don't show notifications for blocked users
         if (real_jid && api.blockedUsers()?.has(real_jid)) {
                 return false;

+ 3 - 3
src/shared/modals/templates/user-details.js

@@ -8,14 +8,14 @@ import { modal_close_button } from "plugins/modal/templates/buttons.js";
 const block_button = (o) => {
     const block_contact = "Block Contact";
     return html`
-        <button @click=${(ev) => api.blockUser([o.jid])}>Block</button>
+        <button @click=${(ev) => api.blockUser([o.jid])}>${block_contact}</button>
     `;
 }
 
 const unblock_button = (o) => {
-    const block_contact = "Block Contact";
+    const unblock_contact = "Unblock Contact";
     return html`
-        <button @click=${(ev) => api.unblockUser([o.jid])}>Unblock</button>
+        <button @click=${(ev) => api.unblockUser([o.jid])}>${unblock_contact}</button>
     `;
 }