Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
ef0304be
Commit
ef0304be
authored
10 years ago
by
Matthew Hodgson
Committed by
Emmanuel ROHEE
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
disable broken event dup suppression, and fix echo for /me
parent
dd2ae641
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webclient/components/matrix/event-handler-service.js
+9
-2
9 additions, 2 deletions
webclient/components/matrix/event-handler-service.js
webclient/room/room-controller.js
+16
-14
16 additions, 14 deletions
webclient/room/room-controller.js
with
25 additions
and
16 deletions
webclient/components/matrix/event-handler-service.js
+
9
−
2
View file @
ef0304be
...
...
@@ -79,7 +79,8 @@ angular.module('eventHandlerService', [])
initRoom
(
event
.
room_id
);
if
(
isLiveEvent
)
{
if
(
event
.
user_id
===
matrixService
.
config
().
user_id
)
{
if
(
event
.
user_id
===
matrixService
.
config
().
user_id
&&
(
event
.
content
.
msgtype
===
"
m.text
"
||
event
.
content
.
msgtype
===
"
m.emote
"
)
)
{
// assume we've already echoed it
// FIXME: track events by ID and ungrey the right message to show it's been delivered
}
...
...
@@ -162,11 +163,17 @@ angular.module('eventHandlerService', [])
NAME_EVENT
:
NAME_EVENT
,
handleEvent
:
function
(
event
,
isLiveEvent
)
{
// FIXME: event duplication suppression is all broken as the code currently expect to handles
// events multiple times to get their side-effects...
/*
if (eventMap[event.event_id]) {
console.log("discarding duplicate event: " + JSON.stringify(event));
return;
}
else {
eventMap[event.event_id] = 1;
}
*/
if
(
event
.
type
.
indexOf
(
'
m.call.
'
)
===
0
)
{
handleCallEvent
(
event
,
isLiveEvent
);
}
...
...
This diff is collapsed.
Click to expand it.
webclient/room/room-controller.js
+
16
−
14
View file @
ef0304be
...
...
@@ -302,7 +302,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
scrollToBottom
(
true
);
var
promise
;
var
isCmd
=
false
;
var
cmd
;
var
args
;
var
echo
=
false
;
// Check for IRC style commands first
var
line
=
$scope
.
textInput
;
...
...
@@ -311,17 +313,16 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
line
=
line
.
replace
(
/
\s
+$/
,
""
);
if
(
line
[
0
]
===
"
/
"
&&
line
[
1
]
!==
"
/
"
)
{
isCmd
=
true
;
var
bits
=
line
.
match
(
/^
(\S
+
?)(
+
(
.*
))?
$/
);
var
cmd
=
bits
[
1
];
var
args
=
bits
[
3
];
cmd
=
bits
[
1
];
args
=
bits
[
3
];
console
.
log
(
"
cmd:
"
+
cmd
+
"
, args:
"
+
args
);
switch
(
cmd
)
{
case
"
/me
"
:
promise
=
matrixService
.
sendEmoteMessage
(
$scope
.
room_id
,
args
);
echo
=
true
;
break
;
case
"
/nick
"
:
...
...
@@ -453,17 +454,20 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
}
// By default send this as a message unless it's an IRC-style command
if
(
!
promise
&&
!
isCmd
)
{
var
message
=
$scope
.
textInput
;
$scope
.
textInput
=
""
;
if
(
!
promise
&&
!
cmd
)
{
// Make the request
promise
=
matrixService
.
sendTextMessage
(
$scope
.
room_id
,
line
);
echo
=
true
;
}
if
(
echo
)
{
// Echo the message to the room
// To do so, create a minimalist fake text message event and add it to the in-memory list of room messages
var
echoMessage
=
{
content
:
{
body
:
message
,
body
:
(
cmd
===
"
/me
"
?
args
:
line
)
,
hsob_ts
:
new
Date
().
getTime
(),
// fake a timestamp
msgtype
:
"
m.text
"
msgtype
:
(
cmd
===
"
/me
"
?
"
m.emote
"
:
"
m.text
"
),
},
room_id
:
$scope
.
room_id
,
type
:
"
m.room.message
"
,
...
...
@@ -472,11 +476,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
// echo_msg_state: "messagePending" // Add custom field to indicate the state of this fake message to HTML
};
$scope
.
textInput
=
""
;
$rootScope
.
events
.
rooms
[
$scope
.
room_id
].
messages
.
push
(
echoMessage
);
scrollToBottom
();
// Make the request
promise
=
matrixService
.
sendTextMessage
(
$scope
.
room_id
,
message
);
}
if
(
promise
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment