Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAM Refactor #3599

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

MAM Refactor #3599

wants to merge 3 commits into from

Conversation

jcbrand
Copy link
Member

@jcbrand jcbrand commented Feb 27, 2025

No description provided.

stx`<field var="with"><value>${options.mam?.with}</value></field>` : '' }
${!extended_support && attrs.start ?
stx`<field var="start"><value>${attrs.start}</value></field>` : '' }
${!extended_support && attrs.end ?

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (95% of all statements in
the enclosing function
have an explicit semicolon).

Copilot Autofix AI 2 days ago

To fix the problem, we need to add an explicit semicolon at the end of the line where the implicit semicolon insertion might occur. This will ensure that the code behaves as expected and follows the convention used in the rest of the codebase.

  • Add an explicit semicolon at the end of the line const iq_result = await api.sendIQ(stanza, timeout, false) in the file src/headless/plugins/mam/api.js.
Suggested changeset 1
src/headless/plugins/mam/api.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/headless/plugins/mam/api.js b/src/headless/plugins/mam/api.js
--- a/src/headless/plugins/mam/api.js
+++ b/src/headless/plugins/mam/api.js
@@ -282,3 +282,3 @@
             const timeout = api.settings.get('message_archiving_timeout');
-            const iq_result = await api.sendIQ(stanza, timeout, false)
+            const iq_result = await api.sendIQ(stanza, timeout, false);
             if (iq_result === null) {
EOF
@@ -282,3 +282,3 @@
const timeout = api.settings.get('message_archiving_timeout');
const iq_result = await api.sendIQ(stanza, timeout, false)
const iq_result = await api.sendIQ(stanza, timeout, false);
if (iq_result === null) {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
if (options.groupchat) {
if (from !== options['with']) {
if (options.is_groupchat) {
if (from !== options.mam?.with) {

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (95% of all statements in
the enclosing function
have an explicit semicolon).

Copilot Autofix AI 2 days ago

To fix the problem, we need to add an explicit semicolon at the end of the line const complete = fin?.getAttribute('complete') === 'true'. This will ensure that the statement is properly terminated and prevent any potential issues related to automatic semicolon insertion.

Suggested changeset 1
src/headless/plugins/mam/api.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/headless/plugins/mam/api.js b/src/headless/plugins/mam/api.js
--- a/src/headless/plugins/mam/api.js
+++ b/src/headless/plugins/mam/api.js
@@ -302,3 +302,3 @@
             const fin = iq_result && sizzle(`fin[xmlns="${NS.MAM}"]`, iq_result).pop();
-            const complete = fin?.getAttribute('complete') === 'true'
+            const complete = fin?.getAttribute('complete') === 'true';
             const set = sizzle(`set[xmlns="${NS.RSM}"]`, fin).pop();
EOF
@@ -302,3 +302,3 @@
const fin = iq_result && sizzle(`fin[xmlns="${NS.MAM}"]`, iq_result).pop();
const complete = fin?.getAttribute('complete') === 'true'
const complete = fin?.getAttribute('complete') === 'true';
const set = sizzle(`set[xmlns="${NS.RSM}"]`, fin).pop();
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@jcbrand jcbrand force-pushed the jcbrand/mam-refactor branch 4 times, most recently from 9de8961 to 079c685 Compare February 28, 2025 20:58
jcbrand added 3 commits March 2, 2025 21:40
- Remove the `fetchMessagesOnScrollUp` event handler. Instead messages will be fetched as the placeholder comes into view.
- Clarify types and distinguish between MAM query options and RSM query options.
- Improve error handling
- Remove support for mam2:#extended querying
    It's too much of a headache with patchy server support.
    Instead, use RSM's `<before>some-id</before>` together with `start` to
    bracket queries for placeholders.

- Create a placeholder after restoring cached messages
    This placeholder will automatically fetch older messages when the user scrolls up.

- Create new config option `auto_fill_history_gaps`
@jcbrand jcbrand force-pushed the jcbrand/mam-refactor branch from 079c685 to f80d331 Compare March 2, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant