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
c44293db
Commit
c44293db
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
When opening this page, do not join a room already joined
parent
7c99ebdb
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/room/room-controller.js
+51
-26
51 additions, 26 deletions
webclient/room/room-controller.js
with
51 additions
and
26 deletions
webclient/room/room-controller.js
+
51
−
26
View file @
c44293db
...
...
@@ -282,7 +282,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput', 'mUtilities'])
}
if
(
room_id_or_alias
&&
'
!
'
===
room_id_or_alias
[
0
])
{
// Yes. We can
start
right now
// Yes. We can
go on
right now
$scope
.
room_id
=
room_id_or_alias
;
$scope
.
room_alias
=
matrixService
.
getRoomIdToAliasMapping
(
$scope
.
room_id
);
onInit2
();
...
...
@@ -313,7 +313,7 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput', 'mUtilities'])
$scope
.
room_id
=
response
.
data
.
room_id
;
console
.
log
(
"
-> Room ID:
"
+
$scope
.
room_id
);
// Now, we can
start
// Now, we can
go on
onInit2
();
},
function
()
{
...
...
@@ -323,36 +323,61 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput', 'mUtilities'])
});
}
};
var
onInit2
=
function
()
{
eventHandlerService
.
reInitRoom
(
$scope
.
room_id
);
// Make recents highlight the current room
$scope
.
recentsSelectedRoomID
=
$scope
.
room_id
;
// Join the room
matrixService
.
join
(
$scope
.
room_id
).
then
(
console
.
log
(
"
onInit2
"
);
// Make sure the initialSync has been before going further
eventHandlerService
.
waitForInitialSyncCompletion
().
then
(
function
()
{
console
.
log
(
"
Joined room
"
+
$scope
.
room_id
);
var
needsToJoin
=
true
;
// The room members is available in the data fetched by initialSync
if
(
$rootScope
.
events
.
rooms
[
$scope
.
room_id
])
{
var
members
=
$rootScope
.
events
.
rooms
[
$scope
.
room_id
].
members
;
// Update the member list
for
(
var
i
in
members
)
{
var
member
=
members
[
i
];
updateMemberList
(
member
);
}
// Get the current member list
matrixService
.
getMemberList
(
$scope
.
room_id
).
then
(
function
(
response
)
{
for
(
var
i
=
0
;
i
<
response
.
data
.
chunk
.
length
;
i
++
)
{
var
chunk
=
response
.
data
.
chunk
[
i
];
updateMemberList
(
chunk
);
// Check if the user has already join the room
if
(
$scope
.
state
.
user_id
in
members
)
{
if
(
"
join
"
===
members
[
$scope
.
state
.
user_id
].
membership
)
{
needsToJoin
=
false
;
}
},
function
(
error
)
{
$scope
.
feedback
=
"
Failed get member list:
"
+
error
.
data
.
error
;
}
);
}
paginate
(
MESSAGES_PER_PAGINATION
);
},
function
(
reason
)
{
$scope
.
feedback
=
"
Can't join room:
"
+
reason
;
});
// Do we to join the room before starting?
if
(
needsToJoin
)
{
matrixService
.
join
(
$scope
.
room_id
).
then
(
function
()
{
console
.
log
(
"
Joined room
"
+
$scope
.
room_id
);
onInit3
();
},
function
(
reason
)
{
$scope
.
feedback
=
"
Can't join room:
"
+
reason
;
});
}
else
{
onInit3
();
}
}
);
};
var
onInit3
=
function
()
{
console
.
log
(
"
onInit3
"
);
// TODO: We should be able to keep them
eventHandlerService
.
resetRoomMessages
(
$scope
.
room_id
);
// Make recents highlight the current room
$scope
.
recentsSelectedRoomID
=
$scope
.
room_id
;
paginate
(
MESSAGES_PER_PAGINATION
);
};
$scope
.
inviteUser
=
function
(
user_id
)
{
...
...
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