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
b3a0961c
Commit
b3a0961c
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
SYWEB-7: Use sessionStorage to make per-room history survives when the user navigates through rooms
parent
d9a9a470
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
+17
-1
17 additions, 1 deletion
webclient/room/room-controller.js
with
17 additions
and
1 deletion
webclient/room/room-controller.js
+
17
−
1
View file @
b3a0961c
...
@@ -738,7 +738,10 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
...
@@ -738,7 +738,10 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
// Make recents highlight the current room
// Make recents highlight the current room
$scope
.
recentsSelectedRoomID
=
$scope
.
room_id
;
$scope
.
recentsSelectedRoomID
=
$scope
.
room_id
;
// Get the up-to-date the current member list
// Init the history for this room
history
.
init
();
// Get the up-to-date the current member list
matrixService
.
getMemberList
(
$scope
.
room_id
).
then
(
matrixService
.
getMemberList
(
$scope
.
room_id
).
then
(
function
(
response
)
{
function
(
response
)
{
for
(
var
i
=
0
;
i
<
response
.
data
.
chunk
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
response
.
data
.
chunk
.
length
;
i
++
)
{
...
@@ -851,6 +854,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
...
@@ -851,6 +854,8 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
};
};
// Manage history of typed messages
// Manage history of typed messages
// History is saved in sessionStoratge so that it survives when the user
// navigates through the rooms and when it refreshes the page
var
history
=
{
var
history
=
{
// The list of typed messages. Index 0 is the more recents
// The list of typed messages. Index 0 is the more recents
data
:
[],
data
:
[],
...
@@ -861,10 +866,21 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
...
@@ -861,10 +866,21 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
// The message the user has started to type before going into the history
// The message the user has started to type before going into the history
typingMessage
:
undefined
,
typingMessage
:
undefined
,
// Init/load data for the current room
init
:
function
()
{
var
data
=
sessionStorage
.
getItem
(
"
history_
"
+
$scope
.
room_id
);
if
(
data
)
{
this
.
data
=
JSON
.
parse
(
data
);
}
},
// Store a message in the history
// Store a message in the history
push
:
function
(
message
)
{
push
:
function
(
message
)
{
this
.
data
.
unshift
(
message
);
this
.
data
.
unshift
(
message
);
// Update the session storage
sessionStorage
.
setItem
(
"
history_
"
+
$scope
.
room_id
,
JSON
.
stringify
(
this
.
data
));
// Reset history position
// Reset history position
this
.
position
=
-
1
;
this
.
position
=
-
1
;
this
.
typingMessage
=
undefined
;
this
.
typingMessage
=
undefined
;
...
...
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