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
Package registry
Container registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
04fdcf30
Commit
04fdcf30
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
Wired the recents list with the stream events for realtime update
parent
357dd187
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webclient/recents/recents-controller.js
+10
-9
10 additions, 9 deletions
webclient/recents/recents-controller.js
with
10 additions
and
9 deletions
webclient/recents/recents-controller.js
+
10
−
9
View file @
04fdcf30
...
@@ -25,22 +25,23 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService'])
...
@@ -25,22 +25,23 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService'])
// in order to highlight a specific room in the list
// in order to highlight a specific room in the list
$scope
.
recentsSelectedRoomID
;
$scope
.
recentsSelectedRoomID
;
// Refresh the list on matrix invitation and message event
$scope
.
$on
(
eventHandlerService
.
MEMBER_EVENT
,
function
(
ngEvent
,
event
,
isLive
)
{
$scope
.
$on
(
eventHandlerService
.
MEMBER_EVENT
,
function
(
ngEvent
,
event
,
isLive
)
{
var
config
=
matrixService
.
config
();
refresh
();
if
(
event
.
state_key
===
config
.
user_id
&&
event
.
content
.
membership
===
"
invite
"
)
{
});
console
.
log
(
"
Invited to room
"
+
event
.
room_id
);
$scope
.
$on
(
eventHandlerService
.
MSG_EVENT
,
function
(
ngEvent
,
event
,
isLive
)
{
// FIXME push membership to top level key to match /im/sync
refresh
();
event
.
membership
=
event
.
content
.
membership
;
// FIXME bodge a nicer name than the room ID for this invite.
event
.
room_display_name
=
event
.
user_id
+
"
's room
"
;
$scope
.
rooms
[
event
.
room_id
]
=
event
;
}
});
});
var
refresh
=
function
()
{
var
refresh
=
function
()
{
// List all rooms joined or been invited to
// List all rooms joined or been invited to
// TODO: This is a pity that event-stream-service.js makes the same call
// We should be able to reuse event-stream-service.js fetched data
matrixService
.
rooms
(
1
,
false
).
then
(
matrixService
.
rooms
(
1
,
false
).
then
(
function
(
response
)
{
function
(
response
)
{
// Reset data
$scope
.
rooms
=
{};
var
data
=
matrixService
.
assignRoomAliases
(
response
.
data
.
rooms
);
var
data
=
matrixService
.
assignRoomAliases
(
response
.
data
.
rooms
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
$scope
.
rooms
[
data
[
i
].
room_id
]
=
data
[
i
];
$scope
.
rooms
[
data
[
i
].
room_id
]
=
data
[
i
];
...
...
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