fix: 修复文件协作不提醒的问题

This commit is contained in:
kuaifan 2022-04-12 11:18:44 +08:00
parent b1ee3fe3cd
commit 9ffa46a878
6 changed files with 30 additions and 24 deletions

View File

@ -259,15 +259,15 @@ class File extends AbstractModel
//
if ($userid === null) {
$userid = [$this->userid];
if ($this->share == 1) {
$builder = WebSocket::select(['userid']);
if ($action == 'content') {
$builder->wherePath('file/content/' . $this->id);
}
$userid = array_merge($userid, $builder->pluck('userid')->toArray());
} elseif ($this->share == 2) {
$userid = array_merge($userid, FileUser::whereFileId($this->id)->pluck('userid')->toArray());
$builder = WebSocket::select(['userid']);
if ($action == 'content') {
$builder->wherePath("/single/file/{$this->id}");
} elseif ($this->pid > 0) {
$builder->wherePath("/manage/file/{$this->pid}");
} else {
$builder->wherePath("/manage/file");
}
$userid = array_merge($userid, $builder->pluck('userid')->toArray());
$userid = array_values(array_filter(array_unique($userid)));
}
if (empty($userid)) {

View File

@ -145,10 +145,10 @@ class WebSocketService implements WebSocketHandlerInterface
$pathOld = $row->path;
$row->path = $pathNew;
$row->save();
if (preg_match("/^file\/content\/\d+$/", $pathOld)) {
if (preg_match("/^\/single\/file\/\d+$/", $pathOld)) {
$this->pushPath($pathOld);
}
if (preg_match("/^file\/content\/\d+$/", $pathNew)) {
if (preg_match("/^\/single\/file\/\d+$/", $pathNew)) {
$this->pushPath($pathNew);
}
}
@ -211,7 +211,7 @@ class WebSocketService implements WebSocketHandlerInterface
/** @var WebSocket $item */
foreach ($list as $item) {
$item->delete();
if ($item->path && str_starts_with($item->path, "file/content/")) {
if ($item->path && str_starts_with($item->path, "/single/file/")) {
$array[$item->path] = $item->path;
}
}

View File

@ -22,6 +22,7 @@ export default {
data() {
return {
curPath: this.$route.path,
transitionName: null,
}
},
@ -57,11 +58,12 @@ export default {
},
computed: {
...mapState(['taskId', 'cacheDrawerOverlay']),
...mapState(['userId', 'cacheDrawerOverlay']),
},
watch: {
'$route'(To, From) {
this.curPath = To.path;
if (this.transitionName === null) {
this.transitionName = 'app-slide-no';
return;
@ -70,7 +72,17 @@ export default {
return;
}
this.slideType(To, From);
}
},
curPath: {
handler(path) {
if (this.userId > 0) {
path = path.replace(/^\/manage\/file\/\d+\/(\d+)$/, "/single/file/$1")
this.$store.dispatch("websocketPath", path)
}
},
immediate: true
},
},
methods: {

View File

@ -615,6 +615,7 @@ export default {
watch: {
'$route' (route) {
this.curPath = route.path;
this.chackPass();
},
userInfo() {
@ -662,14 +663,6 @@ export default {
}
},
curPath: {
handler(path) {
this.$store.dispatch("websocketPath", path);
this.chackPass();
},
immediate: true
},
unreadTotal: {
handler(num) {
if (this.$Electron) {

View File

@ -162,16 +162,16 @@ export default {
wsMsg: {
handler(info) {
const {type, data} = info;
const {type, action, data} = info;
switch (type) {
case 'path':
if (data.path == 'file/content/' + this.fileId) {
if (data.path == '/single/file/' + this.fileId) {
this.editUser = data.userids;
}
break;
case 'file':
if (data.action == 'content') {
if (action == 'content') {
if (this.value && data.id == this.fileId) {
$A.modalConfirm({
title: "更新提示",

View File

@ -968,6 +968,7 @@ export default {
nodeIntegrationInSubFrames: item.type === 'drawio'
},
});
this.browseFile(0);
},
clickRow(row, column) {